scope ItemType initializer onInit
private function Actions takes nothing returns boolean
local integer i = 0
local unit u = GetTriggerUnit()
local item itm = GetManipulatedItem()
local item tmp = null
local itemtype x = GetItemType(itm)
loop
exitwhen i == 6
set tmp = UnitItemInSlot(u, i)
if (GetItemType(tmp) == x and itm != tmp) then
call CreateItem(GetItemTypeId(itm), GetUnitX(u), GetUnitY(u))
call RemoveItem(itm)
set itm = null
set tmp = null
set u = null
return false
endif
set i = i + 1
endloop
set itm = null
set tmp = null
set u = null
set x = null
return false
endfunction
//===========================================================================
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_PICKUP_ITEM)
call TriggerAddCondition(t, function Actions)
endfunction
endscope