ArmyOfFrogs
New Member
- Reaction score
- 20
I have a respawn trigger set up to pick every unit, put their custom value in an array, as well as their location (InitPos). It seperates them by first setting the custom value (InitInt) for all units outside of dungeons (BanditCave), then once it reaches the end, sets DungeonStart to that value, adds all units in dungeon then sets DungeonEnd to that value.
Then when a unit dies, it starts a Respawn[InitInt], for 90 seconds. Once that expires, it creates a new unit-type equal to (InitInt), at (InitPos). There's 3 conditions for it to pass, value is > than 0, is < dungeon start, and is not in Bandit Cave. Yet occassionally there will be double spawns inside the bandit cave and I cannot find out why
Here's the triggers for normal respawn and the dungeon respawn
Thanks, any help is greatly appreciated.
Then when a unit dies, it starts a Respawn[InitInt], for 90 seconds. Once that expires, it creates a new unit-type equal to (InitInt), at (InitPos). There's 3 conditions for it to pass, value is > than 0, is < dungeon start, and is not in Bandit Cave. Yet occassionally there will be double spawns inside the bandit cave and I cannot find out why
Here's the triggers for normal respawn and the dungeon respawn
Code:
function Trig_Normal_Respawn_Conditions takes nothing returns boolean
if ( not ( GetOwningPlayer(GetTriggerUnit()) == Player(10) ) ) then
return false
endif
return true
endfunction
function Trig_Normal_Respawn_Func001Func002001 takes nothing returns boolean
return ( TimerGetRemaining(udg_Respawn[GetUnitUserData(GetTriggerUnit())]) == 0.00 )
endfunction
function Trig_Normal_Respawn_Func001C takes nothing returns boolean
if ( not ( GetUnitUserData(GetTriggerUnit()) >= 1 ) ) then
return false
endif
if ( not ( GetUnitUserData(GetTriggerUnit()) < udg_DungeonStart ) ) then
return false
endif
if ( not ( RectContainsUnit(gg_rct_BanditCave, GetTriggerUnit()) == false ) ) then
return false
endif
return true
endfunction
function Trig_Normal_Respawn_Actions takes nothing returns nothing
if ( Trig_Normal_Respawn_Func001C() ) then
call StartTimerBJ( udg_Respawn[GetUnitUserData(GetTriggerUnit())], false, 90.00 )
loop
exitwhen ( Trig_Normal_Respawn_Func001Func002001() )
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 1))
endloop
call CreateNUnitsAtLoc( 1, GetUnitTypeId(GetTriggerUnit()), Player(10), udg_InitPos[GetUnitUserData(GetTriggerUnit())], bj_UNIT_FACING )
call SetUnitUserData( GetLastCreatedUnit(), GetUnitUserData(GetTriggerUnit()) )
else
endif
endfunction
//===========================================================================
function InitTrig_Normal_Respawn takes nothing returns nothing
set gg_trg_Normal_Respawn = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Normal_Respawn, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Normal_Respawn, Condition( function Trig_Normal_Respawn_Conditions ) )
call TriggerAddAction( gg_trg_Normal_Respawn, function Trig_Normal_Respawn_Actions )
endfunction
Code:
function Trig_Dungeon_Respawn_Func002C takes nothing returns boolean
if ( ( GetUnitTypeId(GetTriggerUnit()) == 'H00B' ) ) then
return true
endif
return false
endfunction
function Trig_Dungeon_Respawn_Conditions takes nothing returns boolean
if ( not Trig_Dungeon_Respawn_Func002C() ) then
return false
endif
return true
endfunction
function Trig_Dungeon_Respawn_Actions takes nothing returns nothing
set bj_forLoopAIndex = udg_DungeonStart
set bj_forLoopAIndexEnd = ( udg_DungeonEnd - 1 )
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call TriggerSleepAction( 2 )
call CreateNUnitsAtLoc( 1, udg_InitType[GetForLoopIndexA()], Player(10), udg_InitPos[GetForLoopIndexA()], bj_UNIT_FACING )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction
//===========================================================================
function InitTrig_Dungeon_Respawn takes nothing returns nothing
set gg_trg_Dungeon_Respawn = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Dungeon_Respawn, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Dungeon_Respawn, Condition( function Trig_Dungeon_Respawn_Conditions ) )
call TriggerAddAction( gg_trg_Dungeon_Respawn, function Trig_Dungeon_Respawn_Actions )
endfunction
Thanks, any help is greatly appreciated.