Is it possible to add more than one unit to the same array position? Like if I have an array[2], then on [0] I want 2 marines, [1] I want 1 hydralisk and [2] I want 1 zealot and 1 photocannon. Is that possible?
You can do this with a Unit Group array, but Unit Group functions a bit differently from Unit, so it may or may not work depending on what you're trying to accomplish.
When game initialize I have a region where I want to spawn some mobs, but I want to make the mobs different from each time you play (with a maximum), so I figured I could create an array that contained these different sets of mobs, and I would make a trigger pick a random number from that array and spawn that certain set of mobs.
So in one gameplay there might be 2 marines, the next gameplay there might be 1 photocannon and one zealot. I got it working except I can't add more than one unit to each array position.
Create a function (action definition) and call it with a random integer and a location as parameter.
Then create your possibilities based on the parameter value like:
1: 2 Marines
2: Photon cannon + Zealot
3: nothing
4: Ultralisk
5: Tree
6: Archon + Toilet
Hm, okay so I create a new Action Definition, which has the Return Type: Interger[7] ? After that I don't know how, do you care to elaborate a bit more ? :S
Action Definitions don't return anything, they do things.
What you want is an action definition set up somewhat like this (my syntax might be a bit different from the editor:)
Parameters:Random(integer):<default>Randomintegerbetween1and6Actions:Switchactionsdependingon(Random)CasesIf1Create2TerranMarineat(spawnpoint)If2Create1Zealotat(spawnpoint)Create1PhotonCannonat(spawncannon)If3Displaymessage:"LULZ NO UNITS DIS TIME"to(allplayers)If4Create1Ultraliskat(spawnpoint)etc...
Note: By keeping Random a parameter instead of a variable you can override the random effect when you want to spawn a specific unit group.
Is it possible to add more than one unit to the same array position? Like if I have an array[2], then on [0] I want 2 marines, [1] I want 1 hydralisk and [2] I want 1 zealot and 1 photocannon. Is that possible?
@GodsFury: Go
You can do this with a Unit Group array, but Unit Group functions a bit differently from Unit, so it may or may not work depending on what you're trying to accomplish.
When game initialize I have a region where I want to spawn some mobs, but I want to make the mobs different from each time you play (with a maximum), so I figured I could create an array that contained these different sets of mobs, and I would make a trigger pick a random number from that array and spawn that certain set of mobs.
So in one gameplay there might be 2 marines, the next gameplay there might be 1 photocannon and one zealot. I got it working except I can't add more than one unit to each array position.
I am rather new to triggers :S
I still haven't figured it out, so any help is still appreciated :/
Create a function (action definition) and call it with a random integer and a location as parameter.
Then create your possibilities based on the parameter value like:
1: 2 Marines
2: Photon cannon + Zealot
3: nothing
4: Ultralisk
5: Tree
6: Archon + Toilet
@Ahli634: Go
Hm, okay so I create a new Action Definition, which has the Return Type: Interger[7] ? After that I don't know how, do you care to elaborate a bit more ? :S
Action Definitions don't return anything, they do things.
What you want is an action definition set up somewhat like this (my syntax might be a bit different from the editor:)
Note: By keeping Random a parameter instead of a variable you can override the random effect when you want to spawn a specific unit group.
@BasharTeg: Go
This makes sense :D All though why doesn't it run when my game initialize?
I tried some things, but nothing worked.