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

Tower Defense spawning

Status
Not open for further replies.
Level 4
Joined
Jan 6, 2009
Messages
100
Currently, I'm working on a simple TD.

I had an idea of how to handle wave spawning - A minute into the game, the first wave spawns.
Only after the last creep of the previous wave falls does the second wave start, and only after a 10 second setup time.

So, my question is: is that possible?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Make all wave triggers but wave 1 to be initially off.

Create wave 1, and in that trigger turn on trigger 2. Use the event Player - Properties - Food becomes equal to 0 in all waves except wave 1. Now wave 1 starts to attack and when they're all dead, trigger 2 fires. Use a 10 second wait in trigger 2 then create units and turn on trigger 3 etc.

Or instead of using wait, you can use expiration timer.
 
Level 12
Joined
Apr 15, 2008
Messages
1,063
That's not a very good solution, you should use two triggers for any number of waves. One will be the spawning trigger, which fires when a timer expires, and the other one will start the timer when all units are dead. Just save all of unit-types to array and then spawn units depending on the round. Like this:
  • Spawn trigger
  • Events
    • Time - WaveTimer expires
  • Actions
    • Set Round = (Round + 1)
    • Unit - Create 10 WaveUnits[Round] at spawnLocation1
    • Unit - Create 16 WaveUnits[Round] at spawnLocation2
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,197
Sounds easy to do.
Just break it down into what you said.
1 timer which spawns the units after it expires (starts at 60, then is 10 every round after the first.
A function the timer above runs which spawns enemies at all spawn points of type for that round (the integer for type is fetched from an array with round number as index).
A counter which holds the number of live units at any time (you add how many units you spawn to this counter).
A trigger that on the death of a spawn reduces the counter by 1, if counte is then 0 you restart the timer with a 10 second delay.

One finished creep spawn TD system...
 
Level 4
Joined
Jan 6, 2009
Messages
100
All looks good M0RT and Dr Super Good, but I'm not quite getting what your saying.

To put another way, screens of what the triggers and variables might look like would be a great help. The one M0RT did is good, but what should WaveTimer and WaveUnits be, and what kind of variable should Round be?

Assume I'm not very smart (I am) and I've never done this before (I haven't.)
Thanks.
 
Status
Not open for further replies.
Top