[GUI]Simple Spawn System v1.1b [MUI]

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
This system is just a very simple spawning system. It was made for my map and DonDustins map. Thought as this is so useful for TDs, AOS and hero defense maps I uploaded this to the public. It uses hanky's dynamic indexing template so credit goes to Hanky.

This system is fully MUI, recycling, yes Kingz would kill me if it wasn't. Yes it is GUI and yes it is very simple! But it supports a few very good features as:

Features
-Supports spawning type
-Supports spawning amount each interval
-Supports interval
-Supports amount of units aka waves you want to spawn them
-Supports location
-Supports random interval between spawning and constant interval as well
-Supports the angle of the spawning unit
-Collision
-Spawning Effects
-Very easy to apply and import
-Very useful for TD and AOS maps and hero defenses as well
-Heavyily documentated
Triggers

WARNING GOT VERY HEAVY DOCUMENTATION!
WATCH TRIGGERS AT YOUR OWN RISK!



  • Spawn Apply
    • Events
    • Conditions
    • Actions
      • -------- ------------------------------------------------ --------
      • -------- You will need all these actions for the system --------
      • -------- These comment lines will explain to you what every action does and do --------
      • -------- Each comment line is for the action below it! --------
      • -------- ------------------------------------------------ --------
      • -------- This is the amount of "waves" you will spawn --------
      • -------- Also read the spawn amount below too --------
      • -------- A brief info about this is that this tracks the amount of units --------
      • -------- So if you want a "wave" in a TD with 30 units, set this to 30 --------
      • -------- and the other spawn amount variable to 1 as 1*30 = 30 ... --------
      • -------- simple --------
      • -------- ------------------------------------------------ --------
      • Set SpawnTempAmount = 1
      • -------- ------------------------------------------------ --------
      • -------- This variable below --------
      • -------- is the spawn amount of each interval --------
      • -------- as you saw the countings above, if you set this to 2 and have 30 above --------
      • -------- you will spawn 60 units --------
      • -------- REMEMBER TO SET THE COLLISION VARIABLE TO FALSE --------
      • -------- IF SPAWNING MORE THAN 1 UNIT --------
      • -------- ------------------------------------------------ --------
      • Set SpawnTempSpawnAmount = 2
      • -------- ------------------------------------------------ --------
      • -------- This one is easy, where do you want to spawn the units --------
      • -------- ------------------------------------------------ --------
      • Set SpawnTempPoint = (Random point in (Playable map area))
      • -------- ------------------------------------------------ --------
      • -------- This is one of the features --------
      • -------- Random intervals --------
      • -------- you pick a random number between min and max --------
      • -------- this variable is the MIN --------
      • -------- SET IT TO SOMETHING BELOW OR EQUAL TO MAX ELSE THE SYSTEM WILL FIX IT ON ITS OWN --------
      • -------- ------------------------------------------------ --------
      • Set SpawnTempRMin = 0.30
      • -------- ------------------------------------------------ --------
      • -------- Description above, this is the MAX variable --------
      • -------- ------------------------------------------------ --------
      • Set SpawnTempRMax = 2.00
      • -------- ------------------------------------------------ --------
      • -------- The type of the spawned unit/s --------
      • -------- ------------------------------------------------ --------
      • Set SpawnTempType = Footman
      • -------- ------------------------------------------------ --------
      • -------- Which angle will the spawned unit face? --------
      • -------- Set it here to fit your needs --------
      • -------- ------------------------------------------------ --------
      • Set SpawnTempAngle = (Random angle)
      • -------- ------------------------------------------------ --------
      • -------- Next one is the owner of the spawning unit --------
      • -------- ------------------------------------------------ --------
      • Set SpawnTempOwner = Player 1 (Red)
      • -------- ------------------------------------------------ --------
      • -------- HERE IS THE COLLISION VARIABLE --------
      • -------- if your spawning amount variable is more than 1 this should be set to false --------
      • -------- so it will turn of the collision --------
      • -------- else keep it true --------
      • -------- WARNING TD USERS! DONT SET THIS TO FALSE IF YOU DONT WANT THE UNITS TO RUN --------
      • -------- THREW YOUR TOWERS! --------
      • -------- ------------------------------------------------ --------
      • Set SpawnTempCollision = False
      • -------- ------------------------------------------------ --------
      • -------- The boolean below is for the special effect --------
      • -------- If it is true, it will create a special effect when a unit spawn --------
      • -------- ------------------------------------------------ --------
      • Set SpawnTempEffect = False
      • -------- ------------------------------------------------ --------
      • -------- Here you can set the special effect --------
      • -------- If the effect variable above equal to false, it doesnt matter if you set this to something or not --------
      • -------- ------------------------------------------------ --------
      • Set SpawnTempString = <Empty String>
      • -------- ------------------------------------------------ --------
      • -------- Here it runs the filter trigger --------
      • -------- more documentation in the filter trigger, move on! --------
      • -------- ------------------------------------------------ --------
      • Trigger - Run Spawn System Filter <gen> (checking conditions)
      • -------- ------------------------------------------------ --------



  • Spawn System Filter
    • Events
    • Conditions
    • Actions
      • -------- ------------------------------------------------ --------
      • -------- The recycling MUI part --------
      • -------- If you want it explained in detail, look for Hanky's Dynamic indexing template --------
      • -------- in the spell section --------
      • -------- ------------------------------------------------ --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Spawn_Index_Size Equal to 0
        • Then - Actions
          • Trigger - Turn on Spawn System Core <gen>
        • Else - Actions
      • -------- ------------------------------------------------ --------
      • Set Spawn_Index_Size = (Spawn_Index_Size + 1)
      • -------- ------------------------------------------------ --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Spawn_Index_Size Greater than Spawn_Index_Max
        • Then - Actions
          • Set Spawn_Index[Spawn_Index_Size] = Spawn_Index_Size
          • Set Spawn_Index_Max = Spawn_Index_Size
        • Else - Actions
      • -------- ------------------------------------------------ --------
      • Set TempInt = Spawn_Index[Spawn_Index_Size]
      • -------- ------------------------------------------------ --------
      • -------- Here it will index the "wave" variable --------
      • -------- ------------------------------------------------ --------
      • Set Spawn_Amount[TempInt] = SpawnTempAmount
      • -------- ------------------------------------------------ --------
      • -------- Index the spawn amount variable --------
      • -------- ------------------------------------------------ --------
      • Set Spawn_SpawnAmount[TempInt] = SpawnTempSpawnAmount
      • -------- ------------------------------------------------ --------
      • -------- Saves the angle into the system --------
      • -------- ------------------------------------------------ --------
      • Set Spawn_Angle[TempInt] = SpawnTempAngle
      • -------- ------------------------------------------------ --------
      • -------- Saves the owner --------
      • -------- ------------------------------------------------ --------
      • Set Spawn_Owner[TempInt] = SpawnTempOwner
      • -------- ------------------------------------------------ --------
      • -------- Stores the point, using X and Y as it is cleaner --------
      • -------- ------------------------------------------------ --------
      • Set Spawn_Point[TempInt] = SpawnTempPoint
      • -------- ------------------------------------------------ --------
      • -------- Saves the type --------
      • -------- ------------------------------------------------ --------
      • Set Spawn_Type[TempInt] = SpawnTempType
      • -------- ------------------------------------------------ --------
      • -------- The random value MIN --------
      • -------- ------------------------------------------------ --------
      • Set Spawn_RMin[TempInt] = SpawnTempRMin
      • -------- ------------------------------------------------ --------
      • -------- The random value MAX --------
      • -------- ------------------------------------------------ --------
      • Set Spawn_RMax[TempInt] = SpawnTempRMax
      • -------- ------------------------------------------------ --------
      • -------- Saves the collision --------
      • -------- ------------------------------------------------ --------
      • Set Spawn_Collision[TempInt] = SpawnTempCollision
      • -------- ------------------------------------------------ --------
      • -------- Saves the effect boolean --------
      • -------- ------------------------------------------------ --------
      • Set SpawnEffect[TempInt] = SpawnTempEffect
      • -------- ------------------------------------------------ --------
      • -------- Saves the string into a new variable --------
      • -------- ------------------------------------------------ --------
      • Set SpawnString[TempInt] = SpawnTempString
      • -------- ------------------------------------------------ --------
      • -------- Here the system checks if random MAX is lesser than MIN --------
      • -------- to avoid potential bugs in the system --------
      • -------- ------------------------------------------------ --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Spawn_RMax[TempInt] Less than Spawn_RMin[TempInt]
        • Then - Actions
          • -------- ------------------------------------------------ --------
          • -------- If it is true the system will make the MAX value on it's own --------
          • -------- ------------------------------------------------ --------
          • Set Spawn_RMax[TempInt] = (Spawn_RMin[TempInt] + (Random real number between 0.00 and 1.00))
          • -------- ------------------------------------------------ --------
        • Else - Actions
          • -------- ------------------------------------------------ --------
      • -------- ------------------------------------------------ --------
      • -------- The interval variable --------
      • -------- which uses the R MIN and R MAX --------
      • -------- ------------------------------------------------ --------
      • Set Spawn_Timer[TempInt] = (Random real number between Spawn_RMin[TempInt] and Spawn_RMax[TempInt])
      • -------- ------------------------------------------------ --------
      • -------- Removes the location leak of the temporary location variable --------
      • -------- ------------------------------------------------ --------
      • Custom script: call RemoveLocation(udg_SpawnTempPoint)
      • -------- ------------------------------------------------ --------
      • -------- MOVE ON TO THE CORE ! --------
      • -------- ------------------------------------------------ --------



  • Spawn System Core
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- ------------------------------------------------ --------
      • -------- About indexing --------
      • -------- Read hanky's template --------
      • -------- ------------------------------------------------ --------
      • For each (Integer Spawn_LOOP) from 1 to Spawn_Index_Size, do (Actions)
        • Loop - Actions
          • -------- ------------------------------------------------ --------
          • Set TempInt = Spawn_Index[Spawn_LOOP]
          • -------- ------------------------------------------------ --------
          • -------- here it checks if the "wave" variable is greater than 0 --------
          • -------- if it is, it will still run --------
          • -------- ------------------------------------------------ --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Spawn_Amount[TempInt] Greater than 0
            • Then - Actions
              • -------- ------------------------------------------------ --------
              • -------- if there are waves left, it checks if the interval is greater than 0 --------
              • -------- ------------------------------------------------ --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Spawn_Timer[TempInt] Greater than 0.00
                • Then - Actions
                  • -------- ------------------------------------------------ --------
                  • -------- if it is, we set the interval to - 0.03 as the event --------
                  • -------- ------------------------------------------------ --------
                  • Set Spawn_Timer[TempInt] = (Spawn_Timer[TempInt] - 0.03)
                  • -------- ------------------------------------------------ --------
                • Else - Actions
                  • -------- ------------------------------------------------ --------
                  • -------- else we will recalculate the interval variable --------
                  • -------- ------------------------------------------------ --------
                  • Set Spawn_Timer[TempInt] = (Random real number between Spawn_RMin[TempInt] and Spawn_RMax[TempInt])
                  • -------- ------------------------------------------------ --------
                  • -------- Spawn our unit, with type, owner, where and angle --------
                  • -------- ------------------------------------------------ --------
                  • Unit - Create Spawn_SpawnAmount[TempInt] Spawn_Type[TempInt] for Spawn_Owner[TempInt] at Spawn_Point[TempInt] facing Spawn_Angle[TempInt] degrees
                  • -------- ------------------------------------------------ --------
                  • -------- set the waves variable to -1 as one wave is finished --------
                  • -------- ------------------------------------------------ --------
                  • Set Spawn_Amount[TempInt] = (Spawn_Amount[TempInt] - 1)
                  • -------- ------------------------------------------------ --------
                  • -------- also checks the collision --------
                  • -------- if it is false we turn of the collision --------
                  • -------- ------------------------------------------------ --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Spawn_Collision[TempInt] Equal to False
                    • Then - Actions
                      • -------- ------------------------------------------------ --------
                      • Unit - Turn collision for (Last created unit) Off
                      • -------- ------------------------------------------------ --------
                    • Else - Actions
                      • -------- ------------------------------------------------ --------
                  • -------- ------------------------------------------------ --------
                  • -------- Here it checks the effect variable if true --------
                  • -------- It will create an effect --------
                  • -------- ------------------------------------------------ --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • SpawnEffect[TempInt] Equal to True
                    • Then - Actions
                      • -------- ------------------------------------------------ --------
                      • -------- Create and destroy afterwards --------
                      • -------- ------------------------------------------------ --------
                      • Special Effect - Create a special effect at Spawn_Point[TempInt] using SpawnString[TempInt]
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                      • -------- ------------------------------------------------ --------
                  • -------- ------------------------------------------------ --------
            • Else - Actions
              • -------- ------------------------------------------------ --------
              • -------- If there are no "waves" left --------
              • -------- we remove our location --------
              • -------- ------------------------------------------------ --------
              • Custom script: call RemoveLocation(udg_Spawn_Point[udg_TempInt])
              • -------- ------------------------------------------------ --------
              • -------- Recycles --------
              • -------- ------------------------------------------------ --------
              • Set Spawn_Index[Spawn_LOOP] = Spawn_Index[Spawn_Index_Size]
              • Set Spawn_Index[Spawn_Index_Size] = TempInt
              • Set Spawn_Index_Size = (Spawn_Index_Size - 1)
              • Set Spawn_LOOP = (Spawn_LOOP - 1)
              • -------- ------------------------------------------------ --------
              • -------- checks if there are any instances left --------
              • -------- if not we turn this trigger off --------
              • -------- ------------------------------------------------ --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Spawn_Index_Size Equal to 0
                • Then - Actions
                  • -------- ------------------------------------------------ --------
                  • Trigger - Turn off (This trigger)
                  • -------- ------------------------------------------------ --------
                • Else - Actions
                  • -------- ------------------------------------------------ --------
              • -------- ------------------------------------------------ --------


How to use this?!

Copy all the variables in the "apply" trigger, change them for your needs and you are good to go! Easy as that!

Have fun using this and sorry, hard to implent a good screenie of this but if mods want me to change screen or test map well then I have too :( but it shouldn't be necessary (A)

It was damn necessary to fix that screeny :/ ;), now fixed and the update is just about the test triggers, nothing about the actuall system.


v1.0 Released
v1.1 Fixed an awful bug as I used a useless variable in the filter trigger, also added the ability to create special effect on spawn
v1.1b Fixed Mod's request.



Change whatever you want in the system at your own risk and you have permission as long as you give credits to baassee when used :)

Have good day!

regards

~baassee

Keywords:
baassee, dondustin, spawn, system, MUI, support, type, units, angle, where, collision
Contents

Spawn System GUI v1.1b (Map)

Reviews
BPower: 12:20, 25th Feb 2016 Reason for re-review: This spawn system has been reported as not working by users to the moderation team. Fault finding: You made one of the most common mistakes in GUI coding. You transfered a location...

Moderator

M

Moderator

BPower:
12:20, 25th Feb 2016

Reason for re-review:
This spawn system has been reported as not working by users to the moderation team.

Fault finding:

  • You made one of the most common mistakes in GUI coding.
    You transfered a location handle from a scalar variable to an array of equal type.
    Displayed in code set systemLoc[index] = tempLocation.
    Then destroyed on the handle via RemoveLocation(tempLocation).
    You forgot that this has equal effect on the information stored on the array location variable.
    Finally the GUI wrapper for CreateUnitLoc takes an invalid location variable as argument and fails.
    JASS:
    function TheProblem takes nothing returns nothing
        set tempLocation = Location(0., 0.) 
        set systemLoc[index] = tempLocation
        call RemoveLocation(tempLocation)// Also affects systemLoc[index], as they are the same handle.
    endfunction
    function TheGoodSolution takes nothing returns nothing
        set tempLocation = Location(0., 0.)
        set systemLoc[index] = Location(GetLocationX(tempLocation), GetLocationY(tempLocation)) 
        call RemoveLocation(tempLocation)
    endfunction 
    function TheAcceptableSolution takes nothing returns nothing
        set tempLocation = Location(0., 0.) 
        set systemLoc[index] = tempLocation
        set tempLocation = null
    endfunction

We have to set your system back to need fix, because this is a critical flaw within your spawn system.
12:12 GMT, 1st Mar 2011
Bribe:

There are a lot of spawn systems but I have nothing against multiple flavors. Code is tight and no leaks. Approved.
 
Level 27
Joined
Jan 26, 2007
Messages
4,788
Jonny's and yours are written in vJass (vJass is very good... but you need JNGP and basic JASS knowledge for it).
I wouldn't recommend Alex' system at all.

It's a very simple system, well documented and I couldn't think of another function to add right now.
(Thanks for warning me about the documentation, it looked better when I removed it, but of course it is very useful for those who are still learning).

Of course, there are better spawn systems (as Anachron already pointed out), but I would still recommend this system for people who do not know JASS (let alone vJass), since it's a nightmare to import JASS-systems when you know nothing about it.
 
Last edited:
Level 25
Joined
Jun 5, 2008
Messages
2,572
This is by far, the best spawn system in GUI written on THW.

Only thing i can suggest is adding a possibility to create a special effect when a unit is spawned.

I tested the recycling of indexes, it works flawlessly and i couldn't spot any leaks.

This shows the exact format a system in GUI should follow and therefore it got my vote.

Surely not the newest idea but the executions works great and ALL GUI users should refer to this system not Alex's or JASS ones(in case they don't know jass that is).

Voting for aproval and rating it 5/5, great resource indeed.

[offtopic]

I don't kill people who don't use recycling indexing, i just point it out as a flaw.
 
Level 21
Joined
Nov 14, 2008
Messages
3,256
I got your point about the waves and it is complicated to predefine different waves. As this also does waves with the interval it does it with one unit type. Still I made it very easy to make the apply trigger as simple as possible and anyone can do it, almost
 
Level 27
Joined
Jan 26, 2007
Messages
4,788
Isn't this like my portal system?
Correction: isn't your portal system like this? (Your system was uploaded nearly a year after this).

And no, it isn't.
Your system is less GUI-friendly (having to type the rawcode of both the unit and the effect) and utilizes a completely different method to reach a comparable goal (yet still not the same).
 
The map has been reported to be not working. Sorry, can't check it myself right now.

But the "Apply" trigger has nothing to do or? It is just an example, but the "Filter" is the actualy apply trigger? ;D

Variables seem to have no prefix.
Also a generic and global "TempInt" is used, which is not perfect as it works with unit creation, and therfor can evaluate other functions in between.
^This can cause bug.

In the filter trigger:

  • Set Spawn_Point[TempInt] = SpawnTempPoint
  • ...
  • Custom script: call RemoveLocation(udg_SpawnTempPoint)
^This might cause bug, because the there are 2 pointers pointing on one object.
If the object gets removed only for one of it, the other pointer also points on the removed object. So it is gets invalid.
 
Top