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

Limit spawn system

UPDATE TURN OFF TRIGGER WHEN ALL SPAWN IS TURNED OFF

LIMIT SPAWN SYSTEM:

  • LSS INIT
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set LSS_LOOP = 0.01
      • Trigger - Add to LSS LOOP <gen> the event (Time - Every LSS_LOOP seconds of game time)
      • -------- 1 --------
      • Set LSS_COUNT = (LSS_COUNT + 1)
      • Set LSS_Type[LSS_COUNT] = Peasant
      • Set LSS_Player[LSS_COUNT] = Player 1 (Red)
      • Set LSS_Limit[LSS_COUNT] = 20
      • Set LSS_Region[LSS_COUNT] = SPAWN 1 <gen>
      • Set LSS_SpawnON[LSS_COUNT] = True
      • Set LSS_TimeSource[LSS_COUNT] = 0.50
      • Set LSS_UnitPerSpawn[LSS_COUNT] = 1
      • Set LSS_RandomLoc[LSS_COUNT] = False
      • Set LSS_SFX[LSS_COUNT] = Abilities\Spells\Undead\ReplenishMana\ReplenishManaCasterOverhead.mdl
      • -------- 2 --------
      • Set LSS_COUNT = (LSS_COUNT + 1)
      • Set LSS_Type[LSS_COUNT] = Knight
      • Set LSS_Player[LSS_COUNT] = Player 2 (Blue)
      • Set LSS_Limit[LSS_COUNT] = 10
      • Set LSS_Region[LSS_COUNT] = SPAWN 2 <gen>
      • Set LSS_SpawnON[LSS_COUNT] = True
      • Set LSS_TimeSource[LSS_COUNT] = 5.00
      • Set LSS_UnitPerSpawn[LSS_COUNT] = 3
      • Set LSS_RandomLoc[LSS_COUNT] = True
      • Set LSS_SFX[LSS_COUNT] = Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
NOW YOU CAN CHANGE THE TIME LOOP.......
  • Set LSS_LOOP = 0.01
    • Trigger - Add to LSS LOOP <gen> the event (Time - Every LSS_LOOP seconds of game time)
  • LSS LOOP
    • Events
    • Conditions
    • Actions
      • Set LSS_EVENT = 0.00
      • For each (Integer LSS_INT) from 1 to LSS_COUNT, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • LSS_SpawnON[LSS_INT] Equal to True
            • Then - Actions
              • Set LSS_EVENT = (LSS_EVENT + 1.00)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • LSS_SpawnON[LSS_INT] Equal to True
              • LSS_TimeLoop[LSS_INT] Greater than or equal to LSS_TimeSource[LSS_INT]
            • Then - Actions
              • Set LSS_TimeLoop[LSS_INT] = 0.00
              • For each (Integer LSS_INT2) from 1 to LSS_UnitPerSpawn[LSS_INT], do (Actions)
                • Loop - Actions
                  • Set LSS_GROUP = (Units in LSS_Region[LSS_INT] matching (((Unit-type of (Matching unit)) Equal to LSS_Type[LSS_INT]) and (((Owner of (Matching unit)) Equal to LSS_Player[LSS_INT]) and (((Matching unit) is alive) Equal to True))))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in LSS_GROUP) Less than LSS_Limit[LSS_INT]
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • LSS_RandomLoc[LSS_INT] Equal to True
                        • Then - Actions
                          • Set LSS_LOC = (Random point in LSS_Region[LSS_INT])
                        • Else - Actions
                          • Set LSS_LOC = (Center of LSS_Region[LSS_INT])
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in LSS_GROUP) Greater than LSS_Limit[LSS_INT]
                        • Then - Actions
                        • Else - Actions
                          • Unit - Create 1 LSS_Type[LSS_INT] for LSS_Player[LSS_INT] at LSS_LOC facing Default building facing degrees
                          • Special Effect - Create a special effect at LSS_LOC using LSS_SFX[LSS_INT]
                          • Special Effect - Destroy (Last created special effect)
                      • Custom script: call DestroyGroup(udg_LSS_GROUP)
                      • Custom script: call RemoveLocation(udg_LSS_LOC)
                    • Else - Actions
                  • Custom script: call DestroyGroup(udg_LSS_GROUP)
            • Else - Actions
              • Set LSS_TimeLoop[LSS_INT] = (LSS_TimeLoop[LSS_INT] + LSS_LOOP)
  • LSS ON
    • Events
      • Game - LSS_EVENT becomes Greater than 0.00
    • Conditions
    • Actions
      • Trigger - Turn on LSS LOOP <gen>
  • LSS OFF
    • Events
      • Game - LSS_EVENT becomes Equal to 0.00
    • Conditions
    • Actions
      • Trigger - Turn off LSS LOOP <gen>
Fix some bugs with Special Effect.

Well, the system should look like this:

1-20 MAX types for and area, meaning 1-20 different type that you can choose will spawn in the region you want, also it should have a limit of how much units per type it should have, each type should have their own limit, all spawns are heroes!. also you can set on each single spawn the level.

Create some variables like:
Type:
Level:
Area:
Limit Unit:
Cooldown of spawning new unit:

Thanks NightBrowler for request me to make this system.

Email: [email protected]

Keywords:
spawn,system,limit,btdonald,rpg,aos
Contents

Limit Spawn System (Map)

Reviews
16 Feb 2012 Bribe: There is a lot of copy & paste necessary here. I prefer the approach Blizzard used in WarChasers to this one, to be honest. Though it works, it's really simple and requires a lot of bruteforce copy & paste to get working...

Moderator

M

Moderator

16 Feb 2012
Bribe: There is a lot of copy & paste necessary here. I prefer the approach Blizzard used in WarChasers to this one, to be honest.

Though it works, it's really simple and requires a lot of bruteforce copy & paste to get working. Approved with minimal rating. 2/5.
 

Kazeon

Hosted Project: EC
Level 34
Joined
Oct 12, 2011
Messages
3,449
Why does spawn system require an ingame-screenshot?

Yeah, I'm agree with you.. Actually this is a system, not a spell.. Maybe Bribe need a lot of sleeps/rests.. Maybe he has some unfinished projects so he spends all nights and days to finish his projects.. Without rest.. Just kidd Bribe.. :goblin_yeah:
 
I must say that I could find a use for this ;p
Skimming the code...
  • Set LSS_LOOP = 0.01
  • Trigger - Add to LSS LOOP &lt;gen&gt; the event (Time - Every LSS_LOOP seconds of game time)
You don't need this, people can set it themselves.
0.01 is way too fast anyway, this system easily runs at every 1 seconds
Other than that this is a very neat system.
 
Level 11
Joined
Dec 3, 2011
Messages
366
I must say that I could find a use for this ;p
Skimming the code...
  • Set LSS_LOOP = 0.01
  • Trigger - Add to LSS LOOP &lt;gen&gt; the event (Time - Every LSS_LOOP seconds of game time)
You don't need this, people can set it themselves.
0.01 is way too fast anyway, this system easily runs at every 1 seconds
Other than that this is a very neat system.

:D
  • Set LSS_LOOP = 0.01
  • Trigger - Add to LSS LOOP &lt;gen&gt; the event (Time - Every LSS_LOOP seconds of game time)
this is an optional Varrible and everyone can easily change it :D
 
  • LSS LOOP
    • Events
    • Conditions
    • Actions
      • For each (Integer LSS_INT) from 1 to LSS_COUNT, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • LSS_SpawnON[LSS_INT] Equal to True
            • Then - Actions
              • Set LSS_TimeLoop[LSS_INT] = (LSS_TimeLoop[LSS_INT] + LSS_LOOP)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • LSS_TimeLoop[LSS_INT] Greater than or equal to LSS_TimeSource[LSS_INT]
                • Then - Actions
                  • Set LSS_TimeLoop[LSS_INT] = 0.00
                  • For each (Integer LSS_INT2) from 1 to LSS_UnitPerSpawn[LSS_INT], do (Actions)
                    • Loop - Actions
                      • Set LSS_GROUP = (Units in LSS_Region[LSS_INT] matching (((Unit-type of (Matching unit)) Equal to LSS_Type[LSS_INT]) and (((Owner of (Matching unit)) Equal to LSS_Player[LSS_INT]) and (((Matching unit) is alive) Equal to True))))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in LSS_GROUP) Less than LSS_Limit[LSS_INT]
                        • Then - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • LSS_RandomLoc[LSS_INT] Equal to True
                            • Then - Actions
                              • Set LSS_LOC = (Random point in LSS_Region[LSS_INT])
                            • Else - Actions
                              • Set LSS_LOC = (Center of LSS_Region[LSS_INT])
                          • Unit - Create 1 LSS_Type[LSS_INT] for LSS_Player[LSS_INT] at LSS_LOC facing Default building facing degrees
                          • Set LSS_GROUP = (Units in LSS_Region[LSS_INT] matching (((Unit-type of (Matching unit)) Equal to LSS_Type[LSS_INT]) and (((Owner of (Matching unit)) Equal to LSS_Player[LSS_INT]) and (((Matching unit) is alive) Equal to True))))
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Number of units in LSS_GROUP) Greater than LSS_Limit[LSS_INT]
                            • Then - Actions
                              • Unit - Remove (Last created unit) from the game
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • LSS_RandomLoc[LSS_INT] Equal to True
                                • Then - Actions
                                  • Special Effect - Create a special effect at LSS_LOC using LSS_SFX[LSS_INT]
                                  • Special Effect - Destroy (Last created special effect)
                                • Else - Actions
                          • Custom script: call DestroyGroup(udg_LSS_GROUP)
                          • Custom script: call RemoveLocation(udg_LSS_LOC)
                        • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • LSS_RandomLoc[LSS_INT] Equal to False
                        • Then - Actions
                          • Set LSS_LOC = (Center of LSS_Region[LSS_INT])
                          • Special Effect - Create a special effect at LSS_LOC using LSS_SFX[LSS_INT]
                          • Special Effect - Destroy (Last created special effect)
                          • Custom script: call RemoveLocation(udg_LSS_LOC)
                        • Else - Actions
                      • Custom script: call DestroyGroup(udg_LSS_GROUP)
                • Else - Actions
            • Else - Actions
->

  • LSS LOOP
    • Events
    • Conditions
    • Actions
      • For each (Integer LSS_INT) from 1 to LSS_COUNT, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • LSS_SpawnON[LSS_INT] Equal to True
              • LSS_TimeLoop[LSS_INT] Greater than or equal to LSS_TimeSource[LSS_INT]
            • Then - Actions
              • Set LSS_TimeLoop[LSS_INT] = 0.00
              • For each (Integer LSS_INT2) from 1 to LSS_UnitPerSpawn[LSS_INT], do (Actions)
                • Loop - Actions
                  • Set LSS_GROUP = (Units in LSS_Region[LSS_INT] matching (((Unit-type of (Matching unit)) Equal to LSS_Type[LSS_INT]) and (((Owner of (Matching unit)) Equal to LSS_Player[LSS_INT]) and (((Matching unit) is alive) Equal to True))))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in LSS_GROUP) Less than LSS_Limit[LSS_INT]
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • LSS_RandomLoc[LSS_INT] Equal to True
                        • Then - Actions
                          • Set LSS_LOC = (Random point in LSS_Region[LSS_INT])
                        • Else - Actions
                          • Set LSS_LOC = (Center of LSS_Region[LSS_INT])
                      • Set LSS_GROUP = (Units in LSS_Region[LSS_INT] matching (((Unit-type of (Matching unit)) Equal to LSS_Type[LSS_INT]) and (((Owner of (Matching unit)) Equal to LSS_Player[LSS_INT]) and (((Matching unit) is alive) Equal to True))))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in LSS_GROUP) Greater than LSS_Limit[LSS_INT]
                        • Then - Actions
                        • Else - Actions
                          • Unit - Create 1 LSS_Type[LSS_INT] for LSS_Player[LSS_INT] at LSS_LOC facing Default building facing degrees
                          • Special Effect - Create a special effect at LSS_LOC using LSS_SFX[LSS_INT]
                          • Special Effect - Destroy (Last created special effect)
                      • Custom script: call DestroyGroup(udg_LSS_GROUP)
                      • Custom script: call RemoveLocation(udg_LSS_LOC)
                    • Else - Actions
                  • Custom script: call DestroyGroup(udg_LSS_GROUP)
            • Else - Actions
              • Set LSS_TimeLoop[LSS_INT] = (LSS_TimeLoop[LSS_INT] + LSS_LOOP)
 
Level 11
Joined
Dec 3, 2011
Messages
366
  • LSS LOOP
    • Events
    • Conditions
    • Actions
      • For each (Integer LSS_INT) from 1 to LSS_COUNT, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • LSS_SpawnON[LSS_INT] Equal to True
            • Then - Actions
              • Set LSS_TimeLoop[LSS_INT] = (LSS_TimeLoop[LSS_INT] + LSS_LOOP)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • LSS_TimeLoop[LSS_INT] Greater than or equal to LSS_TimeSource[LSS_INT]
                • Then - Actions
                  • Set LSS_TimeLoop[LSS_INT] = 0.00
                  • For each (Integer LSS_INT2) from 1 to LSS_UnitPerSpawn[LSS_INT], do (Actions)
                    • Loop - Actions
                      • Set LSS_GROUP = (Units in LSS_Region[LSS_INT] matching (((Unit-type of (Matching unit)) Equal to LSS_Type[LSS_INT]) and (((Owner of (Matching unit)) Equal to LSS_Player[LSS_INT]) and (((Matching unit) is alive) Equal to True))))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in LSS_GROUP) Less than LSS_Limit[LSS_INT]
                        • Then - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • LSS_RandomLoc[LSS_INT] Equal to True
                            • Then - Actions
                              • Set LSS_LOC = (Random point in LSS_Region[LSS_INT])
                            • Else - Actions
                              • Set LSS_LOC = (Center of LSS_Region[LSS_INT])
                          • Unit - Create 1 LSS_Type[LSS_INT] for LSS_Player[LSS_INT] at LSS_LOC facing Default building facing degrees
                          • Set LSS_GROUP = (Units in LSS_Region[LSS_INT] matching (((Unit-type of (Matching unit)) Equal to LSS_Type[LSS_INT]) and (((Owner of (Matching unit)) Equal to LSS_Player[LSS_INT]) and (((Matching unit) is alive) Equal to True))))
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Number of units in LSS_GROUP) Greater than LSS_Limit[LSS_INT]
                            • Then - Actions
                              • Unit - Remove (Last created unit) from the game
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • LSS_RandomLoc[LSS_INT] Equal to True
                                • Then - Actions
                                  • Special Effect - Create a special effect at LSS_LOC using LSS_SFX[LSS_INT]
                                  • Special Effect - Destroy (Last created special effect)
                                • Else - Actions
                          • Custom script: call DestroyGroup(udg_LSS_GROUP)
                          • Custom script: call RemoveLocation(udg_LSS_LOC)
                        • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • LSS_RandomLoc[LSS_INT] Equal to False
                        • Then - Actions
                          • Set LSS_LOC = (Center of LSS_Region[LSS_INT])
                          • Special Effect - Create a special effect at LSS_LOC using LSS_SFX[LSS_INT]
                          • Special Effect - Destroy (Last created special effect)
                          • Custom script: call RemoveLocation(udg_LSS_LOC)
                        • Else - Actions
                      • Custom script: call DestroyGroup(udg_LSS_GROUP)
                • Else - Actions
            • Else - Actions
->

  • LSS LOOP
    • Events
    • Conditions
    • Actions
      • For each (Integer LSS_INT) from 1 to LSS_COUNT, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • LSS_SpawnON[LSS_INT] Equal to True
              • LSS_TimeLoop[LSS_INT] Greater than or equal to LSS_TimeSource[LSS_INT]
            • Then - Actions
              • Set LSS_TimeLoop[LSS_INT] = 0.00
              • For each (Integer LSS_INT2) from 1 to LSS_UnitPerSpawn[LSS_INT], do (Actions)
                • Loop - Actions
                  • Set LSS_GROUP = (Units in LSS_Region[LSS_INT] matching (((Unit-type of (Matching unit)) Equal to LSS_Type[LSS_INT]) and (((Owner of (Matching unit)) Equal to LSS_Player[LSS_INT]) and (((Matching unit) is alive) Equal to True))))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in LSS_GROUP) Less than LSS_Limit[LSS_INT]
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • LSS_RandomLoc[LSS_INT] Equal to True
                        • Then - Actions
                          • Set LSS_LOC = (Random point in LSS_Region[LSS_INT])
                        • Else - Actions
                          • Set LSS_LOC = (Center of LSS_Region[LSS_INT])
                      • Set LSS_GROUP = (Units in LSS_Region[LSS_INT] matching (((Unit-type of (Matching unit)) Equal to LSS_Type[LSS_INT]) and (((Owner of (Matching unit)) Equal to LSS_Player[LSS_INT]) and (((Matching unit) is alive) Equal to True))))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in LSS_GROUP) Greater than LSS_Limit[LSS_INT]
                        • Then - Actions
                        • Else - Actions
                          • Unit - Create 1 LSS_Type[LSS_INT] for LSS_Player[LSS_INT] at LSS_LOC facing Default building facing degrees
                          • Special Effect - Create a special effect at LSS_LOC using LSS_SFX[LSS_INT]
                          • Special Effect - Destroy (Last created special effect)
                      • Custom script: call DestroyGroup(udg_LSS_GROUP)
                      • Custom script: call RemoveLocation(udg_LSS_LOC)
                    • Else - Actions
                  • Custom script: call DestroyGroup(udg_LSS_GROUP)
            • Else - Actions
              • Set LSS_TimeLoop[LSS_INT] = (LSS_TimeLoop[LSS_INT] + LSS_LOOP)

I'll fix it :D
 
Level 11
Joined
Dec 3, 2011
Messages
366
I love your signature.. LOLS.. :D:D:D

Btw, congrats for btdonal for the approval..
:D tks..........
I would do this kind of system with Unit dies event and with some timer(s), not with a periodic trigger.

The trigger should be turned off when there's no spawning needed. It also keeps increasing LSS_TimeLoop[index] even if SpawnOn[index] is false.
I'll fix it
 
Top