function RevivePlayerCallback takes nothing returns nothing
local timer Callback=GetExpiredTimer()
local integer CallbackId=GetHandleId(Callback)
local unit Hero=LoadUnitHandle(udg_Hashtable,CallbackId,0)
local timerdialog Window=LoadTimerDialogHandle(udg_Hashtable,CallbackId,1)
local real X=GetRandomReal(GetRectMinX(gg_rct_Region_000),GetRectMaxX(gg_rct_Region_000))
local real Y=GetRandomReal(GetRectMinY(gg_rct_Region_000),GetRectMaxY(gg_rct_Region_000))
call ReviveHero(Hero,X,Y,true)
if(GetLocalPlayer()==GetOwningPlayer(Hero))then
call PanCameraTo(X,Y)
call ClearSelection()
call SelectUnit(Hero,true)
endif
set Hero=null
call DestroyTimer(Callback)
call DestroyTimerDialog(Window)
set Callback=null
set Window=null
call FlushChildHashtable(udg_Hashtable,CallbackId)
endfunction
function RevivePlayer takes nothing returns nothing
local unit Hero=GetTriggerUnit()
local timer Timer
local timerdialog Window
local integer TimerId
if(IsUnitType(Hero,UNIT_TYPE_HERO))then
set Timer=CreateTimer()
set TimerId=GetHandleId(Timer)
set Window=CreateTimerDialog(Timer)
call TimerStart(Timer,3.0,false,function RevivePlayerCallback)
call TimerDialogSetTitle(Window,"Revive")
call TimerDialogDisplay(Window,true)
call SaveUnitHandle(udg_Hashtable,TimerId,0,Hero)
call SaveTimerDialogHandle(udg_Hashtable,TimerId,1,Window)
set Timer=null
set Window=null
endif
set Hero=null
endfunction