• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to 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)
 
Level 4
Joined
Nov 24, 2009
Messages
76
  • 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?
 
Level 4
Joined
Nov 24, 2009
Messages
76
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
 
Level 4
Joined
Aug 19, 2009
Messages
81
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.
 

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,267
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.
Top