How to choose a random sound or message text?

Avatar
whupper
42 Posts
Posted Jan 16, 2008
Suppose I want to display a message or play a sound when the user destroys the cube in a cleanser. I know how to create the output to react to the box being dissoved and play a sound or display some text. But if I have a pool of sounds or a pool of text messages, how can I randomly select one?

The Portal game does this, for example, when a turret dies and picks one of several sounds to play.

(I suppose I could decompile a map and look, but I'm at work and can't wait until I get home to find out.

Advertisement
Registered users don't see ads! Register now!
Avatar
NocturnalGhost
200 Posts
Posted Jan 16, 2008
Replied 8 minutes later

http://developer.valvesoftware.com/wiki/Logic_case

Use the "pickrandom" input.

Avatar
Nacimota
345 Posts
Posted Jan 16, 2008
Replied 59 minutes later

whupper wrote:
...The Portal game does this, for example, when a turret dies and picks one of several sounds to play...

That's just the way the turret NPC is written, it has little to do with hammer.

Avatar
whupper
42 Posts
Posted Jan 17, 2008
Replied 7 hours later
Thanks a lot.

And nice avatar image, NocturnalGhost!

Avatar
NocturnalGhost
200 Posts
Posted Jan 18, 2008
Replied 1 day later
I'd post a link to the image that gave me the idea, but it didn't go down too well last time i did

Google "chell portal lawl" if you are really curious. (and over 18, hehe)

Advertisement
Registered users don't see ads! Register now!
Avatar
Hober
1,180 Posts
Posted Jan 21, 2008
Replied 3 days later

NocturnalGhost wrote:
I'd post a link to the image that gave me the idea, but it didn't go down too well last time i did

Google "chell portal lawl" if you are really curious. (and over 18, hehe)

Missed opportunity to rick-roll #12.