• 🏆 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!

[Trigger] Heeeelp! Messed my spawn trigger!

Status
Not open for further replies.
Level 3
Joined
Jan 16, 2011
Messages
44
I need help my spawn trigger is well messed up. The timer will not stop until it spawn the 1st and 2nd level of creeps wave. After it stop it will trigger again when all creeps died but the next wave is empty because I only assigned 2 level creeps.

My Triggers

  • Initialize
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility across (Playable map area))
      • Player - Turn Gives bounty On for Player 11 (Dark Green)
      • Set lvlnum = 0
      • -------- LEVEL 1 --------
      • Set Unit_Type_Var_1[1] = Adik na Askal
      • Set Unit_Type_Var_2[1] = Adik na Manok
      • Set Unit_Type_Var_3[1] = Adik na Kanding
      • -------- Unit Amount --------
      • Set Unit_Integer_Var_1[1] = 1
      • Set Unit_Integer_Var_2[1] = 3
      • Set Unit_Integer_Var_3[1] = 3
      • -------- LEVEL 2 --------
      • Set Unit_Type_Var_1[2] = Adik na Askal
      • Set Unit_Type_Var_2[2] = Adik na Bayot
      • Set Unit_Type_Var_3[2] = Adik na Kanding
      • -------- Unit Amount --------
      • Set Unit_Integer_Var_1[2] = 3
      • Set Unit_Integer_Var_2[2] = 1
      • Set Unit_Integer_Var_3[2] = 4
  • Timer Initialize
    • Events
      • Time - Elapsed game time is 10.00 seconds
    • Conditions
    • Actions
      • Game - Display to (All players) the text: Countdown started. ...
      • Countdown Timer - Start roundwindow as a One-shot timer that will expire in 30.00 seconds
      • Set RoundWindow_Var = (Last started timer)
      • Countdown Timer - Create a timer window for (Last started timer) with title (Enemy Wave + ((String(lvlnum)) + in: ))
      • Player Group - Pick every player in (All players) and do (Countdown Timer - Show (Last created timer window) for (Picked player))
      • Player Group - Pick every player in (All players) and do (Player - Add 1000 to (Picked player) Current gold)

  • Round Timer expire
    • Events
      • Time - roundwindow expires
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (|c00999900Round + (|c00990000 + ((String(lvlnum)) + (|r + |c00999900has started!|r))))
      • Player Group - Pick every player in (All players) and do (Countdown Timer - Hide (Last created timer window) for (Picked player))
      • Countdown Timer - Destroy (Last created timer window)
      • Wait until ((All units of (Units owned by Player 11 (Dark Green)) are dead) Equal to True), checking every 1.00 seconds
      • Game - Display to (All players) the text: Countdown Started f...
      • Countdown Timer - Start roundwindow as a One-shot timer that will expire in 20.00 seconds
      • Set RoundWindow_Var = (Last started timer)
      • Countdown Timer - Create a timer window for (Last started timer) with title (Enemy Wave + ((String(lvlnum)) + in: ))
      • Player Group - Pick every player in (All players) and do (Countdown Timer - Show (Last created timer window) for (Picked player))
  • Region
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set loc[1] = (Center of spawleft <gen>)
      • Set loc[2] = (Center of spawnmiddle <gen>)
      • Set loc[3] = (Center of spawnright <gen>)
  • Spawn
    • Events
      • Time - roundwindow expires
    • Conditions
    • Actions
      • Set lvlnum = (lvlnum + 1)
      • For each (Integer A) from 1 to Unit_Integer_Var_1[lvlnum], do (Actions)
        • Loop - Actions
          • Set incrementx = 1
          • Set incrementy = 1
          • For each (Integer B) from 1 to 3, do (Actions)
            • Loop - Actions
              • Unit - Create 1 Unit_Type_Var_1[lvlnum] for Player 11 (Dark Green) at loc[incrementy] facing Default building facing degrees
              • Unit - Order (Last created unit) to Attack-Move To (Center of target <gen>)
              • Unit - Create 1 Unit_Type_Var_1[lvlnum] for Player 11 (Dark Green) at loc[(incrementy + 1)] facing Default building facing degrees
              • Unit - Order (Last created unit) to Attack-Move To (Center of target <gen>)
              • Set incrementy = (incrementy + 2)
          • Wait 0.75 seconds
      • For each (Integer A) from 1 to Unit_Integer_Var_3[lvlnum], do (Actions)
        • Loop - Actions
          • Set incrementx = 1
          • Set incrementy = 1
          • For each (Integer B) from 1 to 4, do (Actions)
            • Loop - Actions
              • Unit - Create 1 Unit_Type_Var_3[lvlnum] for Player 11 (Dark Green) at loc[incrementy] facing Default building facing degrees
              • Unit - Order (Last created unit) to Attack-Move To (Center of target <gen>)
              • Unit - Create 1 Unit_Type_Var_3[lvlnum] for Player 11 (Dark Green) at loc[(incrementy + 1)] facing Default building facing degrees
              • Unit - Order (Last created unit) to Attack-Move To (Center of target <gen>)
              • Set incrementx = (incrementx + 1)
              • Set incrementy = (incrementy + 2)
          • Wait 0.75 seconds
      • For each (Integer A) from 1 to Unit_Integer_Var_2[lvlnum], do (Actions)
        • Loop - Actions
          • Set incrementx = 1
          • Set incrementy = 1
          • For each (Integer B) from 1 to 4, do (Actions)
            • Loop - Actions
              • Unit - Create 1 Unit_Type_Var_2[lvlnum] for Player 11 (Dark Green) at loc[incrementy] facing Default building facing degrees
              • Unit - Order (Last created unit) to Attack-Move To (Center of target <gen>)
              • Unit - Create 1 Unit_Type_Var_2[lvlnum] for Player 11 (Dark Green) at loc[(incrementy + 1)] facing Default building facing degrees
              • Unit - Order (Last created unit) to Attack-Move To (Center of target <gen>)
              • Set incrementx = (incrementx + 1)
              • Set incrementy = (incrementy + 2)
          • Wait 0.75 seconds
 
Level 3
Joined
Jan 16, 2011
Messages
44
The timer must not start after it reaches zero. It should wait for all Player 11 units to die before it starts again. The timer on my trigger will stop after 2 timer is shown consecutively.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Rather than using Wait until condition, I'd use a unit dies trigger.

  • Untitled Trigger 041
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units owned by Player 11 (Dark Green) matching (((Matching unit) is alive) Equal to True))) Equal to 0
        • Then - Actions
          • Run spawn trigger
          • Start timer
        • Else - Actions
 
Level 8
Joined
Dec 12, 2010
Messages
280
  • For each (Integer A) from 1 to Unit_Integer_Var_1[lvlnum], do (Actions)
  • Loop - Actions
  • Set incrementx = 1
  • Set incrementy = 1
This is just wrong. Why would you loop a set integer = 1 action?!


  • For each (Integer B) from 1 to 3, do (Actions)
  • Loop - Actions
  • Unit - Create 1 Unit_Type_Var_1[lvlnum] for Player 11 (Dark Green) at loc[incrementy] facing Default building facing degrees
  • Unit - Order (Last created unit) to Attack-Move To (Center of target <gen>)
  • Unit - Create 1 Unit_Type_Var_1[lvlnum] for Player 11 (Dark Green) at loc[(incrementy + 1)] facing Default building facing degrees
  • Unit - Order (Last created unit) to Attack-Move To (Center of target <gen>)
  • Set incrementy = (incrementy + 2)
The last action in this part is setting the integer value to 7 since it loops 3 times and your using this integer in a region array that only goes up to 3!
The Wait actions in your triggers do nothing. There is no action that follows.

The spawn trigger is your problem. It gives me a headache just lookin at it.
 
Level 8
Joined
Dec 12, 2010
Messages
280
If you change your spawn trigger to match this one below it should work.
If you can see what I did here just remove the Set incremety = incremety + 2 lines and add the extra create unit line and order line in each loop action.


  • Spawn
    • Events
    • Time - roundwindow expires
    • Conditions
    • Actions
    • Set lvlnum = (lvlnum + 1)
    • For each (Integer A) from 1 to Unit_Integer_Var_1[lvlnum], do (Actions)
    • Loop - Actions
    • Set incrementx = 1
    • Set incrementy = 1
    • For each (Integer B) from 1 to 3, do (Actions)
    • Loop - Actions
      • Unit - Create 1 Unit_Type_Var_1[lvlnum] for Player 11 (Dark Green) at loc [incrementy] facing Default building facing degrees
      • Unit - Order (Last created unit) to Attack-Move To (Center of target<gen>)
      • Unit - Create 1 Unit_Type_Var_1[lvlnum] for Player 11 (Dark Green) at loc[incrementy + 1] facing Default building facing degrees
      • Unit - Order (Last created unit) to Attack-Move To (Center of target<gen>)
      • Unit - Create 1 Unit_Type_Var_1[lvlnum] for Player 11 (Dark Green) at loc[incrementy + 2] facing Default building facing degrees
      • Unit - Order (Last created unit) to Attack-Move To (Center of target<gen>)
    • Set incrementx = (incrementx + 1)
    • Wait 0.75 seconds
    • For each (Integer A) from 1 to Unit_Integer_Var_3[lvlnum], do (Actions)
    • Loop - Actions
    • Set incrementx = 1
    • Set incrementy = 1
    • For each (Integer B) from 1 to 4, do (Actions)
    • Loop - Actions
    • Unit - Create 1 Unit_Type_Var_3[lvlnum] for Player 11 (Dark Green)at loc [incrementy] facing Default building facing degrees
    • Unit - Order (Last created unit) to Attack-Move To (Center of target <gen>)
    • Unit - Create 1 Unit_Type_Var_3[lvlnum] for Player 11 (Dark Green) at loc [(incrementy + 1)] facing Default building facing degrees
    • Unit - Order (Last created unit) to Attack-Move To (Center of target <gen>)
    • Unit - Create 1 Unit_Type_Var_3[lvlnum] for Player 11 (Dark Green) at loc[(incrementy + 2)] facing Default building facing degrees
    • Unit - Order (Last created unit) to Attack-Move To (Center of target <gen>)
    • Set incrementx = (incrementx + 1)
    • Wait 0.75 seconds
    • For each (Integer A) from 1 to Unit_Integer_Var_2[lvlnum], do (Actions)
    • Loop - Actions
    • Set incrementx = 1
    • Set incrementy = 1
    • For each (Integer B) from 1 to 4, do (Actions)
    • Loop - Actions
    • Unit - Create 1 Unit_Type_Var_2[lvlnum] for Player 11 (Dark Green) at loc[incrementy] facing Default building facing degrees
    • Unit - Order (Last created unit) to Attack-Move To (Center of target <gen>)
    • Unit - Create 1 Unit_Type_Var_2[lvlnum] for Player 11 (Dark Green) at loc[(incrementy + 1)] facing Default building facing degrees
    • Unit - Order (Last created unit) to Attack-Move To (Center of target <gen>)
    • Unit - Create 1 Unit_Type_Var_2[lvlnum] for Player 11 (Dark Green) at loc[(incrementy + 2)] facing Default building facing degrees
  • Unit - Order (Last created unit) to Attack-Move To (Center of target <gen>)
    • Set incrementx = (incrementx + 1)
    • Wait 0.75 seconds
 
Level 3
Joined
Jan 16, 2011
Messages
44
It still did not work. The timer will run immediately after it reaches zero.
  • Spawn
    • Events
      • Time - roundwindow expires
    • Conditions
    • Actions
      • Set lvlnum = (lvlnum + 1)
      • For each (Integer A) from 1 to Unit_Integer_Var_1[lvlnum], do (Actions)
        • Loop - Actions
          • Set incrementx = 1
          • Set incrementy = 1
          • For each (Integer B) from 1 to 3, do (Actions)
            • Loop - Actions
              • Unit - Create 1 Unit_Type_Var_1[lvlnum] for Player 11 (Dark Green) at loc[incrementy] facing Default building facing degrees
              • Unit - Order (Last created unit) to Attack-Move To (Center of target <gen>)
              • Unit - Create 1 Unit_Type_Var_1[lvlnum] for Player 11 (Dark Green) at loc[incrementy] facing Default building facing degrees
              • Unit - Order (Last created unit) to Attack-Move To (Center of target <gen>)
              • Unit - Create 1 Unit_Type_Var_1[lvlnum] for Player 11 (Dark Green) at loc[(incrementy + 1)] facing Default building facing degrees
              • Unit - Order (Last created unit) to Attack-Move To (Center of target <gen>)
              • Set incrementy = (incrementx + 1)
          • Wait 0.75 seconds
      • For each (Integer A) from 1 to Unit_Integer_Var_3[lvlnum], do (Actions)
        • Loop - Actions
          • Set incrementx = 1
          • Set incrementy = 1
          • For each (Integer B) from 1 to 4, do (Actions)
            • Loop - Actions
              • Unit - Create 1 Unit_Type_Var_3[lvlnum] for Player 11 (Dark Green) at loc[incrementy] facing Default building facing degrees
              • Unit - Order (Last created unit) to Attack-Move To (Center of target <gen>)
              • Unit - Create 1 Unit_Type_Var_3[lvlnum] for Player 11 (Dark Green) at loc[incrementy] facing Default building facing degrees
              • Unit - Order (Last created unit) to Attack-Move To (Center of target <gen>)
              • Unit - Create 1 Unit_Type_Var_3[lvlnum] for Player 11 (Dark Green) at loc[(incrementy + 1)] facing Default building facing degrees
              • Unit - Order (Last created unit) to Attack-Move To (Center of target <gen>)
              • Set incrementx = (incrementx + 1)
              • Set incrementy = (incrementy + 2)
          • Wait 0.75 seconds
      • For each (Integer A) from 1 to Unit_Integer_Var_2[lvlnum], do (Actions)
        • Loop - Actions
          • Set incrementx = 1
          • Set incrementy = 1
          • For each (Integer B) from 1 to 4, do (Actions)
            • Loop - Actions
              • Unit - Create 1 Unit_Type_Var_2[lvlnum] for Player 11 (Dark Green) at loc[incrementy] facing Default building facing degrees
              • Unit - Order (Last created unit) to Attack-Move To (Center of target <gen>)
              • Unit - Create 1 Unit_Type_Var_2[lvlnum] for Player 11 (Dark Green) at loc[(incrementy + 1)] facing Default building facing degrees
              • Unit - Order (Last created unit) to Attack-Move To (Center of target <gen>)
              • Unit - Create 1 Unit_Type_Var_2[lvlnum] for Player 11 (Dark Green) at loc[(incrementy + 1)] facing Default building facing degrees
              • Unit - Order (Last created unit) to Attack-Move To (Center of target <gen>)
              • Set incrementx = (incrementx + 1)
          • Wait 0.75 seconds
 
Level 8
Joined
Dec 12, 2010
Messages
280
The action below in round timer expire trigger is restarting the timer as soon as it expires. The wait action doesn't seem to be working.
  • Countdown Timer - Start roundwindow as a One-shot timer that will expire in 20.00 seconds
Remove the actions below from the trigger and make another trigger to restart timer with the event > A unit dies and condition > units in playable map area owned by player 11 equal to 0. Put the actions below on this new trigger.
  • Game - Display to (All players) the text: Countdown Started f...
  • Countdown Timer - Start roundwindow as a One-shot timer that will expire in 20.00 seconds
  • Set RoundWindow_Var = (Last started timer)
  • Countdown Timer - Create a timer window for (Last started timer) with title (Enemy Wave + ((String(lvlnum)) + in: ))
  • Player Group - Pick every player in (All players) and do (Countdown Timer - Show (Last created timer window) for (Picked player))
You must also add the action > run spawn trigger ignoring conditions.
 
Status
Not open for further replies.
Top