Spawn system
From Starcraft 2
The idea is pretty simple: place Points where you want your units to spawn and then use random integers to randomize the spawn.
Trigger Reference
http://vgshorts.com/BBCode/BBCode3.php?ID=97
Spawn system
Events
Timer - Every 15.0 seconds of Game Time
------- This is the interval of time at which the units will be spawned.
Local Variables
Unit Type = 0 <Integer>
Random Point = 0 <Integer>
Selected Point = No Point <Point>
Conditions
Actions
Variable - Set Random Point = (Random integer between 1 and 5)
General - If (Conditions) then do multiple (Actions)
If Then Else
General - Else if (Conditions) then do (Actions)
Else If
Random Point == 1
Then
Variable - Set Selected Point = Point 001
General - Else if (Conditions) then do (Actions)
Else If
Random Point == 2
Then
Variable - Set Selected Point = Point 002
General - Else if (Conditions) then do (Actions)
Else If
Random Point == 3
Then
Variable - Set Selected Point = Point 003
General - Else if (Conditions) then do (Actions)
Else If
Random Point == 4
Then
Variable - Set Selected Point = Point 004
General - Else if (Conditions) then do (Actions)
Else If
Random Point == 5
Then
Variable - Set Selected Point = Point 005
Variable - Set Unit Type = (Random integer between 1 and 6)
------- The use of If-Then-Else is just to show that both methods work.
General - If (Conditions) then do (Actions) else do (Actions)
If
Unit Type == 1
Then
Unit - Create 1 Zealot for player 0 at Selected Point using point facing (Ignore Placement)
------- Notice the point at which the unit is created is the "Selected Point" Point variable.
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
Unit Type == 2
Then
Unit - Create 1 Sentry for player 0 at Selected Point using point facing (Ignore Placement)
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
Unit Type == 3
Then
Unit - Create 1 Baneling for player 0 at Selected Point using point facing (Ignore Placement)
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
Unit Type == 4
Then
Unit - Create 1 Roach for player 0 at Selected Point using point facing (Ignore Placement)
Else
------- Notice I am not using the integers 5 and 6. This is simply because I wanted those two integers to represent a "No spawn" situation. More empty integers you'll have like this, less chances the spawn system will actually spawn a unit. This is just a personnal choice.
Please take note that there are comments within the trigger above.
