i couldnt understand the other posts about arrays and smth cause im a noob but how to make a trigger that spawns a random unit of a type (Light/Armored) at a region
step by step maybe? :X
To celebrate my return, I made you an example.....
KageNinpo = SN
DialogLeaderboard & TeamSort
Welcome Back ANd Thank You Very Much
im stupid yeah but how to put those triggers into my predone map >.<
First: no need to bump every minute. A Forum has some kind of response time ;-)
Create a new Variable Array of type Unit and name it RandomUnit. The size names the amount of units you want to be able to spawn (I choose 21).
Make a new trigger:
Set Variable RandomUnit = Space Marine
Set Variable RandomUnit = Zergling
Set Variable RandomUnit = Zealot
Set Variable RandomUnit = Sentry
Set Variable RandomUnit = Carrier
Set Variable RandomUnit = Queen
and so on...
now make a second trigger
int i =0;
i = random int between 0 and 20
Spawn 1 unit (RandomUnit(i)) for player 1 in region (center of Map) facing somewhere.
i cant get the last part done which action am i supposed to click create unit with default facing? theres no option behind unit to say (randomUnit(i))
maybe this helps
I didnt write the exact name, dont have Galaxy on this PC so it was a little bit of pseudocode, but this is the action I ment.
errrr im stupid soooo really idk how to do it :X
I was going to refrain from posing because I figured you'd get help from someone else, but let me see if I can help.
Firstly Mojo was partially right, you need to create a unit array and set each unit that could conceivably be spawned to said array.
Then what you do is create a spawn trigger, set it to run whenever a round is supposed to start (if no rounds, a periodic trigger would work as well).
Set a local variable and call it randomnumber (any name will do).
Then set randomnumber to a random number between 0 and the maximum number of units in your array (you could automate this process or do it manually, do it manually to begin with however).
Pick each integer.
then do an if then else (switch would work, but for a beginner this will make more sense).
If randomnumber is = picked integer
then Create X units UnitArray[Picked Integer] at SpawnPoint.
Skip Remaining Actions/Break
else wait .1 seconds.
I haven't tested this (obviously) but I have done similar things before; it should work for your purposes.
EDIT: actually, you could do this as well to be even more efficient:
Do the whole randomnumber bit, then just do
Create X units UnitArray[randomnumber] at SpawnPoint.
This should be much more efficient.
My Addition to All Those Leveling Assets Out There.
My Website which contains a list of notable SCII Maps and FtP games and my Journal.
i cant find UnitArray in the menu
Create a global variable. Select it's type as unit type, check the array box and set it to the maximum number of units you'll think you'll need to spawn.
and yes, the random number part is correct.
Why arnt you using the sample I made you? If you cant figure out how it works pm me.
You just have to have both maps open at the same time and copy and paste all the trigger stuff in.
For the function I made you
you just do
create 1 RandomUNit for player 1 facing default
I made a quite easy random system in my map.
Local variable: Unit type = 0<integer>
actions: Variable - Set Unit type = (Random interger between 0 and 10)
General if then do else do
if: Unit type == 0
then: Unit - create zergling for player (triggering player)
if: Unit type == 1
then: Unit - create zealotfor player (triggering player)
You must login to post a comment. Don't have an account? Register to get one!