Name | Type | is_array | initial_value |
Integer | integer | No | |
Leaderboard | leaderboard | No | |
Lifes | integer | No | 30 |
Multiboard | multiboard | No | |
Player | player | No | |
Score | integer | Yes | |
Temp_Point | location | No | |
Temp_Point2 | location | No | |
Timer | timer | No | |
Wave | integer | No |
function Trig_Item_Stack_Conditions takes nothing returns boolean
return GetItemCharges(GetManipulatedItem()) > 0
endfunction
function Trig_Item_Stack_Actions takes nothing returns nothing
local integer i = 0
local item iteminslot
loop
set iteminslot = UnitItemInSlot(GetManipulatingUnit(), i)
if ( GetItemTypeId(iteminslot) == GetItemTypeId(GetManipulatedItem()) and iteminslot != GetManipulatedItem()) then
call SetItemCharges( iteminslot, ( GetItemCharges(iteminslot) + GetItemCharges(GetManipulatedItem()) ) )
call RemoveItem( GetManipulatedItem() )
set i = 5
// To end the loop i is increased
endif
set i = i + 1
exitwhen i > 5
endloop
set i = 0
set iteminslot = null
endfunction
// ==================
function InitTrig_Item_stack takes nothing returns nothing
set gg_trg_Item_stack = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Item_stack, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Item_stack, Condition( function Trig_Item_Stack_Conditions ) )
call TriggerAddAction( gg_trg_Item_stack, function Trig_Item_Stack_Actions )
endfunction