Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Create Random Unit Within Race
Create Random Unit Within Race
Mar 6 2008, 10:20 pm
By: Polantaris  

Mar 6 2008, 10:20 pm Polantaris Post #1



Hi. I just recently decided to remake a map my brother made a while back that was a lot of fun, but I do not know how to do the following thing: When you step on a beacon with a Terran Civilian, I want to replace that civilian with a random unit from the race whose beacon that you stepped on. For example, if you step on a Terran Beacon, your Civilian becomes a Marine, or it becomes a Battlecruiser. Is there a way to set a random unit to be created in SE?



None.

Mar 6 2008, 10:27 pm Impeached Post #2



http://www.maplantis.org/index.php?wiki=122

That should tell you all you need to know about random results.



None.

Mar 6 2008, 10:35 pm y10k Post #3



There are a lot of ways to randomize
1. switches: randomize switch, you can do random 2-4-8-16-32-64... with them and depending on switch states you create the unit.
2. Death counting. Always/Give 1 death , and if DC is 1 create marine, DC is 2 create BC, DC is 3 create vulture or anything, after last unit, reset DC.
3. Circling units somewhere.

Use an other death counter(DC2) for race marker 1: toss, 2: terran, 3: zerg depending on which baecon you move.

switch 1 is set
switch 2 is set
switch 3 is set
DC2 is exactly 1

create a dragoon
remove civilian

switch 1 is set
switch 2 is set
switch 3 is cleared
DC2 is exactly 1

create a scout
remove civilian

switch 1 is set
switch 2 is set
switch 3 is set
DC2 is exactly 2

create a marine
remove civilian



None.

Mar 6 2008, 10:44 pm Polantaris Post #4



Ah thank you. I've been reading the "Multi-Switch" option but I am wondering: Where would I set them to randomize the switches? Since in this map the beacons will be being used multiple times by multiple players, I'm going to need to randomly change them on call.

To y10k: There will be 3 beacons, one for each race. When the player steps on it it will randomly create the unit based on which race's beacon they stepped on.



None.

Mar 6 2008, 10:49 pm who Post #5



so it might be like this:

player brings 1 unit to terranbeacon
"terran is clear"
set switch "terran"
randomize switch 1
randomize switch 2
randomize switch 3

then have the results triggers; for example:

"terran" is set
switch 1 is clear
switch 2 is clear
switch 3 is set
create 2 marine
clear "terran"

then preserve of course
Make sure you use some sort of variable as a condition in your results triggers (set by the trigger called when a unit is brought to the beacon), so your preserved triggers don't fire multiple times



None.

Mar 7 2008, 1:22 am Polantaris Post #6



if I make an
Always;

Randomize Switches
Wait
Preserve
will it just keep randomizing the switches?



None.

Mar 7 2008, 1:33 am who Post #7



yes it would, but i suggest removing the wait, because you'll probably get some problems due to it. So just have that trigger running all the time, and set the race switch after the unit gets on the beacon. Have the creation triggers only execute if the race switch is set (then clear it) and it should work.



None.

Mar 7 2008, 1:40 am FooFighters Post #8



I think it would be easier to use a counter... ie, Player 12 has #Minerals, create 1 Marine at "Terran." etc... thats how i would do it without as much triggers as those Random Switches

then use hypers to make the thing go up 12 per second, make it go back to 0 at a certain mineral, and minerals would become a thing to have really random results



None.

Mar 7 2008, 2:03 am Polantaris Post #9



I added the Wait because I was assuming it would cause performance issues seeing as how its an older game. I just removed it, but for the time being I got the first player to work with all of the Terran units (besides the Dropship, cause its completely useless for what I'm doing).

The map is going to be basically a killing map. Every player has 3 beacons, one for each race, at each of the 8 sides of the map. They bring the civilian they start with to the corresponding beacon, and they get a random (Within use) unit from that race. Useless things like the Overlord, Dropship, and Shuttle will not be used, as they will not work. The objective of the map is to send whatever you get out on a rampage and destroy as many enemies as possible before you die yourself. There will be a counter of kills, and whoever has the most kills after a set amount of time wins. You will have all upgrades and techs (lv 3 in all trees) so there isn't any worries about that, but of course some units will have superiority over others. For example, if you get a scout, it might be a good idea to run after Vultures, or Lurkers or the like as they cannot attack you.
Back in the days when SC first came out, my brother created this map back then, and we no longer have any track of it. It was quite fun, and I feel like remaking it, and am doing as such.

As I said, the Terran part is working for the first player (XD). I'm going to incorperate computers into the map for people who dont do it with human players, I'll probably release it in like 4 forms, multiples of 2s for computers (None, 2, 4, and 6).

Ichigo: The mineral idea won't work because I am probably going to give you the requirement to make your Interceptors and other maintainable items when you get Carriers/Reavers/whatever. I could do it for Gas, but the random switch thing seems to be a better idea on my side.

On the tutorial it said to make a trigger that resets the switches if the right values weren't found. I found it easier just to add that Always, and just let you sit on the Beacons until it morphs you into whatever.

Oh and about the race switch thing: I just have it so that it kills your Civilian when you get a unit, and when you die, you get a new one.



None.

Mar 7 2008, 8:59 am NudeRaider Post #10

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

The most efficient way to do it is using just 1-4 switches (depending on how many outcomes you need) and randomize them all the time with a separate trigger owned by all players.
There's no need to set a switch for the race of the beacon. In fact that could cause trouble if 2 players step on their beacons the same time. Make triggers like this: (You'll need <number of players> * <number of outcomes> * <number of races> triggers, but I'm showing only 2 examples)

Player 1
Conditions:

Current Player brings at least 1 Civilian to 'T1' (T1 = Terran beacon of Player 1)
Switch 'Random1' is set
Switch 'Random2' is cleared
... (check for more switches when you need more outcomes)
Actions:
Kill 1 Civ for current player at 'T1'
Create 1 Marine for current player at 'T1' (Marine = outcome switch R1 = 1 / R2 = 0)
preserve trigger


Player 2
Conditions:

Current Player brings at least 1 Civilian to 'Z2' (Z2 = Zerg beacon of Player 2)
Switch 'Random1' is set
Switch 'Random2' is set
... (check for more switches when you need more outcomes)
Actions:
Kill 1 Civ for current player at 'Z2'
Create 1 Hydralisk for current player at 'Z2' (Hydralisk = outcome switch R1 = 1 / R2 = 1)
preserve trigger




Mar 7 2008, 7:26 pm Polantaris Post #11



It's not that much of a problem if 2 people activate the same exact beacon at the same time, they will just probably get the same unit. When I was doing the first 4 players, I didnt set the switch activations in the same way, because it doesn't really matter. What does matter is that every unit for every race (within reason) is possible of being spawned. Everything except the useless units are being randomized into it, and the extra switch outputs don't do anything, so your Civilian sometimes just sits around alittle longer, which doesn't matter because he's invincible.
What I mean is that (I have 4 switches)
When all 4 switches are cleared:
If you are stepping on a Terran Beacon at this time, you turn into a Marine
If you are stepping on a Zerg Beacon at this time, you turn into a Zergling
If you are stepping on a Protoss Becaon at this time, you turn into a Zealot
I have all the switches randomizing at all times, so there's almost no chance that that will happen, but if it does, oh well. Like I said though, some of the players have the outcomes alittle different because I was doing them differently so it's possible that all cleared for Zerg gets you a Mutalisk instead of a Zergling if you are player 3.



None.

Mar 7 2008, 7:45 pm who Post #12



RP-ichigo's method will also work with a death counter, if minerals are being used.



None.

Mar 7 2008, 9:32 pm NudeRaider Post #13

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

Quote from Polantaris
It's not that much of a problem if 2 people activate the same exact beacon at the same time, they will just probably get the same unit.
Yes, Player 1 steps on the Terran beacon and gets a marine, Player 2 steps on the Zerg beacon and gets a Marine too. -.-

Quote from Polantaris
When I was doing the first 4 players, I didnt set the switch activations in the same way, because it doesn't really matter. What does matter is that every unit for every race (within reason) is possible of being spawned. Everything except the useless units are being randomized into it, and the extra switch outputs don't do anything, so your Civilian sometimes just sits around alittle longer, which doesn't matter because he's invincible.
What I mean is that (I have 4 switches)
When all 4 switches are cleared:
If you are stepping on a Terran Beacon at this time, you turn into a Marine
If you are stepping on a Zerg Beacon at this time, you turn into a Zergling
If you are stepping on a Protoss Becaon at this time, you turn into a Zealot
I have all the switches randomizing at all times, so there's almost no chance that that will happen, but if it does, oh well. Like I said though, some of the players have the outcomes alittle different because I was doing them differently so it's possible that all cleared for Zerg gets you a Mutalisk instead of a Zergling if you are player 3.
Really there's no need to go through all that fuzz. Just randomize always and you always have different results. Also there's no need to fear about cpu usage its absolutely negligible (except if you intend to do 1 trillion randomizations per second :P).

There are many other correct solutions (posted above), but I posted the most simple and efficient one because I had the feeling there was some confusion about how to do it best.

Quote from someone09
RP-ichigo's method will also work with a death counter, if minerals are being used.
No, his method won't work either way because he is using P12. P9+ can't have their DCs or Resources modified.

Post has been edited 1 time(s), last time on Mar 7 2008, 9:44 pm by NudeRaider.




Mar 7 2008, 10:08 pm Polantaris Post #14



Quote from NudeRaider
Quote from Polantaris
It's not that much of a problem if 2 people activate the same exact beacon at the same time, they will just probably get the same unit.
Yes, Player 1 steps on the Terran beacon and gets a marine, Player 2 steps on the Zerg beacon and gets a Marine too. -.-

Actually, no.
Each Beacon is handled by a different Location, and all use the same switches
All the beacons use a Bring command as well as the switch checks, 4 cleared on the terran beacon gives a different result than 4 cleared on the zerg beacon, and something else than 4 cleared on the protoss beacon.



None.

Mar 7 2008, 10:23 pm NudeRaider Post #15

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

Quote from Polantaris
Quote from NudeRaider
Quote from Polantaris
It's not that much of a problem if 2 people activate the same exact beacon at the same time, they will just probably get the same unit.
Yes, Player 1 steps on the Terran beacon and gets a marine, Player 2 steps on the Zerg beacon and gets a Marine too. -.-
Actually, no.
[...]
I know. Ofc you can (and should) use only 1 set of switches for the randomization.
I was referring to an extra switch for the RACE (which was someone09's proposal).
Quote from NudeRaider
There's no need to set a switch for the race of the beacon. In fact that could cause trouble if 2 players step on their beacons the same time.
Well however, we both agree on NOT using a race switch and rather use the location for the condition, so there's no need to discuss this further. ;)




Mar 7 2008, 10:24 pm Polantaris Post #16



Ah okay, I mis read. My bad =)



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[03:08 pm]
Oh_Man -- example of wat u mean?
[05:59 am]
NudeRaider -- *is
[05:17 am]
NudeRaider -- despite all its flaws the sound design its fantastic
[10:29 pm]
Oh_Man -- homeworld 3 = massive disappointment
[2024-5-14. : 10:05 am]
Moose -- ya
[2024-5-14. : 5:23 am]
zsnakezz -- yes
[2024-5-12. : 8:51 pm]
l)ark_ssj9kevin -- Are you excited for Homeworld 3?
[2024-5-12. : 8:44 pm]
l)ark_ssj9kevin -- Hi Brusilov
[2024-5-12. : 4:35 pm]
O)FaRTy1billion[MM] -- Brusilov
Brusilov shouted: Hey, what happened to EUDDB? Is there a mirror for it somewhere? Need to do a little research.
my server that was hosting it died
[2024-5-10. : 8:46 pm]
NudeRaider -- Brusilov
Brusilov shouted: Hey, what happened to EUDDB? Is there a mirror for it somewhere? Need to do a little research.
https://armoha.github.io/eud-book/
Please log in to shout.


Members Online: Ultraviolet, Roy, Wing Zero