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

Creep autospawns

Status
Not open for further replies.
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

For this you can use the following:

  • Autospawn
    • Events
      • Time - Every 20.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 3 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing (270.0) degrees
      • Unit - Create 1 Rifleman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing (270.0) degrees
1) You can use other Units or other numbers
2) Just pick the Player, you want
3) Change "Playable map area" to a Rect, what you created at the place, where the creeps should spawn.
 
Level 11
Joined
Feb 16, 2009
Messages
760
You can store the creeps in a unit group and check first if they are dead. Shouldn't be to hard. Use these triggers to make it leakless and working
  • Set variable
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set SpawnPoint = (Center of (Playable map area))
  • Spawn
    • Events
      • Time - Every 15.00 seconds of game time
    • Conditions
    • Actions
      • If ((All units of CreepGroup are dead) Equal to True) then do (Custom script: call DestroyGroup( udg_CreepGroup )) else do (Skip remaining actions)
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Footman for Player 1 (Red) at SpawnPoint facing SpawnPoint
          • Unit Group - Add (Last created unit) to CreepGroup
      • Unit - Create 1 Rifleman for Player 1 (Red) at SpawnPoint facing SpawnPoint
      • Unit Group - Add (Last created unit) to CreepGroup


To Dr.Boom: I appreciate the help you are giving but I strongly recommend to learn how to remove leaks. With spawning triggers this can really slow the game
 
Level 11
Joined
Feb 16, 2009
Messages
760
With the loop, I can add every last created unit to the unit group needed for checking if the creeps are alive. Find it at teh very beginning of teh action list(For every interger A, do multiple actions). If you want to spawn more creep type 2, also use a loop
 
Level 4
Joined
Mar 14, 2009
Messages
98
DotA's creep spawn actually works differently from the ones described. Every X seconds, the trigger checks if there are any units within a certain distance from the creeps' spawn points. If there aren't then it spawns a random group of creeps at the given spawn point. This is why sometimes, when you pull creeps far enough from the spawn point, when they run back you'd see a new groups of creeps there plus the ones you pulled.

  • DotA Respawn
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Units within 512.00 of CreepSpawnPoint[1]) is empty) Equal to True
        • Then - Actions
          • Set CreepRandomNumber = (Random integer number between 1 and 3)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CreepRandomNumber Equal to 1
            • Then - Actions
              • Unit - Create 1 Forest Troll for Neutral Hostile at CreepSpawnPoint[1] facing 270.00 degrees
              • Unit - Create 1 Forest Troll for Neutral Hostile at CreepSpawnPoint[1] facing 270.00 degrees
              • Unit - Create 1 Kobold Taskmaster for Neutral Hostile at CreepSpawnPoint[1] facing 270.00 degrees
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CreepRandomNumber Equal to 2
                • Then - Actions
                  • Unit - Create 1 Gnoll Assassin for Neutral Hostile at CreepSpawnPoint[1] facing 270.00 degrees
                  • Unit - Create 1 Gnoll Assassin for Neutral Hostile at CreepSpawnPoint[1] facing 270.00 degrees
                  • Unit - Create 1 Gnoll Assassin for Neutral Hostile at CreepSpawnPoint[1] facing 270.00 degrees
                • Else - Actions
                  • Unit - Create 1 Fel Stalker for Neutral Hostile at CreepSpawnPoint[1] facing 270.00 degrees
                  • Unit - Create 1 Fel Stalker for Neutral Hostile at CreepSpawnPoint[1] facing 270.00 degrees
                  • Unit - Create 1 Ghost for Neutral Hostile at CreepSpawnPoint[1] facing 270.00 degrees
        • Else - Actions
      • Custom script: set bj_wantDestroyGroup = true
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Units within 512.00 of CreepSpawnPoint[2]) is empty) Equal to True
        • Then - Actions
          • Set CreepRandomNumber = (Random integer number between 1 and 3)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CreepRandomNumber Equal to 1
            • Then - Actions
              • Unit - Create 1 Polar Furbolg for Neutral Hostile at CreepSpawnPoint[2] facing 270.00 degrees
              • Unit - Create 1 Polar Furbolg Champion for Neutral Hostile at CreepSpawnPoint[2] facing 270.00 degrees
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CreepRandomNumber Equal to 2
                • Then - Actions
                  • Unit - Create 1 Satyr Trickster for Neutral Hostile at CreepSpawnPoint[2] facing 270.00 degrees
                  • Unit - Create 1 Satyr Soulstealer for Neutral Hostile at CreepSpawnPoint[2] facing 270.00 degrees
                  • Unit - Create 1 Satyr Hellcaller for Neutral Hostile at CreepSpawnPoint[2] facing 270.00 degrees
                • Else - Actions
                  • Unit - Create 1 Enraged Wildkin for Neutral Hostile at CreepSpawnPoint[2] facing 270.00 degrees
                  • Unit - Create 1 Wildkin for Neutral Hostile at CreepSpawnPoint[2] facing 270.00 degrees
                  • Unit - Create 1 Wildkin for Neutral Hostile at CreepSpawnPoint[2] facing 270.00 degrees
        • Else - Actions

I would personally suggest making a trigger that goes something like when a unit dies, it checks to see if the unit was the last one in the group. If that condition is true then it waits X seconds, then spawns a random group of creeps at the spawn point.


  • My Suggestion
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in CreepGroup[1]) Equal to True
          • (All units of CreepGroup[1] are dead) Equal to True
        • Then - Actions
          • Unit Group - Remove all units from CreepGroup[1]
          • Wait 20.00 game-time seconds
          • Set CreepRandomNumber = (Random integer number between 1 and 3)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CreepRandomNumber Equal to 1
            • Then - Actions
              • Unit - Create 1 Forest Troll for Neutral Hostile at CreepSpawnPoint[1] facing 270.00 degrees
              • Unit Group - Add (Last created unit) to CreepGroup[1]
              • Unit - Create 1 Forest Troll for Neutral Hostile at CreepSpawnPoint[1] facing 270.00 degrees
              • Unit Group - Add (Last created unit) to CreepGroup[1]
              • Unit - Create 1 Kobold Taskmaster for Neutral Hostile at CreepSpawnPoint[1] facing 270.00 degrees
              • Unit Group - Add (Last created unit) to CreepGroup[1]
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CreepRandomNumber Equal to 2
                • Then - Actions
                  • Unit - Create 1 Gnoll Assassin for Neutral Hostile at CreepSpawnPoint[1] facing 270.00 degrees
                  • Unit Group - Add (Last created unit) to CreepGroup[1]
                  • Unit - Create 1 Gnoll Assassin for Neutral Hostile at CreepSpawnPoint[1] facing 270.00 degrees
                  • Unit Group - Add (Last created unit) to CreepGroup[1]
                  • Unit - Create 1 Gnoll Assassin for Neutral Hostile at CreepSpawnPoint[1] facing 270.00 degrees
                  • Unit Group - Add (Last created unit) to CreepGroup[1]
                • Else - Actions
                  • Unit - Create 1 Fel Stalker for Neutral Hostile at CreepSpawnPoint[1] facing 270.00 degrees
                  • Unit Group - Add (Last created unit) to CreepGroup[1]
                  • Unit - Create 1 Fel Stalker for Neutral Hostile at CreepSpawnPoint[1] facing 270.00 degrees
                  • Unit Group - Add (Last created unit) to CreepGroup[1]
                  • Unit - Create 1 Ghost for Neutral Hostile at CreepSpawnPoint[1] facing 270.00 degrees
                  • Unit Group - Add (Last created unit) to CreepGroup[1]
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (All units of CreepGroup[2] are dead) Equal to True
              • ((Triggering unit) is in CreepGroup[2]) Equal to True
            • Then - Actions
              • Unit Group - Remove all units from CreepGroup[2]
              • Wait 20.00 game-time seconds
              • Set CreepRandomNumber = (Random integer number between 1 and 3)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CreepRandomNumber Equal to 1
                • Then - Actions
                  • Unit - Create 1 Polar Furbolg for Neutral Hostile at CreepSpawnPoint[2] facing 270.00 degrees
                  • Unit Group - Add (Last created unit) to CreepGroup[2]
                  • Unit - Create 1 Polar Furbolg Champion for Neutral Hostile at CreepSpawnPoint[2] facing 270.00 degrees
                  • Unit Group - Add (Last created unit) to CreepGroup[2]
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • CreepRandomNumber Equal to 2
                    • Then - Actions
                      • Unit - Create 1 Satyr Trickster for Neutral Hostile at CreepSpawnPoint[2] facing 270.00 degrees
                      • Unit Group - Add (Last created unit) to CreepGroup[2]
                      • Unit - Create 1 Satyr Soulstealer for Neutral Hostile at CreepSpawnPoint[2] facing 270.00 degrees
                      • Unit Group - Add (Last created unit) to CreepGroup[2]
                      • Unit - Create 1 Satyr Hellcaller for Neutral Hostile at CreepSpawnPoint[2] facing 270.00 degrees
                      • Unit Group - Add (Last created unit) to CreepGroup[2]
                    • Else - Actions
                      • Unit - Create 1 Enraged Wildkin for Neutral Hostile at CreepSpawnPoint[2] facing 270.00 degrees
                      • Unit Group - Add (Last created unit) to CreepGroup[2]
                      • Unit - Create 1 Wildkin for Neutral Hostile at CreepSpawnPoint[2] facing 270.00 degrees
                      • Unit Group - Add (Last created unit) to CreepGroup[2]
                      • Unit - Create 1 Wildkin for Neutral Hostile at CreepSpawnPoint[2] facing 270.00 degrees
                      • Unit Group - Add (Last created unit) to CreepGroup[2]
            • Else - Actions


Oh and for the loop question, You can break "For each integer A from X to Y" into parts so it's easier to understand. Integer A is where an integer value is stored. X will be the initial value of integer A. Y will be the final value of integer A before it leaves the loop.
The loop will increment integer A by 1 every time it goes through the loop. In the most basic sense, it means that it will do the actions Y-X+1 times, although you can use integer A within the loop as well.
For example:

  • For each (Integer A) from 1 to 5, do (Actions)
    • Loop - Actions
      • Unit - Create 1 Footman for (Player((Integer A))) at (Center of (Playable map area)) facing Default building facing degrees

That will make five footmen, one each for players 1-5.
 
Last edited:
Level 4
Joined
Mar 14, 2009
Messages
98
Basically, the condition creates a group, then places all units within range into that group. It then checks if the group is empty. If it is, then the actions push through. The leak happens when it creates a group and then just leaves the group there without destroying it after it is used.

Fortunately, most of the group-related commands in the GUI have a feature that checks if bj_wantDestroyGroup (a global, blizzard-defined variable that's false by default) is true. If it is, then they destroy the group. They set the value of bj_wantDestroyGroup to false right after they finish though, so you have to keep doing it every time you use a group-related thing.

The custom script I added sets bj_wantDestroyGroup to true, that way the groups created are destroyed as soon as they are used. This method prevents leaks for the following GUI commands:
Conditions:
Unit Group - Units of Unit Group Are Dead
Unit Group - Unit Group Is Empty
Actions:
Unit Group - Pick Every Unit in Unit Group and do Action
Unit Group - Pick Every Unit in Unit Group and do Multiple Actions
Unit Group - Remove Group (destroys temporary group in which units to be removed are stored, it will still leak* the group from which they were removed.)
Unit Group - Add Group (destroys temporary group in which units to be added are stored, it will still leak* the group to which they were added.)

*Technically, it's not a leak if you still use the groups later on and destroy them in the proper time, which you probably will.

All other group-related commands have to have the groups stored in a variable to be destroyed later. Of course, the easiest way to prevent leaks without memorizing this list (or knowing JASS and having a list of functions) is to just store each group in a variable, then destroying the groups when you're done with them.

I'm sorry if it's kinda hard to understand, the whole thing's pretty hard for me to explain without going into JASS.
 
Level 10
Joined
Jun 7, 2008
Messages
420
You can store the creeps in a unit group and check first if they are dead. Shouldn't be to hard. Use these triggers to make it leakless and working
  • Set variable
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set SpawnPoint = (Center of (Playable map area))
  • Spawn
    • Events
      • Time - Every 15.00 seconds of game time
    • Conditions
    • Actions
      • If ((All units of CreepGroup are dead) Equal to True) then do (Custom script: call DestroyGroup( udg_CreepGroup )) else do (Skip remaining actions)
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Footman for Player 1 (Red) at SpawnPoint facing SpawnPoint
          • Unit Group - Add (Last created unit) to CreepGroup
      • Unit - Create 1 Rifleman for Player 1 (Red) at SpawnPoint facing SpawnPoint
      • Unit Group - Add (Last created unit) to CreepGroup


To Dr.Boom: I appreciate the help you are giving but I strongly recommend to learn how to remove leaks. With spawning triggers this can really slow the game

Sorry I don't know whats JASS and whats Custom script.
Please help, thanks.
 
Status
Not open for further replies.
Top