• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

How do i make waves for td in gui

Status
Not open for further replies.
  • Events
  • Time - Every 50 seconds of the game
  • Conditions
  • Actions
  • Unit - Create 3 Ghoul for Player 7 (Green) at (Center of Scourage middle spawn <gen>) facing Default building facing degrees
  • Wait 0.01 seconds
  • Unit - Create 1 Necromancer for Player 7 (Green) at (Center of Scourage middle spawn <gen>) facing Default building facing degrees
  • Wait 0.01 seconds
  • Unit Group - Pick every unit in (Units in Scourage middle spawn <gen>) and do (Unit - Order (Picked unit) to Attack-Move To (Center of Middle of map <gen>))
Then you can just change the every 50 second to time elapsed, and make several of these triggers with different monsters
 
Each wave can come after each amount of time, for example 1 wave comes after 50 seconds, the next wave comes after 80 seconds.
Like this: Time elapsed - 50 seconds
 
This is how I did it in my TD (well, mostly)

First you need to make 4 variables:
TempLocation - Point variable
Amount - Integer array with a length of however many levels you're going to have
UnitType - Unit array with a length of however many levels you're going to have
CurrentLevel - integer with starting value of 1 (this counts your levels for you)

edit:
NumOfUnits - integer variable starting at 0

  • Spawn Units for Player 1
    • Events
    • Conditions
      • Player Slot Status of Player 1 equal to Is Playing
    • Actions
      • Set - TempLocation to center of Player1sSpawningRegion
      • Unit - Create (unit type of (Amount[CurrentLevel])) units of type (unit type of (UnitType[CurrentLevel])) for (Neutral Hostile) at (TempLocation) facing default building facing degrees
      • Set NumOfUnits to (Arithmetic(NumOfUnits + Amount[CurrentLevel]))
      • Custom Script(call RemoveLocation(udg_TempLocation))
      • Custom Script(set bj_wantDestroyGroup = true)
      • Set - TempLocation to center of (First checkpoint in player 1's path)
      • Unit Group - Pick every unit in (Player1sSpawningRegion) and do if ((owner of (Picked Unit) equal to (Neutral Hostile)) then (order (Picked Unit) to (Move) to (TempLocation)) else (do Nothing))
      • Custom Script - (call RemoveLocation(udg_TempLocation))
Now all you have to do is set what each wave is, and how many of them spawn...

  • Map Initialization
    • Events
      • Map Initialization
    • Conditions
    • Actions
      • Comment - set number of units per level
      • Set Amount[1] to # of units to spawn in wave 1
      • Set Amount[2] to # of units to spawn in wave 2
      • Set Amount[3] to # of units to spawn in wave 3
      • ...
      • Comment - set unit types for each level
      • Set UnitType[1] to (unit that spawns at level 1)
      • Set UnitType[2] to (unit that spawns at level 2)
      • Set UnitType[3] to (unit that spawns at level 3)
      • ...
  • Events
  • Conditions
    • currentLevel is less than or equal to (total number of waves)
  • Actions
    • Trigger - Run (Spawn units for Player 1) checking conditions
    • Trigger - Run (Spawn units for Player 2) checking conditions
    • ...
Copy the first trigger for each player and change the regions and the player number for each copy
Hope this helps!

EDIT: for the "30 seconds after the wave dies" thing, add this:
  • Events
    • Unit dies
  • Conditions
    • Owner of (Triggering Unit) equal to (Neutral Hostile)
  • Actions
    • Set - NumOfUnits to (Arithmetic(NumOfUnits - 1))
    • if then else - multiple
      • if
        • NumOfUnits equal to 0
      • than
        • wait 30 seconds
        • Trigger - Run (trigger above this one that has no name) checking conditions
      • else
I wouldn't wait 30 seconds after the wave dies though, since that adds a lot of down time where people just get impatient, wanting to kill stuff.
 
Last edited:
This is how I did it in my TD (well, mostly)

First you need to make 4 variables:
TempLocation - Point variable
Amount - Integer array with a length of however many levels you're going to have
UnitType - Unit array with a length of however many levels you're going to have
CurrentLevel - integer with starting value of 1 (this counts your levels for you)

edit:
NumOfUnits - integer variable starting at 0

  • Spawn Units for Player 1
    • Events
    • Conditions
      • Player Slot Status of Player 1 equal to Is Playing
    • Actions
      • Set - TempLocation to center of Player1sSpawningRegion
      • Unit - Create (unit type of (Amount[CurrentLevel])) units of type (unit type of (UnitType[CurrentLevel])) for (Neutral Hostile) at (TempLocation) facing default building facing degrees
      • Set NumOfUnits to (Arithmetic(NumOfUnits + Amount[CurrentLevel]))
      • Custom Script(call RemoveLocation(udg_TempLocation))
      • Custom Script(set bj_wantDestroyGroup = true)
      • Set - TempLocation to center of (First checkpoint in player 1's path)
      • Unit Group - Pick every unit in (Player1sSpawningRegion) and do if ((owner of (Picked Unit) equal to (Neutral Hostile)) then (order (Picked Unit) to (Move) to (TempLocation)) else (do Nothing))
      • Custom Script - (call RemoveLocation(udg_TempLocation))
Now all you have to do is set what each wave is, and how many of them spawn...

  • Map Initialization
    • Events
      • Map Initialization
    • Conditions
    • Actions
      • Comment - set number of units per level
      • Set Amount[1] to # of units to spawn in wave 1
      • Set Amount[2] to # of units to spawn in wave 2
      • Set Amount[3] to # of units to spawn in wave 3
      • ...
      • Comment - set unit types for each level
      • Set UnitType[1] to (unit that spawns at level 1)
      • Set UnitType[2] to (unit that spawns at level 2)
      • Set UnitType[3] to (unit that spawns at level 3)
      • ...
  • Events
    • Every ... seconds of the game // get rid of this if you add the next trigger
  • Conditions
  • Actions
    • Trigger - Run (Spawn units for Player 1) checking conditions
    • Trigger - Run (Spawn units for Player 2) checking conditions
    • ...
Copy the first trigger for each player and change the regions and the player number for each copy
Hope this helps!

EDIT: for the "30 seconds after the wave dies" thing, add this:
  • Events
    • Unit dies
  • Conditions
    • Owner of (Triggering Unit) equal to (Neutral Hostile)
  • Actions
    • Set - NumOfUnits to (Arithmetic(NumOfUnits - 1))
    • if then else - multiple
      • if
        • NumOfUnits equal to 0
      • than
        • wait 30 seconds
        • Trigger - Run (trigger above this one that has no name)
      • else
I wouldn't wait 30 seconds after the wave dies though, since that adds a lot of down time where people just get impatient, wanting to kill stuff.

what if u have more than one player?
 
the "set UnitType[#] to (unit)" thing in the second trigger declares what each wave is going to be. so, for example, "set UnitType[1] to Footman" would make footmen spawn on wave 1. "set UnitType[4] to Grunt" sets the 4th wave to Grunts.
In the initialization trigger, you just need to have a "set UnitType..." line for each wave.

And remember, "UnitType" is a variable you declare in the variable thing in the trigger editor.
 
Status
Not open for further replies.
Back
Top