Creating Random Effects with a Logic_Case

- By Stadric
This tutorial was last updated on Jan 10, 2006.

For this example, we're going to use buttons, we'll unlock one at random, then lock them all, then unlock another. First of all, make a room with three buttons(func_button) and an info_player_start in it.

Give your buttons these properties:
Locked Sound: Access Denied
Unlocked Sound: Access Granted
Flags:
Don't move
Use Activates

Name each of the buttons, I named them button1, button2, and button3.

Now we need to give our buttons to do something, like open a door. Place a prop_door_rotating somewhere in your map, and give it these properties:
World Model: models/props_c17/door01_left.mdl
Flags:
Ignore Player +USE

Now hold down shift and drag the door somewhere, then do once more, now you should have three doors, give each a name. I named mine door1, door2, and door3

Now give your buttons outputs, for button1:


for button2:


for button3:


Now make a logic_case and give it a name, I named mine case.

Now add these outputs to your logic_case:


Now we need something to make the logic_case randomly choose a button to unlock. We'll use a logic_timer. Give your logic_timer these properties:
Refire interval: 5

Give this output to your logic_timer:


Now all of the doors will be closed so that when you press a button, they'll all be ready to open again, and all of the buttons will be locked, and ready to be unlocked again.

When a logic_case receives a PickRandom input, it randomly chooses one of the OnCase outputs that have been set. We set three of them, so it will randomly choose between the three cases, and unlock one of the buttons accordingly, so that we can open a door with it.

Compile your map and run it.



Still need help? Ask your questions in one of our HELP FORUMS
Post A Comment
Name:
Email: Links Not Allowed In Comments
Comment:
What is the capital of France? Need Help?
Comments
Vitor - Nov 22, 2006
I guess this could be used in conjuction with a "logic_auto" to randomize doors at a map spawn. Interesting! Thanks!
All original content ©2006 EditLife.net. All Rights reserved. All files property of their rightful owners.
Get Firefox! Get Thunderbird! Get Notepad++!