function GetDelay takes nothing returns real
return 30.00
endfunction
function Trig_MUI_Revive_Conditions takes nothing returns boolean
return IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true
endfunction
function Loop takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId(t)
local real x = LoadReal(udg_Hash, id, 1)
local real y = LoadReal(udg_Hash, id, 2)
local unit u = LoadUnitHandle(udg_Hash, id, 3)
call ReviveHero(u, x, y, true)
call SetUnitState(u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_MAX_LIFE)
call SetUnitState(u, UNIT_STATE_MANA, GetUnitState(u, UNIT_STATE_MAX_MANA)
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(udg_Hash, id)
set u = null
set t = null
endfunction
function Trig_MUI_Revive_Actions takes nothing returns nothing
local timer t = CreateTimer()
local integer id = GetHandleId(t)
local unit u = GetTriggerUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
call SaveReal(udg_Hash, id, 1, x)
call SaveReal(udg_Hash, id, 2, y)
call SaveUnitHandle(udg_Hash, id, 3, u)
call TimerStart(t, GetDelay, false, function Loop)
set u = null
set t = null
endfunction
function InitTrig_MUI_Revive takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( t, Condition( function Trig_MUI_Revive_Conditions ) )
call TriggerAddAction( t, function Trig_MUI_Revive_Actions )
set udg_Hash = InitHashtable()
set t = null
endfunction