• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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,266
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