• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

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