SC2Mapster Wiki
Explore
Main Page
All Pages
Interactive Maps
navigation
Main page
Community portal
Recent changes
Random page
Help
SC2MAPSTER
News
Maps
Assets
Teams
Authors
Forums
Paste
Gamepedia
Gamepedia support
Report a bad ad
Help Wiki
Contact us
FANDOM
Fan Central
BETA
Games
Anime
Movies
TV
Video
Wikis
Explore Wikis
Community Central
Start a Wiki
Don't have an account?
Register
Sign In
Sign In
Register
SC2Mapster Wiki
1,003
pages
Explore
Main Page
All Pages
Interactive Maps
navigation
Main page
Community portal
Recent changes
Random page
Help
SC2MAPSTER
News
Maps
Assets
Teams
Authors
Forums
Paste
Gamepedia
Gamepedia support
Report a bad ad
Help Wiki
Contact us
Editing
Tutorials/Tower Defense/Basics of Point Arrays
(section)
Back to page
Edit
VisualEditor
View history
Talk (0)
Edit Page
Tutorials/Tower Defense/Basics of Point Arrays
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===More Tricks=== **Q: What if I want to spawn more than one unit?** A: Well you certainly can't just increase the number in the Create Unit function. That would result in a giant blob of units fighting each other for the spotlight as they hobble along the path, kicking each other in the shins along the way and creating nasty glitches at the Points. It would seem that the only way would be to create a complex system of Timers in order to spawn a large number of units, but only one of the time. But wait, what's that in the sky? It's our good friend from Computer Science 101, Recursion! Recursion is the act of making a function call itself a number of times, eliminating the need for complex systems. In layman's terms, it allows us to call a particular function we need as many times as we like, without the need for crazy while loops. In order to use Recursion, at the end of your Unit Create trigger, add a wait function. This will be the time it takes between spawns. One or two seconds is usually good. "Trigger - Run (Current Trigger)". This is all well and good, except as it is right now, it will run forever! To remedy this, we need to know how many units we've spawned, and be able to stop the recursion when we reach a certain number. Create a global integer variable and name it "NumberOfUnits". Then, each time you create a unit, increment this variable by one. Then add an If Then Else at the end of your trigger and move the "Run (Current Trigger)" inside the Then part. In the If part, compare your NumberOfUnits to the max number of units you want to spawn. In my program, I wait 1 game second between spawn, and the max number of spawns is 15. [http://www.sc2mapster.com/media/attachments/11/792/7.PNG SpawnWave "NumberOfUnits"]
Summary:
Please note that all contributions to the SC2Mapster Wiki are considered to be released under the CC BY-NC-SA
Cancel
Editing help
(opens in new window)
Follow on IG
TikTok
Join Fan Lab