Randomizing outputs

Avatar
Keeve
6 Posts
Posted Oct 29, 2011
I've searched for this, but haven't found anything. I know logic_case can help with randomizing, but I can't figure out how to make it work for this situation:

I have 3 separate buttons, that turn on 3 separate lights. Currently I have it hard-coded that button_1 turns on light_1, button_2 turns on light_2 and button_3 turns on light_3. What I want to do is randomly select which button turns on which light each time the map is run. For instance the first time you load the map you get button_1 = light_2, button_2 = light_1, button_3 = light_3.

Then if you load the map again, you get a completely different combination, but always with each unique button controlling a different unique light.

Any suggestions are highly appreciated.

Advertisement
Registered users don’t see ads! Register now!
Avatar
Rubrica
305 Posts
Posted Oct 29, 2011
Replied 19 minutes later
Create nine logic relays, each one setting up the buttons with different combinations, using the AddOutput input. The possible combinations are as follows:

Button -> Light
1 -> 1
1 -> 2
1 -> 3
2 -> 1
2 -> 2
2 -> 3
3 -> 1
3 -> 2
3 -> 3

Next, create a logic case, and add nine 'OnCase' outputs, each triggering one of the relays. Now, create a logic auto, with an output of OnMapSpawn, [nameoflogiccase], PickRandom. Tis should pick one of the nine setups for you; the button layout ha seen randomised, but will now no longer be changed.

Avatar
ChickenMobile
2,460 Posts
Posted Oct 30, 2011
Replied 1 day later
For some reason I think that having 9 relays is a tad sloppy.

I would rely on a script to make it easier.