Arkan
Nobody rides for free
- Reaction score
- 92
My revival trigger, it works when you die the first time, but when you die a second time you won't respawn, and the camera will pan you to the center of the map instead of the base as it does when you die the first time, really weird...
udg_DeadTimer is an integer array.
And the reason I use a global integer instead of a local is because I want players to be able to write -revive and that will set the global to 0.
Code:
function Trig_Revival_Conditions takes nothing returns boolean
return IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true
endfunction
function Trig_Revival_Actions takes nothing returns nothing
local unit dying=GetTriggerUnit()
local player p=GetOwningPlayer(dying)
local location l
set udg_DeadTimer[GetConvertedPlayerId(p)]=GetHeroLevel(dying)*5
loop
exitwhen udg_DeadTimer[GetConvertedPlayerId(p)]==0
call MultiboardSetItemValueBJ(udg_MB,5,udg_Playerrow[GetPlayerId(p)],"|cffAFEEEE"+I2S(udg_DeadTimer[GetConvertedPlayerId(p)])+"|r")
call PolledWait(1)
set udg_DeadTimer[GetConvertedPlayerId(p)]=udg_DeadTimer[GetConvertedPlayerId(p)]-1
endloop
if(IsPlayerInForce(p,udg_NorthPlayers)==true)then
set l=udg_NRegen
call PanCameraToTimedLocForPlayer(p,udg_NRegen,1)
else
set l=udg_SRegen
call PanCameraToTimedLocForPlayer(p,udg_SRegen,1)
endif
call MultiboardSetItemValueBJ(udg_MB,5,udg_Playerrow[GetPlayerId(p)],"")
call BJDebugMsg(GetUnitName(dying))
call ReviveHeroLoc(dying,l,true)
set dying=null
set p=null
call RemoveLocation(l)
set l=null
endfunction
//===========================================================================
function InitTrig_Revival takes nothing returns nothing
set gg_trg_Revival = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Revival, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Revival, Condition( function Trig_Revival_Conditions ) )
call TriggerAddAction( gg_trg_Revival, function Trig_Revival_Actions )
endfunction
udg_DeadTimer is an integer array.
And the reason I use a global integer instead of a local is because I want players to be able to write -revive and that will set the global to 0.