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

Why does it only spawn the Unites sometimes?

Level 4
Joined
Dec 23, 2023
Messages
47
Hello, I can't figure out, why it just sometimes spawns the Units?

The Managing of Waves
  • Set VariableSet CurrentWaveUnit = (Units of type Welle 1)
  • Wait 1.00 seconds
  • Trigger - Turn on Wave Spawn <gen>
  • Wait 25.00 seconds
  • Trigger - Turn off Wave Spawn <gen>
  • Wait until ((All units of (Units owned by Player 12 (Brown).) are dead) Equal to Wahr), checking every 1.00 seconds
  • Game - Display to (All players) for 5.00 seconds the text: Nächste Welle...
The wave Spawnig itself.
  • Events
    • Time - Every 1.00 seconds of game time
  • Actions
    • Unit - Create 1 (Unit-type of (Random unit from CurrentWaveUnit)) for Player 12 (Brown) at (Center of SpawnOL <gen>) facing Default building facing degrees
    • Unit - Create 1 (Unit-type of (Random unit from CurrentWaveUnit)) for Player 12 (Brown) at (Center of SpawnOR <gen>) facing Default building facing degrees
    • Unit - Create 1 (Unit-type of (Random unit from CurrentWaveUnit)) for Player 12 (Brown) at (Center of SpawnUL <gen>) facing Default building facing degrees
    • Unit - Create 1 (Unit-type of (Random unit from CurrentWaveUnit)) for Player 12 (Brown) at (Center of SpawnUR <gen>) facing Default building facing degrees
I have a variable as type Unit Group | It is not an array
I set this with the trigger seen in pricture 1 before every wave. 1sec ater this it enabled the trigger that spawns a unit of the unit type set in the variable every second until it gets turnes of again 25 seconds later.

Sometimes this works, but sometimes it doesn't.

I think the problem could be
  • Unit - Create 1 (Unit-type of (Random unit from CurrentWaveUnit)) for Player 12 (Brown) at (Center of SpawnOL <gen>) facing Default building facing degrees
That he takes a random unit from this variable. But I can't find anything else then taking a random unit. I thought it is no prblem because it always holds only 1 Unit.
 
Last edited:
Level 4
Joined
Dec 23, 2023
Messages
47
This is my first time using variables. What exactly do I need to do then, to spawn them?
YOu maybe got a map I could check this out?

Setting them up that Index 1 2 3 and so on are the correct waves is easy, but how do I tell the game now when to send what?
 
Last edited:
Level 4
Joined
Dec 23, 2023
Messages
47
  • Set CurrentWave = 1
  • -------- --------
  • Set CurrentWave = (Current Wave + 1)
  • Unit - Create 1 WaveUnits[CurrentWave] at ....
Ok thank you already, I am getting close,now my tpycal problem... I cant find the exact thing how to setup it in your example.. i only get it to this.
  • Actions
    • Unit - Create 1 (Unit-type of (Random unit from CurrentWaveUnit[0])) for Player 12 (Brown) at (Center of SpawnOL <gen>) facing Default building facing degrees
    • Unit - Create 1 Welle 1 for Player 12 (Brown) at (Center of SpawnUL <gen>) facing Default building facing degrees
    • Unit - Create 1 Welle 1 for Player 12 (Brown) at (Center of SpawnUR <gen>) facing Default building facing degrees
    • Unit - Create 1 Welle 1 for Player 12 (Brown) at (Center of SpawnOR <gen>) facing Default building facing degrees
I only changed the first for testing reasons.

Maybe I did a mistake in the variable?
CurrentWave:
  • Type: Integer
  • Array: No

CurrentWvaeUnit
  • Type: Unit Group
  • Array: No
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,570
CurrentWaveUnit is a Unit-Type array variable.

If a variable has brackets after it's name then we know it's an Array -> []

So you're keeping track of the different Unit-Types inside of this Array:
  • Events
    • Map initialization
  • Conditions
  • Actions
    • Set Variable CurrentWaveUnit[1] = Footman
    • Set Variable CurrentWaveUnit[2] = Rifleman
    • Set Variable CurrentWaveUnit[3] = Knight
Then you're keeping track of which Wave you're currently on using the CurrentWave variable:
  • Events
    • -- put your own events here --
  • Conditions
    • -- put your own conditions here (if any) --
  • Actions
    • Set Variable CurrentWave = (CurrentWave + 1)
Then you're creating Units using those two variables in combination:
  • Actions
    • Unit - Create 1 CurrentWaveUnit[CurrentWave] for Player 12 (Brown) at (Center of SpawnUL <gen>) facing Default building facing degrees
If CurrentWave is equal to 1 it will create Footman.
If CurrentWave is equal to 2 it will create Rifleman.
If CurrentWave is equal to 3 it will create Knights.
 
Level 4
Joined
Dec 23, 2023
Messages
47
Sorry, I forgot to write it here. I think you won't believe it, but yes, I finally got something.
My Prblem was I used Unit Group for "CurrentWaveUnit", but I needed to use Unit Type.
 
Level 4
Joined
Dec 23, 2023
Messages
47
And thus you have learned :)
Yeah finally...and noiw I try to find out, how I can make it, that players get shown the current Value of the Integer Variable "CurrentWave".
Currently I set up a work around of showing the Name of the last created Unit, that should always be the current Wave Units who are just called Welle ??.
 
Level 39
Joined
Feb 27, 2007
Messages
5,024
Conversion - Convert Integer to String

Take any trigger action (like multiboard info or a message displayed to player) with a string input field and use the above action. That will allow you to put an integer there instead of a string (that will then get converted to and displayed as a string). Use the CurrentWave variable.
 
Top