View Full Version : Achieving "random factor" in SC maps
mutalisk46802
05-07-2006, 1:03 PM
I have always thought about how to make things random while making starcraft maps, but could never figure out how to do it. I know its possible because on a map Poker TD there is a random factor with dealing out the cards. If anyone knows could you please explain it because I have no idea how to make things random in starcraft maps.
*Errm* Using random on switches amongst triggers? (Or using sustom scores.) ;) But I warn ya it's hellish troublesome n' an workload 'till kingdom come... as I can state that from a map concept of mine (that is still getting worked over). :P
mutalisk46802
05-07-2006, 1:27 PM
Using random switches amongst triggers? How do you do that?
What number do you need to randomize?
Let's say you need to randomize a number between 1 and 8; Make a trigger with 'Always' in conditions and a preserve trigger. Tell that trigger to randomize three switches of your choice. Make sure you have hyper triggers.
Than just create 8 different triggers, with these three switches in the conditions. For the first trigger make it so that it plays if all three switches are cleared. For the second, it they're Set, Cleared, Cleared; for the third: Cleared, Set, Cleared.
etc for all 8 possibilities.
mutalisk46802
05-07-2006, 2:48 PM
Tell that trigger to randomize three switches of your choice.
Ok so lets say I want to make it randomly from 1-20. First I make a trigger with always as the condition and preserve trigger in action. That same trigger i must "tell to randomize three switches of my choice". How do i go about telling it to randomize three switches.... After that part I just do what you said. Could you please show that in a more understandable way, I kind of get it but not enough to actually be able to do it.
Ok, I'll try to make it simple... let's say you want to randomize a number between 1 and 2.
I'll make a trigger that constantly randomizes 1 switch. That switch will now always either be set or cleared.
I'll make one trigger that creates a zergling if the switch is set, and one that creates a zealot if the trigger is cleared. This will make it so that in 50% of the times a zergling will appear, and in the other 50% a zealot will appear.
If I had used two switches, I would've been able to do up to 4 different options, because - lets think of 'Set' as '1' and 'Cleared' as 0, k? So what can we get per randomization?
00
01
10
11
That's four options. I create a trigger per option with what I want to happen for that.
For 20 options, you'll need 5 switches. Than the options are:
00000
00001
00010
00011
00100
00101
00110
00111
etc... there is a total of 32 options. For the last 12, make them do nothing (don't even create a trigger for them) and it'll be as if they don't exist, so that if you get a roll for any of them nothing will happen, and the trigger that constantly randomizes the switches will keep randomizing until you get one of the first 20 'used' options.
Sub-Focus
05-07-2006, 3:40 PM
I know one way of moving random units... Just tell it to move a number of units, and select any units at whatever location, and it will just move random units from there... Not really all that helpful but oh well.
mutalisk46802
05-07-2006, 4:23 PM
Oh i see now. You make it so a switch is being constantly turned off, then on, then off, then on. Then you make 2 other triggers. each trigger is like you said it, you get a zergling if the switch is on (set) and if its off then you get a zealot. Thanks Aqotrooper, that helped me a lot and Sub-Focus that helped too, but your picture freaks me out everytime i see it.
Sub-Focus
05-07-2006, 4:33 PM
Everyone fears the clown... I guess I'll have to tone it back down a bit.
vBulletin® v3.7.2, Copyright ©2000-2008, Jelsoft Enterprises Ltd.