• 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.

TD Spawn Trigger

Status
Not open for further replies.
Level 8
Joined
Jul 7, 2013
Messages
141
Hello Hivers, I need some help with my TD. I have a spawning trigger that really needs improvement so can someone help me make a more efficient spawning trigger that this one?

(Peasants are only a placeholder)
  • INIT Unit Types
    • Events
    • Conditions
    • Actions
      • -------- Level 1 Unit Types --------
      • Set UnitTypesLevel_1[1] = Peasant
      • Set UnitTypesLevel_1[2] = Peasant
      • Set UnitTypesLevel_1[3] = Peasant
      • Set UnitTypesLevel_1[4] = Peasant
      • Set UnitTypesLevel_1[5] = Peasant
      • Set UnitTypesLevel_1[6] = Peasant
      • Set UnitTypesLevel_1[7] = Peasant
      • Set UnitTypesLevel_1[8] = Peasant
      • Set UnitTypesLevel_1[9] = Peasant
      • Set UnitTypesLevel_1[10] = Peasant
      • -------- Level 2 Unit Types --------
      • Set UnitTypesLevel_2[1] = Peasant
      • Set UnitTypesLevel_2[2] = Peasant
      • Set UnitTypesLevel_2[3] = Peasant
      • Set UnitTypesLevel_2[4] = Peasant
      • Set UnitTypesLevel_2[5] = Peasant
      • Set UnitTypesLevel_2[6] = Peasant
      • Set UnitTypesLevel_2[7] = Peasant
      • Set UnitTypesLevel_2[8] = Peasant
      • Set UnitTypesLevel_2[9] = Peasant
      • Set UnitTypesLevel_2[10] = Peasant
      • Set UnitTypesLevel_2[11] = Peasant
      • Set UnitTypesLevel_2[12] = Peasant
      • Set UnitTypesLevel_2[13] = Peasant
      • Set UnitTypesLevel_2[14] = Peasant
      • Set UnitTypesLevel_2[15] = Peasant
      • -------- Level 3 Unit Types --------
      • Set UnitTypesLevel_3[1] = Peasant
      • Set UnitTypesLevel_3[2] = Peasant
      • Set UnitTypesLevel_3[3] = Peasant
      • Set UnitTypesLevel_3[4] = Peasant
      • Set UnitTypesLevel_3[5] = Peasant
      • Set UnitTypesLevel_3[6] = Peasant
      • Set UnitTypesLevel_3[7] = Peasant
      • Set UnitTypesLevel_3[8] = Peasant
      • Set UnitTypesLevel_3[9] = Peasant
      • Set UnitTypesLevel_3[10] = Peasant
      • Set UnitTypesLevel_3[11] = Peasant
      • Set UnitTypesLevel_3[12] = Peasant
      • Set UnitTypesLevel_3[13] = Peasant
      • Set UnitTypesLevel_3[14] = Peasant
      • Set UnitTypesLevel_3[15] = Peasant
      • -------- Level 4 Unit Types --------
      • Set UnitTypesLevel_4[1] = Peasant
      • Set UnitTypesLevel_4[2] = Peasant
      • Set UnitTypesLevel_4[3] = Peasant
      • Set UnitTypesLevel_4[4] = Peasant
      • Set UnitTypesLevel_4[5] = Peasant
      • -------- Level 5 Unit Types --------
      • Set UnitTypesLevel_5[1] = Peasant
      • Set UnitTypesLevel_5[2] = Peasant
      • Set UnitTypesLevel_5[3] = Peasant
      • Set UnitTypesLevel_5[4] = Peasant
      • Set UnitTypesLevel_5[5] = Peasant
  • Level 1 Group 1
    • Events
      • Time - WaveTimer expires
    • Conditions
    • Actions
      • Countdown Timer - Destroy WaveTimerWindow
      • Set TempPoint = (Center of Start Region Level 1 <gen>)
      • Unit - Create 1 UnitTypesLevel_1[1] for Player 12 (Brown) at TempPoint facing Default building facing degrees
      • Set NumberOfEnemies = (NumberOfEnemies + 1)
      • Wait 0.50 seconds
      • Unit - Create 1 UnitTypesLevel_1[1] for Player 12 (Brown) at TempPoint facing Default building facing degrees
      • Set NumberOfEnemies = (NumberOfEnemies + 1)
      • Wait 0.50 seconds
      • Unit - Create 1 UnitTypesLevel_1[1] for Player 12 (Brown) at TempPoint facing Default building facing degrees
      • Set NumberOfEnemies = (NumberOfEnemies + 1)
      • Wait 0.50 seconds
      • Unit - Create 1 UnitTypesLevel_1[1] for Player 12 (Brown) at TempPoint facing Default building facing degrees
      • Set NumberOfEnemies = (NumberOfEnemies + 1)
      • Wait 0.50 seconds
      • Unit - Create 1 UnitTypesLevel_1[1] for Player 12 (Brown) at TempPoint facing Default building facing degrees
      • Set NumberOfEnemies = (NumberOfEnemies + 1)
      • Wait 0.50 seconds
      • Unit - Create 1 UnitTypesLevel_1[1] for Player 12 (Brown) at TempPoint facing Default building facing degrees
      • Set NumberOfEnemies = (NumberOfEnemies + 1)
      • Wait 0.50 seconds
      • Unit - Create 1 UnitTypesLevel_1[1] for Player 12 (Brown) at TempPoint facing Default building facing degrees
      • Set NumberOfEnemies = (NumberOfEnemies + 1)
      • Wait 0.50 seconds
      • Unit - Create 1 UnitTypesLevel_1[1] for Player 12 (Brown) at TempPoint facing Default building facing degrees
      • Set NumberOfEnemies = (NumberOfEnemies + 1)
      • Wait 0.50 seconds
      • Unit - Create 1 UnitTypesLevel_1[1] for Player 12 (Brown) at TempPoint facing Default building facing degrees
      • Set NumberOfEnemies = (NumberOfEnemies + 1)
      • Wait 0.50 seconds
      • Unit - Create 1 UnitTypesLevel_1[1] for Player 12 (Brown) at TempPoint facing Default building facing degrees
      • Set NumberOfEnemies = (NumberOfEnemies + 1)
      • Wait 0.50 seconds
      • Unit - Create 1 UnitTypesLevel_1[1] for Player 12 (Brown) at TempPoint facing Default building facing degrees
      • Set NumberOfEnemies = (NumberOfEnemies + 1)
      • Wait 0.50 seconds
      • Unit - Create 1 UnitTypesLevel_1[1] for Player 12 (Brown) at TempPoint facing Default building facing degrees
      • Set NumberOfEnemies = (NumberOfEnemies + 1)
      • Wait 0.50 seconds
      • Unit - Create 1 UnitTypesLevel_1[1] for Player 12 (Brown) at TempPoint facing Default building facing degrees
      • Set NumberOfEnemies = (NumberOfEnemies + 1)
      • Wait 0.50 seconds
      • Unit - Create 1 UnitTypesLevel_1[1] for Player 12 (Brown) at TempPoint facing Default building facing degrees
      • Set NumberOfEnemies = (NumberOfEnemies + 1)
      • Wait 0.50 seconds
      • Unit - Create 1 UnitTypesLevel_1[1] for Player 12 (Brown) at TempPoint facing Default building facing degrees
      • Set NumberOfEnemies = (NumberOfEnemies + 1)
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call DestroyTrigger(GetTriggeringTrigger())
The spawning area is really small so I have to spawn these units one by one. Any help would be much appreciated.
 
Level 8
Joined
Jul 7, 2013
Messages
141
I was hoping for a trigger that requires less things to change for each wave? I still have to make 20+ of these and I don't want to spend all day long changing variables.

I use that variable to check how many monsters are in the map, how many are remaining and I also display that integer in a multiboard.

@Maker
I thought it's bad to have waits in loops.
 
You could use a loop

For each custom integer spawn_integer from 1 to x
--loop
----spawn 1 unit
----set count = count + 1
----wait 0.5 seconds

Dont use wait in the loop.
Just create units at your point, increase your NumberOfEnemies + 1, and remove memory leaks
Then make integer comparisson if your NumberOfEnemies is your limit:
-no? wait 05 seconds + run this trigger again
-yes? Custom script: call DestroyTrigger(GetTriggeringTrigger())
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Well.. a 0.25 global periodic timer and some globals for creep choose (which can and should all be in the same Unit-Type array) is good enough for this.
 
Status
Not open for further replies.
Top