Parented sound?

dragonbanshee

L1: Registered
Sep 21, 2014
7
0
So I'm not sure if this is possible, but Ive been wanting to make an ambient_generic "follow" a player such that only the player can hear it. This would be achieved by the player walking into a trigger_hurt and then the sound is parented to the player. If this is possible how would I go about doing it?

I've already tried using an env_entity_maker to create it but it doesn't seem to help.
 

Izotope

Sourcerer
aa
May 13, 2013
698
764
People nearby can still hear that sound.
If you want to make only one person to hear a sound, use a point_clientcommand with this input:

OnTrigger | clientcommand | Command | play directory/sound.extension
 

dragonbanshee

L1: Registered
Sep 21, 2014
7
0
People nearby can still hear that sound.
If you want to make only one person to hear a sound, use a point_clientcommand with this input:

OnTrigger | clientcommand | Command | play directory/sound.extension

This works fine, thanks a lot. Is there any way to stop the sound once someone leaves the trigger? Apparently "stop" isn't a command.
 
Mar 23, 2013
1,013
347
This works fine, thanks a lot. Is there any way to stop the sound once someone leaves the trigger? Apparently "stop" isn't a command.

If the play command is used again, the file from the previous command will stop immediately. So use the output again with a non-existing file

OnTrigger | clientcommand | Command | play rainbows
 

Izotope

Sourcerer
aa
May 13, 2013
698
764
I believe Valve has a file called null.wav which is empty
 

dragonbanshee

L1: Registered
Sep 21, 2014
7
0
If the play command is used again, the file from the previous command will stop immediately. So use the output again with a non-existing file

OnTrigger | clientcommand | Command | play rainbows

Oh cool, I didn't know that. Thanks a lot!


Another problem I'm running into: If I go into the trigger, go out, go in again, go out, and then go in again and go out, after the 3rd time the sound will not stop and will continue to play until it ends.

Also another problem is that when I die in the trigger, the sound will continue to play until it ends as well.
 

Izotope

Sourcerer
aa
May 13, 2013
698
764
OnStartTouch | clientcommand | Command | play sound
OnEndTouch | clientcommand | Command | play null
 

dragonbanshee

L1: Registered
Sep 21, 2014
7
0
OnStartTouch | clientcommand | Command | play sound
OnEndTouch | clientcommand | Command | play null
That's what I did. But I said that the problem is that the sound continues to play after I died inside the trigger, and after the second time of leaving and entering the sound continues.

Edit: Apparently it isn't just 2 times, it's completely random. And sometimes when I die inside of it the sound does stop, and other times it doesn't.
 
Last edited: