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

Help with Tower Defense

Status
Not open for further replies.
Level 6
Joined
Aug 5, 2017
Messages
251
I made my TD spawn creeps, but they spawn simultaneously. Is there a way to make them spawn one by one? That would be good really.
Also, they seem to interact each other. Is there also a way to remove unit to unit interaction? Does this affect anything else, like projectiles hitting them?
 
Level 14
Joined
Feb 7, 2020
Messages
387
You can't really disable unit collision without side effects.

Simplified overview of what you should try:
To spawn units over time, create a periodic timer that makes 1 unit every 1 or 2 seconds, order them to move about the maze, then increment an integer variable by 1. When that variable reaches your desired creep count, turn off the trigger. You turn the periodic timer trigger on and off based on when units should spawn.
 
Level 3
Joined
Apr 7, 2020
Messages
32
The default collision size of units is a bit too large for a lot of custom games in my opinion. Anything with a collision size 30~32 is pretty large. I like to use 16 or 12, the collision size of the smaller units to create a less clunky environment in my games. This can be found below the Movement speed stuff in the unit editor tab. But you shouldn't remove their collision entirely, through the trigger, because it will allow them to walk over most blocked pathing.

Along with that you can make cascading regions for spawn points of each unit so they do not clump up too much, and just spawn 1 or 2 of each for each separate region until you have the desired amount in the "wave".
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,538
You can use the Wind Walk ability for a "Phasing" effect. This removes unit collision but retains collision with terrain/doodads/structures. Just make sure it's Fade Time is some absurdly long duration so the unit doesn't become invisible.

And I attached a map with an example Spawn System using this method along with a Timer system to spawn the units in intervals.

  • Spawn Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- The owner of the Spawned Units --------
      • Set VariableSet Spawn_Player = Player 2 (Blue)
      • -------- --------
      • -------- Setup Points (Where units start and where they end) --------
      • Set VariableSet Spawn_StartPoint[1] = (Center of Spawn Start 1 <gen>)
      • Set VariableSet Spawn_StartPoint[2] = (Center of Spawn Start 2 <gen>)
      • Set VariableSet Spawn_EndPoint[1] = (Center of Spawn End 1 <gen>)
      • Set VariableSet Spawn_EndPoint[2] = (Center of Spawn End 2 <gen>)
      • -------- --------
      • -------- WAVE 1 --------
      • -------- Setup Spawn Waves (Which unit spawns, how many spawn, and it's displayed name) --------
      • Set VariableSet Spawn_UnitType[1] = Peasant
      • Set VariableSet Spawn_UnitLimit[1] = 12
      • Set VariableSet Spawn_UnitName[1] = Peasants
      • -------- --------
      • -------- WAVE 2 --------
      • Set VariableSet Spawn_UnitType[2] = Footman
      • Set VariableSet Spawn_UnitLimit[2] = 10
      • Set VariableSet Spawn_UnitName[2] = Footmen
      • -------- --------
      • -------- WAVE 3 --------
      • Set VariableSet Spawn_UnitType[3] = Rifleman
      • Set VariableSet Spawn_UnitLimit[3] = 8
      • Set VariableSet Spawn_UnitName[3] = Riflemen
      • -------- --------
      • -------- Once all of the Variables are configured run the first Wave and start a repeating Timer that will start a new Wave once every X seconds --------
      • Trigger - Run Spawn Start Wave <gen> (ignoring conditions)
      • Countdown Timer - Start Spawn_WaveTimer as a Repeating timer that will expire in 12.00 seconds
  • Spawn Start Wave
    • Events
      • Time - Spawn_WaveTimer expires
    • Conditions
    • Actions
      • -------- Increase the Wave Count --------
      • Set VariableSet Spawn_WaveCount = (Spawn_WaveCount + 1)
      • -------- --------
      • -------- Display the Wave Information --------
      • Game - Display to (All players) for 8.00 seconds the text: (|cff00ff00WAVE|r: + (String(Spawn_WaveCount)))
      • Game - Display to (All players) for 8.00 seconds the text: (|cff00ff00Spawning|r |cff8080ff + ((String(Spawn_UnitLimit[Spawn_WaveCount])) + (|r + Spawn_UnitName[Spawn_WaveCount])))
      • -------- --------
      • -------- Start the Wave Create Timer (This timer spawns a unit once every X seconds until it reaches the Unit Limit) --------
      • Countdown Timer - Start Spawn_CreateTimer as a Repeating timer that will expire in 0.50 seconds
  • Spawn Create Units
    • Events
      • Time - Spawn_CreateTimer expires
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Spawn_TotalSpawned Less than Spawn_UnitLimit[Spawn_WaveCount]
        • Then - Actions
          • -------- Increase the Total Spawned units by 1. Once this number reaches the current Wave's Spawn Limit it will stop spawning --------
          • Set VariableSet Spawn_TotalSpawned = (Spawn_TotalSpawned + 1)
          • -------- --------
          • -------- Create the Spawn Units, Order them to Wind Walk (Turn off unit-collision), and order them to move to the end point --------
          • For each (Integer A) from 1 to 2, do (Actions)
            • Loop - Actions
              • Unit - Create 1 Spawn_UnitType[Spawn_WaveCount] for Spawn_Player at Spawn_StartPoint[(Integer A)] facing Default building facing degrees
              • Unit - Add Phasing to (Last created unit)
              • Unit - Order (Last created unit) to Orc Blademaster - Wind Walk.
              • Unit - Order (Last created unit) to Move To Spawn_EndPoint[(Integer A)]
        • Else - Actions
          • -------- Reset the total number of units spawned (This way the next wave will start at 0) --------
          • Set VariableSet Spawn_TotalSpawned = 0
          • -------- --------
          • -------- Pause this timer so it stops running temporarily --------
          • Countdown Timer - Pause Spawn_CreateTimer
 

Attachments

  • Spawn System 1.w3m
    20.5 KB · Views: 37

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,538
The triggers do work and are compatible with your version.

You just can't open my map since it was made using a version that you don't have.

So if you wish to use the triggers that I posted then you'll have to create them yourself (normally you could just copy and paste them from my map).
 
Last edited:
Status
Not open for further replies.
Top