Hey guys, wanted to stop in and see if there was an easier way to do this (I'm sure there is, but I'm not too big of a programmer to know off the top of my head. :D )
I have 21 locations, and I want to roll the dice to decide which one to spawn something at. My most basic idea would be to setup 21 different If-then checks, and then spawn it in that location. While I'm sure it'd work, I can't help but think there might be a more elegant solution.
I also need to make sure subsequent spawns down try to spawn in the same area. While I could do that with checks of whether the spawned unit is in the region, I'm hoping there's a way to exclude the previously rolled numbers from the random generation. If that seemed confusing, I'll try to explain it in a different way:
"Spawn Something"
Roll between 1 and 21. Put the result in a variable.
Roll result = location spawned at (Locations are numbered 1-21)
"Spawn subsequent things"
Roll between 1 and 21. Put the result in a variable. If something is already spawned at the location, roll again.
Roll result = location spawned at.
For first one you should able to put them in an array and use your random int to choose the spot.Maybe there is also a way to put all regions in to an array with one click but i dont know how.
Example : MyRegionArray[RandomNumber]
For the second one i have an idea but i dotn think it is better then yours : )
Make Variable point and set array to 21 then set all the points to variable in a trigger (ex.Set Variable[1] = Spawn Point 1, Set Variable[2] = Spawn Point 2 etc etc)
then spawn ur units like this: Create X number of X units in Variable[Random integer between 1 and 21]
Hey guys, wanted to stop in and see if there was an easier way to do this (I'm sure there is, but I'm not too big of a programmer to know off the top of my head. :D )
I have 21 locations, and I want to roll the dice to decide which one to spawn something at. My most basic idea would be to setup 21 different If-then checks, and then spawn it in that location. While I'm sure it'd work, I can't help but think there might be a more elegant solution.
I also need to make sure subsequent spawns down try to spawn in the same area. While I could do that with checks of whether the spawned unit is in the region, I'm hoping there's a way to exclude the previously rolled numbers from the random generation. If that seemed confusing, I'll try to explain it in a different way:
"Spawn Something" Roll between 1 and 21. Put the result in a variable. Roll result = location spawned at (Locations are numbered 1-21)
"Spawn subsequent things" Roll between 1 and 21. Put the result in a variable. If something is already spawned at the location, roll again. Roll result = location spawned at.
Thanks :D
Consider i am new to the map making pls
For first one you should able to put them in an array and use your random int to choose the spot.Maybe there is also a way to put all regions in to an array with one click but i dont know how.
Example : MyRegionArray[RandomNumber]
For the second one i have an idea but i dotn think it is better then yours : )
@Lascero: Go
Make Variable point and set array to 21 then set all the points to variable in a trigger (ex.Set Variable[1] = Spawn Point 1, Set Variable[2] = Spawn Point 2 etc etc)
then spawn ur units like this: Create X number of X units in Variable[Random integer between 1 and 21]
Simple? yes :D
Nevermind, got that solved.