Please or Register to create posts and topics.

How to choose a random sound or message text?

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. :)

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

Use the "pickrandom" input.

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.

Thanks a lot.

And nice avatar image, NocturnalGhost!

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 :D

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

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 :D

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

Missed opportunity to rick-roll #12.

"Games are made out of smaller games ? turtles all the way down, until you hit the game that is so trivial and stupid it isn?t deserving of the name." --Raph Koster