• 🏆 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] Wave Spawning

Status
Not open for further replies.
Level 7
Joined
Jul 9, 2012
Messages
158
Hey hive members.
I am creating a tower defense where enemy units spawn in levels. But in somehow it only works at level 1.
Here is the triggers I have made:
  • Initial Start
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Trigger - Run Wave Creator <gen> (ignoring conditions)
  • Wave Creator
    • Events
      • Unit - A unit owned by Player 11 (Dark Green) Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (EnemyUnitGroup is empty) Equal to True
        • Then - Actions
          • Set EnemyWaveInteger = (EnemyWaveInteger + 1)
          • Countdown Timer - Start WaveCountDownTimer[EnemyWaveInteger] as a One-shot timer that will expire in 60.00 seconds
          • Set WaveCountDownTimer[EnemyWaveInteger] = (Last started timer)
          • Countdown Timer - Create a timer window for WaveCountDownTimer[EnemyWaveInteger] with title Next Wave:
          • Set CountDownTimerWindow = (Last created timer window)
          • Countdown Timer - Show CountDownTimerWindow
        • Else - Actions
          • Do nothing
  • First Wave
    • Events
      • Time - WaveCountDownTimer[1] expires
    • Conditions
    • Actions
      • Set WavesAttackingPoint = (Position of The Holy Shrine 0004 <gen>)
      • Countdown Timer - Destroy CountDownTimerWindow
      • Set TopWing1Location = (Center of TopWing 1 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at TopWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at TopWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Handler for Player 11 (Dark Green) at TopWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Set RightWing1Location = (Center of RightWing 1 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at RightWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Set RightWing2Location = (Center of RightWing 2 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at RightWing2Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Set RightWing3Location = (Center of RightWing 3 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at RightWing3Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Set RightWing4Location = (Center of RightWing 4 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at RightWing4Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Set BottomWing1Location = (Center of BottomWing 1 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at BottomWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Set BottomWing2Location = (Center of BottumWing 2 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at BottomWing2Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Set BottomWing3Location = (Center of BottomWing 3 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at BottomWing3Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Set BottomWing4Location = (Center of BottomWing 4 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at BottomWing4Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Set BottomWing5Location = (Center of BottomWing 5 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at BottomWing5Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Set BottomWing6Location = (Center of BottomWing 6 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at BottomWing6Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Set LeftWing1Location = (Center of LeftWing 1 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at LeftWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at LeftWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at LeftWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at LeftWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit Group - Pick every unit in EnemyUnitGroup and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To WavesAttackingPoint
      • Custom script: call RemoveLocation(udg_TopWing1Location)
      • Custom script: call RemoveLocation(udg_RightWing1Location)
      • Custom script: call RemoveLocation(udg_RightWing2Location)
      • Custom script: call RemoveLocation(udg_RightWing3Location)
      • Custom script: call RemoveLocation(udg_RightWing4Location)
      • Custom script: call RemoveLocation(udg_BottomWing1Location)
      • Custom script: call RemoveLocation(udg_BottomWing2Location)
      • Custom script: call RemoveLocation(udg_BottomWing3Location)
      • Custom script: call RemoveLocation(udg_BottomWing4Location)
      • Custom script: call RemoveLocation(udg_BottomWing5Location)
      • Custom script: call RemoveLocation(udg_BottomWing6Location)
      • Custom script: call RemoveLocation(udg_LeftWing1Location)
      • Custom script: call RemoveLocation(udg_WavesAttackingPoint)
Wave 2 is almost just a copy of the first wave, but you get it anyway :)

  • Second Wave
    • Events
      • Time - WaveCountDownTimer[2] expires
    • Conditions
    • Actions
      • Set WavesAttackingPoint = (Position of The Holy Shrine 0004 <gen>)
      • Countdown Timer - Destroy CountDownTimerWindow
      • Set TopWing1Location = (Center of TopWing 1 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at TopWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at TopWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at TopWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at TopWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Handler for Player 11 (Dark Green) at TopWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at TopWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Set RightWing1Location = (Center of RightWing 1 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at RightWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at RightWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Set RightWing2Location = (Center of RightWing 2 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at RightWing2Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at RightWing2Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Set RightWing3Location = (Center of RightWing 3 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at RightWing3Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at RightWing3Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Set RightWing4Location = (Center of RightWing 4 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at RightWing4Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at RightWing4Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Set BottomWing1Location = (Center of BottomWing 1 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at BottomWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at BottomWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Set BottomWing2Location = (Center of BottumWing 2 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at BottomWing2Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at BottomWing2Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Set BottomWing3Location = (Center of BottomWing 3 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at BottomWing3Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at BottomWing3Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Set BottomWing4Location = (Center of BottomWing 4 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at BottomWing4Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at BottomWing4Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Set BottomWing5Location = (Center of BottomWing 5 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at BottomWing5Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at BottomWing5Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Set BottomWing6Location = (Center of BottomWing 6 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at BottomWing6Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at BottomWing6Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Set LeftWing1Location = (Center of LeftWing 1 <gen>)
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at LeftWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at LeftWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at LeftWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at LeftWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at LeftWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at LeftWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at LeftWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit - Create 1 Fel Hound for Player 11 (Dark Green) at LeftWing1Location facing Default building facing degrees
      • Unit Group - Add (Last created unit) to EnemyUnitGroup
      • Unit Group - Pick every unit in EnemyUnitGroup and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To WavesAttackingPoint
      • Custom script: call RemoveLocation(udg_TopWing1Location)
      • Custom script: call RemoveLocation(udg_RightWing1Location)
      • Custom script: call RemoveLocation(udg_RightWing2Location)
      • Custom script: call RemoveLocation(udg_RightWing3Location)
      • Custom script: call RemoveLocation(udg_RightWing4Location)
      • Custom script: call RemoveLocation(udg_BottomWing1Location)
      • Custom script: call RemoveLocation(udg_BottomWing2Location)
      • Custom script: call RemoveLocation(udg_BottomWing3Location)
      • Custom script: call RemoveLocation(udg_BottomWing4Location)
      • Custom script: call RemoveLocation(udg_BottomWing5Location)
      • Custom script: call RemoveLocation(udg_BottomWing6Location)
      • Custom script: call RemoveLocation(udg_LeftWing1Location)
      • Custom script: call RemoveLocation(udg_WavesAttackingPoint)
Btw, i'm still pretty new with "advanced" triggers. Can you help me maybe? :)
 
Last edited:
Level 6
Joined
May 15, 2009
Messages
191
Well this is just very messy. Instead of creating one unit at a time, and then adding it to the group, just make it: spawn 3 units at a time. And then another trigger for something like this:
  • Add to Group
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 11 (Dark Green)
    • Actions
      • Unit Group - Add (Triggering unit) to Group
That will make your trigger much more comfortable for the eye. Also you could just set a couple of variables at game start for each region. And then reuse those variables in the spawn trigger. Something like this:
  • Set Variables
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set EastSpawn = (Center of (EastRegion))
      • Set WestSpawn = (Center of (WestRegion))
      • Set NorthSpawn = (Center of (NorthRegion))
      • Set SouthSpawn = (Center of (SouthRegion))
      • Set WavesAttackingPoint = (Position of (Holy Shrine))
As to the trigger malfunctioning, Im not sure. But atleast these things will help make it easier on the eye. And generally more fluid.
 

nGy

nGy

Level 11
Joined
Apr 15, 2011
Messages
123
I don't really think a unit, which dies is automatically removed from your EnemyUnitGorup. You'll have to do yourself. Then it should work fine, i guess - but please do what Battlehound suggested anyway and maybe use only one timer.

Edit: Well forget what i said about the removing from unit group; just overlooked your post ._____.
Anyway, if you could attach the map to a post, it might be easier for us to fix it.
 
Last edited:
Status
Not open for further replies.
Top