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

[Trigger] Help with TD waves

Status
Not open for further replies.
Level 4
Joined
Jul 5, 2012
Messages
33
Hello,

I need help doing a drastic overhaul of the way creeps are spawned in my TD but have virtually no idea how to... So I would appreciate any help in doing so, or if someone is available to help me through Discord.

Currently my map has a leaderboard which displays the time until the next wave and which creeps are spawned, with an interval of 75 seconds between each wave.

I want to make it so that instead of having a timer, the wave will end once all players in the game have killed their creeps. Once the wave ends, I want to give players a "building timer" of 30 seconds to prepare for the next wave - This means they shouldn't be able to build any towers during the actual wave.

If anyone at all is able to help me, I would be forever grateful <3
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,578
There's many ways of going about this, but for the sake of keeping it simple I'll show you the easiest way that I know. It can be achieved with only 5 variables, an Integer to keep track of the current wave that the players are on, an Integer to keep track of the number of living creeps, a Trigger array to keep track of each Wave spawning trigger, a Timer that handles the delay before the next wave starts, and a Boolean to determine whether or not a Wave is in progress (used in this case for disabling building).

  • setup waves
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet WaveTriggers[1] = wave 1 <gen>
      • Set VariableSet WaveTriggers[2] = wave 2 <gen>
      • Set VariableSet WaveTriggers[3] = wave 3 <gen>
  • start wave 1
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Countdown Timer - Start NextWaveTimer as a One-shot timer that will expire in 0.00 seconds
  • wave timer
    • Events
      • Time - NextWaveTimer expires
    • Conditions
    • Actions
      • Set VariableSet CurrentWave = (CurrentWave + 1)
      • Trigger - Run WaveTriggers[CurrentWave] (ignoring conditions)
      • Trigger - Run toggle building prevention <gen> (ignoring conditions)
  • wave 1
    • Events
    • Conditions
    • Actions
      • Set VariableSet CreepCount = (CreepCount + 20)
      • Unit - Create 20 Footman for Neutral Hostile at (Center of (Playable map area)) facing Default building facing degrees
  • wave 2
    • Events
    • Conditions
    • Actions
      • Set VariableSet CreepCount = (CreepCount + 20)
      • Unit - Create 20 Rifleman for Neutral Hostile at (Center of (Playable map area)) facing Default building facing degrees
  • wave 3
    • Events
    • Conditions
    • Actions
      • Set VariableSet CreepCount = (CreepCount + 20)
      • Unit - Create 20 Knight for Neutral Hostile at (Center of (Playable map area)) facing Default building facing degrees
  • wave dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Set VariableSet CreepCount = (CreepCount - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CreepCount Equal to 0
        • Then - Actions
          • Countdown Timer - Start NextWaveTimer as a One-shot timer that will expire in 30.00 seconds
          • Trigger - Run toggle building prevention <gen> (ignoring conditions)
        • Else - Actions
  • toggle building prevention
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DisableBuilding Equal to False
        • Then - Actions
          • Set VariableSet DisableBuilding = True
        • Else - Actions
          • Set VariableSet DisableBuilding = False
  • prevent building
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • DisableBuilding Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is A peon-type unit) Equal to True
          • (Issued order) Not equal to (Order(move))
          • (Issued order) Not equal to (Order(patrol))
          • (Issued order) Not equal to (Order(smart))
        • Then - Actions
          • Set VariableSet TempPoint = ((Position of (Triggering unit)) offset by (0.01, 0.00))
          • Unit - Order (Triggering unit) to Move To TempPoint
          • Custom script: call RemoveLocation (udg_TempPoint)
        • Else - Actions

For disabling building it seems as though you can't hide/disable the actual build ability, but you can interrupt the unit's order to build. Just remember that if your Builder has an ability (Blink for example) that targets a point, you'll want to add that Order to the list of (Issued orders). This way the trigger knows to not cancel that order.


I attached two maps, these triggers belong to TD wave example 1.
If you want to see a more advanced version, check out Tower Defense Design 1.
 

Attachments

  • Tower Defense Design 1.w3m
    43.4 KB · Views: 18
  • TD wave example 1.w3m
    19.2 KB · Views: 20
Last edited:
Wouldn't the easiest way to stop building would be creating a dummy unit called "Cannot build during wave" and everytime it's building time creating one/changing ownership of one to every player and then during waves kill them or change ownership to Neutral passive or something.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,578
Do you mean as Requirements for each building? That would work as well, but you can use an Upgrade Requirement instead of Unit Requirement so you don't have to deal with the Dummy unit stuff.

@Zeus1516 if you want the requirement setup you can delete the "prevent building" trigger and do something like this instead:
  • setup users
    • Events
      • Time - Elapsed game time is 0.50 seconds
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) slot status) Equal to Is playing
              • ((Picked player) controller) Equal to User
            • Then - Actions
              • Player Group - Add (Picked player) to Tower_Users
            • Else - Actions
Then adjust the "toggle building prevention" trigger to look like this:
  • toggle building prevention
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DisableBuilding Equal to False
        • Then - Actions
          • Set VariableSet DisableBuilding = True
          • Player Group - Pick every player in Tower_Users and do (Actions)
            • Loop - Actions
              • Player - Set the current research level of COMPLETE THE WAVE to 1 for (Picked player)
        • Else - Actions
          • Set VariableSet DisableBuilding = False
          • Player Group - Pick every player in Tower_Users and do (Actions)
            • Loop - Actions
              • Player - Set the current research level of COMPLETE THE WAVE to 0 for (Picked player)
COMPLETE THE WAVE is an Upgrade that each Building has as a Requirement.
 
Last edited:
Status
Not open for further replies.
Top