- Joined
- May 21, 2009
- Messages
- 289
I have this JASS trigger, can I just copy and paste it into another map err right? And items will still stack? AND does this trigger stack every item that is acquired?
JASS trigger-
EDIT:
probably should have put this under Triggering and Script= sorry people
JASS trigger-
JASS:
function Combine_Items_Conditions takes nothing returns boolean
return GetItemCharges(GetManipulatedItem()) > 0
endfunction
function Combine_Items_Actions takes nothing returns nothing
local item NEWITEM = GetManipulatedItem()
local unit OURUNIT = GetManipulatingUnit()
local integer MAXIMUM = 15 //The max no. of charges allowed
local integer ITEMCOUNT = 0
local integer ITEMLOOP = 0
local integer CHARGES = 0
loop
exitwhen ITEMLOOP > 6
if GetItemTypeId(NEWITEM) == GetItemTypeId(UnitItemInSlot(OURUNIT, ITEMLOOP)) then
if GetItemCharges(UnitItemInSlot(OURUNIT, ITEMLOOP)) + GetItemCharges(NEWITEM) <= MAXIMUM then
if not (UnitItemInSlot(OURUNIT, ITEMLOOP) == NEWITEM) then
set CHARGES = GetItemCharges(UnitItemInSlot(OURUNIT, ITEMLOOP)) + GetItemCharges(NEWITEM)
call SetItemCharges(UnitItemInSlot(OURUNIT, ITEMLOOP), CHARGES)
call RemoveItem(NEWITEM)
set ITEMLOOP = 7
endif
endif
endif
if (ITEMLOOP < 7) then
set ITEMLOOP = ITEMLOOP + 1
endif
endloop
probably should have put this under Triggering and Script= sorry people