function Loop takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId(t)
local unit u = LoadUnitHandle(yourHashtable, id, 1)
local real duration = LoadReal(yourHashtable, id, 2)
if duration <= 0 then
call KillUnit(u)
call FlushChildHandle(yourHashtable, id)
call PauseTimer(t)
call DestroyTimer(t)
else
call SaveUnitHandle(yourHashtable, id, 2, duration - 0.03125)
endif
set t = null
set u = null
endfunction
function Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit u = GetTriggerUnit()
local integer id = GetHandleId(t)
local real duration = 5.00
call SaveUnitHandle(yourHashtable, id, 1, u)
call SaveUnitHandle(yourHashtable, id, 2, duration)
call TimerStart (t, 0.03125, true, function Loop)
set t = null
set u = null
endfunction