Hi guys. I have recently started working with triggers for my map. I am wondering if this is efficient. This is supposed to be a spawn trigger once 2 gates have been destroyed. I wonder if I should separate this into various triggers or maybe if its better to just get em all on one like in the example below which is 1 event, no conditions 2 IF actions
Code:
function Trig_T1_Spawns_Func001C takes nothing returns boolean
if ( not ( IsUnitAliveBJ(gg_unit_h005_0052) == true ) ) then
return false
endif
if ( not ( IsDestructableAliveBJ(gg_dest_LTe2_0067) == false ) ) then
return false
endif
if ( not ( IsDestructableAliveBJ(gg_dest_B002_0352) == false ) ) then
return false
endif
return true
endfunction
function Trig_T1_Spawns_Func002C takes nothing returns boolean
if ( not ( IsUnitAliveBJ(gg_unit_h005_0085) == true ) ) then
return false
endif
if ( not ( IsDestructableAliveBJ(gg_dest_B002_0354) == false ) ) then
return false
endif
if ( not ( IsDestructableAliveBJ(gg_dest_LTe4_0006) == false ) ) then
return false
endif
return true
endfunction
function Trig_T1_Spawns_Actions takes nothing returns nothing
if ( Trig_T1_Spawns_Func001C() ) then
call CreateNUnitsAtLoc( 2, 'e000', Player(8), GetRectCenter(gg_rct_RightBarracks), 315.00 )
call CreateNUnitsAtLoc( 4, 'h00J', Player(8), GetRectCenter(gg_rct_RightBarracks), 315.00 )
else
endif
if ( Trig_T1_Spawns_Func002C() ) then
call CreateNUnitsAtLoc( 4, 'h00J', Player(8), GetRectCenter(gg_rct_LeftBarracks), 225.00 )
call CreateNUnitsAtLoc( 2, 'e000', Player(8), GetRectCenter(gg_rct_LeftBarracks), 225.00 )
else
endif
endfunction
//===========================================================================
function InitTrig_T1_Spawns takes nothing returns nothing
set gg_trg_T1_Spawns = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_T1_Spawns, 30.00 )
call TriggerAddAction( gg_trg_T1_Spawns, function Trig_T1_Spawns_Actions )
endfunction