Corleone
New Member
- Reaction score
- 44
I've finished my spell for the spell contest ages ago, but when I tried to make a trigger that would make the mobs res after 45 seconds, it won't exactly work. I can't seem to figure out what's wrong.
The condition works, because it will res the Blademaster. However, it won't go past the 45 second wait. Any idea why?
Code:
function Trig_Unit_Death_Type takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) != GetUnitTypeId(udg_Blademaster)
endfunction
function Trig_Unit_Death_MUI_Actions takes nothing returns nothing
local location DyingPosition
local unit DeadUnit
if ( Trig_Unit_Death_Type() ) then
set DeadUnit = GetTriggerUnit()
set DyingPosition = GetUnitLoc(DeadUnit)
call TriggerSleepAction( 45.00 )
call CreateNUnitsAtLoc( 1, GetUnitTypeId(DeadUnit), GetOwningPlayer(DeadUnit), DyingPosition, GetRandomDirectionDeg() )
set DeadUnit = null
call RemoveLocation ( DyingPosition )
else
set DeadUnit = udg_Blademaster
set DyingPosition = GetRectCenter(GetPlayableMapRect())
call ReviveHeroLoc( DeadUnit, DyingPosition, true )
call RemoveLocation ( DyingPosition )
set DeadUnit = null
endif
endfunction
//===========================================================================
function InitTrig_Unit_Death_MUI takes nothing returns nothing
set gg_trg_Unit_Death_MUI = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Unit_Death_MUI, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Unit_Death_MUI, function Trig_Unit_Death_MUI_Actions )
endfunction
The condition works, because it will res the Blademaster. However, it won't go past the 45 second wait. Any idea why?