Name | Type | is_array | initial_value |
chance | integer | Yes | |
Dialog | dialog | Yes | |
DialogButton | button | Yes | |
Point | location | Yes | |
unitgroup | group | Yes | |
unitprop | unit | Yes | |
wave10 | timer | No | |
wave11 | timer | No | |
wave12 | timer | No | |
wave13 | timer | No | |
wave14 | timer | No | |
wave15 | timer | No | |
wave16 | timer | No | |
wave17 | timer | No | |
wave18 | timer | No | |
wave19 | timer | No | |
wave2 | timer | No | |
wave20 | timer | No | |
wave21 | timer | No | |
wave22 | timer | No | |
wave23 | timer | No | |
wave24 | timer | No | |
wave25 | timer | No | |
wave3 | timer | No | |
wave4 | timer | No | |
wave5 | timer | No | |
wave6 | timer | No | |
wave7 | timer | No | |
wave8 | timer | No | |
wave9 | timer | No | |
Waves | timer | Yes | |
Weapon | dialog | No |
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 = 50 //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
set NEWITEM = null
set OURUNIT = null
endfunction
function InitTrig_Combine_Items takes nothing returns nothing
set gg_trg_Combine_Items = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Combine_Items, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Combine_Items, Condition( function Combine_Items_Conditions ) )
call TriggerAddAction( gg_trg_Combine_Items, function Combine_Items_Actions )
endfunction