function Trig_Alliance_Death_Conditions takes nothing returns boolean
if(IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO)) and (IsUnitAlly(GetTriggerUnit(), Player(10))) then
return true
endif
return false
endfunction
//===========================================================================
function Trig_Alliance_Death_Actions takes nothing returns nothing
local unit OURHERO = GetDyingUnit()
local timer OURTIMER = CreateTimer()
local timerdialog WINDOW
local player OwningPlayer = GetOwningPlayer(OURHERO)
local player LocalPlayer = GetLocalPlayer()
local integer HEROWAIT = GetHeroLevel(OURHERO)*3
// Start Revive Timer
call TimerStart(OURTIMER, HEROWAIT, false, null)
if(OwningPlayer == LocalPlayer) then
set WINDOW = CreateTimerDialog(OURTIMER)
call TimerDialogSetTitle(WINDOW, GetPlayerName(OwningPlayer))
call TimerDialogDisplay(WINDOW, true)
endif
call TriggerSleepAction(HEROWAIT)
call ReviveHero(OURHERO, GetRectCenterX(gg_rct_Alliance_Rez), GetRectCenterY(gg_rct_Alliance_Rez), true)
if(OwningPlayer == LocalPlayer) then
call PanCameraToTimed(GetRectCenterX(gg_rct_Alliance_Rez), GetRectCenterY(gg_rct_Alliance_Rez), 0.60)
// Cleanup Dialog
call DestroyTimerDialog(WINDOW)
set WINDOW = null
endif
// Cleanup Timer
call DestroyTimer(OURTIMER)
// Nullify Variables
set OURHERO = null
set OURTIMER = null
set OwningPlayer = null
set LocalPlayer = null
endfunction
//===========================================================================
function InitTrig_Alliance_Death takes nothing returns nothing
set gg_trg_Alliance_Death = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Alliance_Death, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Alliance_Death, Condition( function Trig_Alliance_Death_Conditions ) )
call TriggerAddAction( gg_trg_Alliance_Death, function Trig_Alliance_Death_Actions )
endfunction