StarCraft® II

Perodic Unit Creation Help

I'm needing help with spawning units at a point like in footman wars in WC3 your unit type spawns lets say every 20 seconds im wanting to do the same thing and this is the way i have the trigger set up

Events
Timer - Every 20.0 seconds of Game Time
Conditions
(Button Pressed) == Human Base
And
Conditions
(Owner of (Triggering unit)) == 1
Actions
Unit - Create 3 Basic Marine for player 1 at Player1 Unit Spawn using default facing (Ignore Placement)

But when i test it i keep getting a error

(Also how do i change this for when lets say the player upgrades from basic marine to marine spawn the marine every 20secs rather than the basic marine?)
Reply Quote
Conditions
(Button Pressed) == Human Base

This is probably what's going wrong. That condition will only work with something like a Button Is Pressed event. Just delete that condition altogether, and perhaps replace it with a Unit Is Alive action to test if the base is still present. Also, by default, the Conditions section works as an And condition at the beginning, so the extra one you put in there is overkill.
Reply Quote
But if i get rid of the condition how does it know what to spawn since the players can also choose a Alien and Demon base.
Reply Quote
01/30/2013 08:50 AMPosted by Palamani
and perhaps replace it with a Unit Is Alive action to test if the base is still present.

Also the base isnt alive at the start of the game the player chooses from the 3 kinds above.
Reply Quote
You are supposed to have a different trigger to remember the button press into a variable. A variable being you can remember data and recall it later on.

You might want a variable of type integer to store a non-decimal number. For example 1 = Human Base, 2 = Alien Base, etc.

***Trigger 1***
Event
Player 1 pressed a button
Conditions
(Button Pressed) == Human Base
Actions
integerVariablePlayer1Base = 1 //affects 1 to the variable integerVariablePlayer1Base

***Trigger 2***

Events
Timer - Every 20.0 seconds of Game Time
Conditions
integerVariablePlayer1Base == 1 //Checks if variable is equal to 1
Actions
Unit - Create 3 Basic Marine for player 1 at Player1 Unit Spawn using default facing (Ignore Placement)

Note : Your condition about (Owner of (Triggering Unit)) won't work with a "Every X seconds" event. It needs to be used with "Unit enters region", "Unit is attacked" and such similar events.

Yes, if it implies that you will have to duplicate quite a few triggers to cover all players.

However, it's possible to greatly limit the work with array variables and loops.

Exemple : integerVariableBases[] having 12 spaces for each of the 12 players and using it like :

//Spawns human units for all players (player 1 to player 12) having chosen human race
For loop integerVariablePlayer = 1 to 12
if (integerVariableBases[integerVariablePlayer] == 1)
***Spawn X units of Human race for player integerVariablePlayer***
end if
End Loop

Since I presume you don't know much of variables and loops in the first place, I strongly suggest you learn variables and array variables off programming tutorials of anything. Simple tutorials of Visual Basic .NET variables and loops should be good enough to understand the principles.

Sorry but I simply don't feel like write a truly complete tutorial about variables and loops.
Edited by Honejasi on 1/30/2013 7:53 PM PST
Reply Quote
Thank you so much i understand now and have it working!
Reply Quote

Please report any Code of Conduct violations, including:

Threats of violence. We take these seriously and will alert the proper authorities.

Posts containing personal information about other players. This includes physical addresses, e-mail addresses, phone numbers, and inappropriate photos and/or videos.

Harassing or discriminatory language. This will not be tolerated.

Forums Code of Conduct

Report Post # written by

Reason
Explain (256 characters max)
Submit Cancel

Reported!

[Close]