Hey im looking for some help on triggers

Status
Not open for further replies.
  • Spawn
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units of type Barracks) and do (Actions)
        • Loop - Actions
          • Set temp_point = (Position of (Picked unit))
          • Unit - Create 1 Footman for (Owner of (Picked unit)) at temp_point facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_temp_point)
 
  • Spawn
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units of type Barracks) and do (Actions)
        • Loop - Actions
          • Set temp_point = (Position of (Picked unit))
          • Unit - Create 1 Footman for (Owner of (Picked unit)) at temp_point facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_temp_point)
hey mate
how do i create this? Set temp_point = (Position of (Picked unit))
im currently testing this out for lag reasons, an yeah i cant find this command?
 
function InitGlobals takes nothing returns nothing
endfunction

function Trig_Melee_1_spawn_Func002A takes nothing returns nothing
set udg_temp_point = GetUnitLoc(GetEnumUnit())
call CreateNUnitsAtLoc( 1, 'h002', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
call RemoveLocation(udg_temp_point)
endfunction

function Trig_Melee_1_spawn_Actions takes nothing returns nothing
set bj_wantDestroyGroup = True
call ForGroupBJ( GetUnitsOfTypeIdAll('h003'), function Trig_Melee_1_spawn_Func002A )
endfunction

//===========================================================================
function InitTrig_Melee_1_spawn takes nothing returns nothing
set gg_trg_Melee_1_spawn = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Melee_1_spawn, 10.00 )
call TriggerAddAction( gg_trg_Melee_1_spawn, function Trig_Melee_1_spawn_Actions )
endfunction

This is the error i am getting
 
Why not just like this:
[trigger=Barracks Spawn]Barracks Spawn
Events
Time - Every 10.00 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Barracks)) and do (Actions)
Loop - Actions
Unit - Create 1 Footman for (Owner of (Picked unit)) at (Position of (Picked unit)) facing Default building facing degrees[/trigger]

That creates a footman every 10 second at the feet of any barracks in the map for the player who owns the barracks.
 
Why not just like this:
[trigger=Barracks Spawn]Barracks Spawn
Events
Time - Every 10.00 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Barracks)) and do (Actions)
Loop - Actions
Unit - Create 1 Footman for (Owner of (Picked unit)) at (Position of (Picked unit)) facing Default building facing degrees[/trigger]

That creates a footman every 10 second at the feet of any barracks in the map for the player who owns the barracks.

That is fail, you create 2 leaks every time the trigger runs. Creating a unit at position creates a leak, so you need to appoint a temppoint variable and destroy it afterwards to null the leak. Also there is a leak with unit group.
 
Status
Not open for further replies.
Back
Top