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
@xDarkZeratulX: Go
First: no need to bump every minute. A Forum has some kind of response time ;-)
First step:
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).
2:
Make a new trigger:
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).
I am largely inactive, but I am still around. Feel free to poke me if you need some help, just be warned that I only really come back if I need help and/or if I'm posting a new map/library.
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.
I am largely inactive, but I am still around. Feel free to poke me if you need some help, just be warned that I only really come back if I need help and/or if I'm posting a new map/library.
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
Blank
................................................................................. step by step maybe? :X
@xDarkZeratulX: Go
To celebrate my return, I made you an example.....
Welcome Back ANd Thank You Very Much
im stupid yeah but how to put those triggers into my predone map >.<
Bump
@xDarkZeratulX: Go First: no need to bump every minute. A Forum has some kind of response time ;-)
First step: 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). 2: Make a new trigger:
and so on...
now make a second trigger
finished.
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))
@xDarkZeratulX: Go maybe this helps http:www.sc2mapster.com/wiki/galaxy/triggers/create-units-with-point-facing/ 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
@xDarkZeratulX: Go
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).
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.
i cant find UnitArray in the menu
@xDarkZeratulX: Go
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.
@xDarkZeratulX: Go
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) else
if: Unit type == 1 then: Unit - create zealotfor player (triggering player)
etc.