Raised This Month: $51 Target: $400
 12% 

EmitSoundToClient Distance


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 09-02-2015 , 12:18   EmitSoundToClient Distance
Reply With Quote #1

So I run this function:

PHP Code:
    EmitSoundToClient(iClientSOUND_FILE_NAMEiEntity); 
where iClient is the client index and iEntity is an entity they touched. The sound does play correctly when they touch said entity, but the fading distance is way too high. In other words, I want the sound to fade away quicker with increasing distance. So if the current fade distance is 300 HU (just pulling a number out of my ass), where 301+ HU away from the entity you can't hear the sound at all, I want to change it to, say 100 HU.

Is this possible with this function? If not, is there another way to accomplish playing a sound when a client touches an entity?

The sound is in the client's VPK files in the default TF2 installation.

Thanks!

Spoiler

Last edited by Potato Uno; 09-02-2015 at 12:20.
Potato Uno is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 09-02-2015 , 13:20   Re: EmitSoundToClient Distance
Reply With Quote #2

if getvectordistance me you <= 300.0

emitsoundtocilent(you, "soudn.wav");




entity == me


I know it's not what you asked. You could look at slender fortress's ClientMusicStart thing which also changes the volume of the sound. Fade the sound based on distance.
__________________

Last edited by Chdata; 09-02-2015 at 13:21.
Chdata is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 09-02-2015 , 13:42   Re: EmitSoundToClient Distance
Reply With Quote #3

I believe the distance it travels is implicitly controlled by the level argument. Sound level is inversely proportional to the attenuation. Low attenuation sounds travel farther, so the higher the sound level, the farther it will travel.

Check the SNDLEVEL values in sdktools_sounds.inc for some values you can use for the sound level.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 09-02-2015 , 14:08   Re: EmitSoundToClient Distance
Reply With Quote #4

The level argument did the trick. Thanks Ross!

PHP Code:
EmitSoundToClient(iClientSOUND_FILE_NAMEiEntitySNDCHAN_AUTOSNDLEVEL_DRYER); 
Potato Uno is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:18.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode