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

TD: Ralle's Basics: Chnaging into periodic spawning

Status
Not open for further replies.

Ardenian

A

Ardenian

Hello, could someone help me with this issue, please ?

  • NextLevel Timer
  • Events
  • Time - Timer expires
  • Conditions
  • Actions
  • Countdown Timer - Destroy (Last created timer window)
  • Unit - Create Levels_Units_Count[Levels_Current] Levels_Units[Levels_Current] for Player 10 (Lightblue) at (Center of Red <gen>) facing Default building facing degrees
  • Game - Display to (All players) the text: The level has begun!
This is a TD trigger based on the tutorial from Ralle.
I would like to change it into a periodic spawn, that means the creeps spawn one by one instead of all at one time.

That is what I have up to now, but it refuses to work:
  • NextLevel Timer Custom
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 1 Levels_Units[Levels_Amount] for Player 10 (Lightblue) at (Center of TD Entrance <gen>) facing 45 degrees
      • Set Unit_Count = (Unit_Count + 1)
      • If (Unit_Count Equal Levels_Amount) then do (Trigger - Turn off (This trigger)) else do (Do nothing)
This trigger is initially off, but is turned on after the expiration timer from the tutorial runs out.

I am glad if you could help me.
 
Level 21
Joined
Nov 4, 2013
Messages
2,017
I remember that in the past I created two TDs (sadly I lost them when my computer stopped working) and I did them like that:

  • Events
    • Time - Every 1.00 seconds of game time
  • Conditions
  • Actions
    • Unit - Create 1 Levels_Units[Levels_Amount] for Player 10 (Light Blue) at (Center of TD Entrance <gen>) facing 45 degrees
    • Wait (Number of units you want to spawn - 0.5)
    • Trigger - Turn off (This trigger)
It is based on the fact that after 19 spawns, the trigger turns off and runs for the last time, spawning the 20th creep. Then, by means of another trigger, you turn it on when you want to run the next wave.
 

Ardenian

A

Ardenian

It is based on the fact that after 19 spawns, the trigger turns off and runs for the last time, spawning the 20th creep. Then, by means of another trigger, you turn it on when you want to run the next wave.

Thank you, now it is working. But, there is a new issue now:

  • NextLevel Timer Custom
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 1 Levels_Units[Levels_Current] for Player 10 (Lightblue) at (Center of TD Entrance <gen>) facing 45 degrees
      • Wait ((Real(Levels_Units_Count[Unit_Count])) - 1.00) seconds
      • Trigger - Turn off (This trigger)
I need to check how many creeps are spawned each waves, as this amount is changing. Therefore I created a variable called 'Unit_Count'.
But how do I set the variable to the value of a specific index ?

  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- This is where we set which unit spawns on each level --------
      • Set Levels_Units[1] = Worker
      • Set Levels_Units[2] = Footman
      • Set Levels_Units[3] = Knight
      • -------- This is the amount of units to spawn on each level --------
      • Set Levels_Units_Count[1] = 10
      • Set Levels_Units_Count[2] = 10
      • Set Levels_Units_Count[3] = 40
I need to set the variable Unit_Count to the current Levels_Units_Count. How can I do that ?
 

Ardenian

A

Ardenian

Doesn't setting the variable Unit_Count = Levels_Units_Count work?
When a unit dies, you simply substract one from Unit_Count.
If that's not what you want, then I need some further explanation on what is needed.

No, Level_Units_Count has an index that has to be specified.
I solved it with setting Unit_Count Equal to Levels_Current.

But, for some reason only half of the amount spawn...

EDIT: I solved it somehow, I don't know how, but it is solved, thank you.
I set periodic timer to 1 and the value to -0,5, as in your example.
it doesn't work for an periodic timer of 2 secs and a value of -1 ?
 
Level 21
Joined
Nov 4, 2013
Messages
2,017
No, Level_Units_Count has an index that has to be specified.
I solved it with setting Unit_Count Equal to Levels_Current.

But, for some reason only half of the amount spawn...

EDIT: I solved it somehow, I don't know how, but it is solved, thank you.
I set periodic timer to 1 and the value to -0,5, as in your example.
it doesn't work for an periodic timer of 2 secs and a value of -1 ?

For every 2 seconds, you have to multiply by 2 the number of units spawned then you substract 0.50. For every 3 seconds, you multiply by 3 etc...
 

Ardenian

A

Ardenian

For every 2 seconds, you have to multiply by 2 the number of units spawned then you substract 0.50. For every 3 seconds, you multiply by 3 etc...

Alright, thank you!
math is not my strength, triggering neither
 
Status
Not open for further replies.
Top