Hi guys. I wanted to make a trigger that makes the following:
everytime a unit owned by player one of type 1,2 or 3 dies, after 5 seconds a new unit of the same type is spawned in the cneter of the Rect
Tell me why this doesn't work? Rep for helpful answers, ofc.
Edit:

everytime a unit owned by player one of type 1,2 or 3 dies, after 5 seconds a new unit of the same type is spawned in the cneter of the Rect
Code:
function Trig_Respawn_units_Func003C takes nothing returns boolean
if ( ( GetUnitTypeId(GetDyingUnit()) == 'n602' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetDyingUnit()) == 'u602' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetDyingUnit()) == 'u603' ) ) then
return true
endif
return false
endfunction
function Trig_Respawn_units_Conditions takes nothing returns boolean
if ( not Trig_Respawn_units_Func003C() ) then
return false
endif
return true
endfunction
function Trig_Respawn_units_Actions takes nothing returns nothing
local unit u
set u = GetDyingUnit()
call TriggerSleepAction( 5.00 )
call CreateNUnitsAtLoc( 1, GetUnitTypeId(u), Player(0), GetRectCenter(gg_rct_Unit_Respawn), bj_UNIT_FACING )
endfunction
//===========================================================================
function InitTrig_Respawn_units takes nothing returns nothing
set gg_trg_Respawn_units = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Respawn_units, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Respawn_units, Condition( function Trig_Respawn_units_Conditions ) )
call TriggerAddAction( gg_trg_Respawn_units, function Trig_Respawn_units_Actions )
endfunction
Tell me why this doesn't work? Rep for helpful answers, ofc.
Edit:
-
Respawn units
-
Events
-
Unit - A unit Dies
-
-
Conditions
-
Or - Any (Conditions) are true
-
Conditions
-
(Unit-type of (Dying unit)) Equal to Risen Archer
-
(Unit-type of (Dying unit)) Equal to Risen Fighter
-
(Unit-type of (Dying unit)) Equal to Brute
-
-
-
-
Actions
-
Custom script: local unit u
-
Custom script: set u = GetDyingUnit()
-
Wait 5.00 seconds
-
Custom script: call CreateNUnitsAtLoc( 1, GetUnitTypeId(u), Player(0), GetRectCenter(gg_rct_Unit_Respawn), bj_UNIT_FACING )
-
-
Last edited: