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

Creeps Spawn! [Solved]

Level 10
Joined
Jun 20, 2017
Messages
329
I had a spawn system in jass, but the units were moving slowly (stuck while walking)!
So I decided to change it to gui while watching this thread
Creating Levels in a Defense Map
And this one to solve it!
How to reduce lag, "many units move to"

My problem is that spawning won't stop! and it crashes my game!
  • Creeps Spawn2
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of living UnitTypes_Creep[Integer_CurrentLevel] units owned by Player 21 (Coal)) Equal to Integers_CreepCount[Integer_CurrentLevel]
          • (Number of living UnitTypes_Creep[Integer_CurrentLevel] units owned by Player 22 (Snow)) Equal to Integers_CreepCount[Integer_CurrentLevel]
        • Then - Actions
          • -------- We then turn off this trigger if the desired number of spawned creeps is meet --------
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • -------- If the number of creeps is still not enough, the creation will still continue --------
          • -------- --------
          • Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 22 (Snow) at Points_CreepSpawn[1] facing Default building facing degrees
          • Unit - Set the custom value of (Last created unit) to 1
          • Unit Group - Add (Last created unit) to UnitGroup_Creep
          • Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[1]
          • Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[1]
          • Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
            • Loop - Actions
              • Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[1]
          • -------- --------
          • Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 22 (Snow) at Points_CreepSpawn[2] facing Default building facing degrees
          • Unit - Set the custom value of (Last created unit) to 2
          • Unit Group - Add (Last created unit) to UnitGroup_Creep
          • Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[1]
          • Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[2]
          • Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
            • Loop - Actions
              • Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[2]
          • -------- --------
          • Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 22 (Snow) at Points_CreepSpawn[3] facing Default building facing degrees
          • Unit - Set the custom value of (Last created unit) to 3
          • Unit Group - Add (Last created unit) to UnitGroup_Creep
          • Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[1]
          • Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[3]
          • Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
            • Loop - Actions
              • Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[3]
          • -------- --------
          • Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 22 (Snow) at Points_CreepSpawn[4] facing Default building facing degrees
          • Unit - Set the custom value of (Last created unit) to 4
          • Unit Group - Add (Last created unit) to UnitGroup_Creep
          • Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[1]
          • Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[4]
          • Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
            • Loop - Actions
              • Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[4]
          • -------- --------
          • Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 22 (Snow) at Points_CreepSpawn[5] facing Default building facing degrees
          • Unit - Set the custom value of (Last created unit) to 5
          • Unit Group - Add (Last created unit) to UnitGroup_Creep
          • Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[1]
          • Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[5]
          • Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
            • Loop - Actions
              • Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[5]
          • -------- --------
          • Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 22 (Snow) at Points_CreepSpawn[6] facing Default building facing degrees
          • Unit - Set the custom value of (Last created unit) to 6
          • Unit Group - Add (Last created unit) to UnitGroup_Creep
          • Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[1]
          • Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[6]
          • Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
            • Loop - Actions
              • Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[6]
          • -------- --------
          • -------- --------
          • -------- --------
          • Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 21 (Coal) at Points_CreepSpawn[7] facing Default building facing degrees
          • Unit - Set the custom value of (Last created unit) to 7
          • Unit Group - Add (Last created unit) to UnitGroup_Creep
          • Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[2]
          • Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[7]
          • Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
            • Loop - Actions
              • Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[7]
          • -------- --------
          • Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 21 (Coal) at Points_CreepSpawn[8] facing Default building facing degrees
          • Unit - Set the custom value of (Last created unit) to 8
          • Unit Group - Add (Last created unit) to UnitGroup_Creep
          • Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[2]
          • Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[8]
          • Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
            • Loop - Actions
              • Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[8]
          • -------- --------
          • Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 21 (Coal) at Points_CreepSpawn[9] facing Default building facing degrees
          • Unit - Set the custom value of (Last created unit) to 9
          • Unit Group - Add (Last created unit) to UnitGroup_Creep
          • Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[2]
          • Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[9]
          • Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
            • Loop - Actions
              • Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[9]
          • -------- --------
          • Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 21 (Coal) at Points_CreepSpawn[10] facing Default building facing degrees
          • Unit - Set the custom value of (Last created unit) to 10
          • Unit Group - Add (Last created unit) to UnitGroup_Creep
          • Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[2]
          • Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[10]
          • Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
            • Loop - Actions
              • Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[10]
          • -------- --------
          • Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 21 (Coal) at Points_CreepSpawn[11] facing Default building facing degrees
          • Unit - Set the custom value of (Last created unit) to 11
          • Unit Group - Add (Last created unit) to UnitGroup_Creep
          • Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[2]
          • Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[11]
          • Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
            • Loop - Actions
              • Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[11]
          • -------- --------
          • Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 21 (Coal) at Points_CreepSpawn[12] facing Default building facing degrees
          • Unit - Set the custom value of (Last created unit) to 12
          • Unit Group - Add (Last created unit) to UnitGroup_Creep
          • Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[2]
          • Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[12]
          • Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
            • Loop - Actions
              • Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[12]
I have this one (shorter) but it doesn't work properly!
  • Creeps Spawn
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet Integer_Temp = 0
      • Set VariableSet Integer_Temp = (Integer_Temp + 1)
      • Set VariableSet Integer_Temp2 = 6
      • Set VariableSet Integer_Temp2 = (Integer_Temp2 + 1)
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of living UnitTypes_Creep[Integer_CurrentLevel] units owned by Player 21 (Coal)) Equal to Integers_CreepCount[Integer_CurrentLevel]
          • (Number of living UnitTypes_Creep[Integer_CurrentLevel] units owned by Player 22 (Snow)) Equal to Integers_CreepCount[Integer_CurrentLevel]
        • Then - Actions
          • -------- We then turn off this trigger if the desired number of spawned creeps is meet --------
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • -------- If the number of creeps is still not enough, the creation will still continue --------
          • -------- --------
          • For each (Integer A) from 1 to 6, do (Actions)
            • Loop - Actions
              • Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 22 (Snow) at Points_CreepSpawn[((Integer A) + Integer_Temp)] facing Default building facing degrees
              • Unit - Set the custom value of (Last created unit) to Integer_Temp
              • Unit Group - Add (Last created unit) to UnitGroup_Creep
              • Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[1]
              • Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[Integer_Temp]
              • Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
                • Loop - Actions
                  • Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[Integer_Temp]
          • -------- --------
          • For each (Integer A) from 7 to 12, do (Actions)
            • Loop - Actions
              • Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 21 (Coal) at Points_CreepSpawn[((Integer A) + Integer_Temp2)] facing Default building facing degrees
              • Unit - Set the custom value of (Last created unit) to Integer_Temp2
              • Unit Group - Add (Last created unit) to UnitGroup_Creep
              • Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[2]
              • Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[Integer_Temp2]
              • Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
                • Loop - Actions
                  • Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[Integer_Temp2]
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,496
So how exactly do you want the system to work? Because both of those systems look pretty messy.

Is it intended that the system creates Units for every Player regardless of whether they're playing or not?

Also, do you have a Unit Indexer in your map (you probably should). If you do then make sure to use that instead of setting Custom Value yourself.

Edit: Attached a map with a system similar to what you're doing in the second trigger. The only thing I left out was the Unit Groups. Remember when using Unit Group arrays that you'll need to initialize them manually.
 

Attachments

  • Always Spawn System 1.w3m
    26.7 KB · Views: 5
Last edited:
Level 10
Joined
Jun 20, 2017
Messages
329
Thanks for your help as always.
Is it intended that the system creates Units for every Player regardless of whether they're playing or not?
The system works for every player who plays.
And I have a condition that you can set to false or true.

I tried to modify it a bit and ran into a few problems!
After I cleared the wave, the next level didn't run!
And in my map the total spawned unit was divided by 2!? like 36*6=216 units must be spawned (but 108 instead)!

Question, does it matter if the computer reaches the food limit?
For example, I set the foot limit to 100, is it possible to spawn 216 units for a computer?!
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,496
Food is only used when trying to train something from a building or buy a unit from a shop. Creating units via triggers has no interaction with these systems and can bypass the limits.

If you only want units to spawn for ACTIVE players then I'll change the system to use Player Groups instead of For Loops. The Player Groups will allow us to track who is actually playing and run actions only for those players.

And your issues sound like you haven't adjusted the triggers to work for your map. For instance, don't forget to give your spawn units the Spawn Classification ability. The system is pretty simple so I recommend looking it over some more to get a better understanding.
 
Last edited:
Level 10
Joined
Jun 20, 2017
Messages
329
Thanks, I fixed the problems with your edited example map, but in my map the spawned unit is still divided by 2! and they were still moving slowly (I think the problem was that they were waiting for one of them to move and then the other!) Like they were in order or something!

And I want a preparation time before the round starts! Is there a better way to do this!
  • Level Ends
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Level of Spawn Classification for (Triggering unit)) Greater than 0
    • Actions
      • Set VariableSet Integer_CreepRemaining = (Integer_CreepRemaining - 1)
      • Game - Display to (All players) for 5.00 seconds the text: (Units remaining: + (String(Integer_CreepRemaining)))
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_CreepRemaining Equal to 0
        • Then - Actions
          • -------- Run "Next Level" when all of the spawned units have died --------
          • -------- --------
          • -------- Arena start --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • Integer_CurrentLevel Equal to 10
                  • Integer_CurrentLevel Equal to 20
            • Then - Actions
              • Set VariableSet Boolean_Arena = True
              • -------- --------
              • Countdown Timer - Start Timer_LevelBegins as a One-shot timer that will expire in 30.00 seconds
              • Countdown Timer - Change the title of TimerWindow_LevelBegins to Arena Battle in
              • Game - Display to (All players) for 10.00 seconds the text: You have |cffffcc00...
            • Else - Actions
              • Countdown Timer - Hide TimerWindow_GameBegins
              • Countdown Timer - Destroy TimerWindow_GameBegins
              • Countdown Timer - Hide TimerWindow_LevelBegins
              • Countdown Timer - Destroy TimerWindow_LevelBegins
              • Countdown Timer - Start Timer_LevelBegins as a One-shot timer that will expire in (Real(Integers_BeReady[(Integer_CurrentLevel + 1)])) seconds
              • Countdown Timer - Create a timer window for Timer_LevelBegins with title (Level + ((String((Integer_CurrentLevel + 1))) + in))
              • Set VariableSet TimerWindow_LevelBegins = (Last created timer window)
              • Countdown Timer - Show TimerWindow_LevelBegins
              • Game - Display to (All players) for 10.00 seconds the text: (((You have |cffffcc00 + (String(Integers_BeReady[(Integer_CurrentLevel + 1)]))) + |r seconds until level |cffffcc00) + ((String((Integer_CurrentLevel + 1))) + |r begins.))
              • -------- --------
              • Wait (Real(Integers_BeReady[(Integer_CurrentLevel + 1)])) game-time seconds
              • -------- --------
              • Trigger - Run Next Level <gen> (ignoring conditions)
        • Else - Actions
 

Attachments

  • Always Spawn System 1.w3m
    34.6 KB · Views: 1

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,496
You got rid of all of the Creep Computers... The whole point of that is to divide the Creeps among multiple Computer players so that the pathing issue goes away. You don't necessarily NEED 12 of them like I'm doing now but the more the better as it allows you to spawn more units without issues.

Here's an updated version that uses Player Groups. The system should work how you want it now. Don't mess with anything unless you're sure you know what you're doing, I did things for a reason. Since it uses Player Groups now the demo map doesn't really work since you're going to be the only Player (user) in the game.
 

Attachments

  • Always Spawn System 2.w3m
    43.9 KB · Views: 8
Last edited:
Top