function CleanItemNow takes nothing returns nothing
local timer t = GetExpiredTimer()
local item it = GetAttachedItem(t, "killitem")
call CleanAttachedVars(it)
call RemoveItem(it)
set it = null
call CleanAttachedVars(t)
call DestroyTimer(t)
set t = null
endfunction
function Trig_ItemCleaner_Actions takes nothing returns nothing
local timer t = CreateTimer()
local item it = GetManipulatedItem()
// prepare new one
call AttachObject(t, "killitem", it)
call AttachObject(it, "killtimer", t)
call TimerStart(t, 60., false, function CleanItemNow)
set it = null
set t = null
endfunction
//===========================================================================
function InitTrig_ItemCleaner takes nothing returns nothing
set gg_trg_ItemCleaner = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_ItemCleaner, EVENT_PLAYER_UNIT_DROP_ITEM)
call TriggerAddAction(gg_trg_ItemCleaner, function Trig_ItemCleaner_Actions)
endfunction