This is probably a fairly simple yes-no question: (I suspect no)
Is there any way to create a random type of unit (out of all existing units) without assigning them all to variables?
It seems like that would be an extremely time-consuming process, especially if campaign units were involved.
Here's something I slapped together in about 30 minutes. It'll create a random Terran, Protoss, or Zerg unit.
So, you can just copy this and use it. If something's not included on the list (I didn't do Pygalisks, Interceptors, or Larvae for example) but you want to be able to spawn those units, then just add an entry to the switch function and increase the range of the random integer by 1
Also you can use different ranges to get race-specific random units. Terran = 1 - 23, Protoss = 24 - 38, and Zerg = 39 - 58
To make it just spawn one unit just tell it to spawn units of value 1000 and take out the big while loop. Doing that will basicly turn it into something life dgh64's trigger. (with less units, only includes non-caster melee units)
This is probably a fairly simple yes-no question: (I suspect no) Is there any way to create a random type of unit (out of all existing units) without assigning them all to variables? It seems like that would be an extremely time-consuming process, especially if campaign units were involved.
@TheSkunk2: Go
Nope.
Gotta put them in an array.
Best way I can think of off the top of my head is this:
Create an Integer variable set to a random number from 1 to however many units there are.
Then have a Switch function depending on the variable
If variable==1, create 1 Marine
If variable==2, create 1 Firebat
.....and so on. Time-consuming, I know. But, really, there are only about 20-30 units for each race, so less than 100 total....
There might be a way to do this using Galaxy. Find out what the variable type for Unit-Type really is (is it an int or a string?).
AFAIK there isn't a way to do this using GUI without a massive time-consuming process of creating the arrays.
Here's something I slapped together in about 30 minutes. It'll create a random Terran, Protoss, or Zerg unit.
So, you can just copy this and use it. If something's not included on the list (I didn't do Pygalisks, Interceptors, or Larvae for example) but you want to be able to spawn those units, then just add an entry to the switch function and increase the range of the random integer by 1
Also you can use different ranges to get race-specific random units. Terran = 1 - 23, Protoss = 24 - 38, and Zerg = 39 - 58
@caspersc: Go
Hmm... well... uh... I guess I wasted 30 minutes. Damn.
Wait, is there an easy way using code to say "I want a Terran unit"? If not, then at least my way is more versatile ;)
Do you truly want any random unit?
You could try out my SpawnUnitsOfValueTrigger http://www.sc2mapster.com/assets/spawn-units-value-trigger/
To make it just spawn one unit just tell it to spawn units of value 1000 and take out the big while loop. Doing that will basicly turn it into something life dgh64's trigger. (with less units, only includes non-caster melee units)