Entity/EmitSound
m (Bug) |
|||
Line 7: | Line 7: | ||
{{Note|It is recommended to use sound scripts ( see {{LibraryFunction|sound|Add}} ) over direct file paths. This will allow you to use {{ClassFunction|Entity|StopSound}} to stop the played sound scripts.}} | {{Note|It is recommended to use sound scripts ( see {{LibraryFunction|sound|Add}} ) over direct file paths. This will allow you to use {{ClassFunction|Entity|StopSound}} to stop the played sound scripts.}} | ||
+ | |||
+ | {{Bug|Issue=2651|This does not respond to {{GlobalFunction|SuppressHostEvents}}.}} | ||
|Realm=Shared | |Realm=Shared | ||
|IsClass=Yes | |IsClass=Yes |
Revision as of 15:42, 30 July 2018
Contents |
Description
Plays a sound on an entity. If run clientside, the sound will only be heard locally.
If used on a player or NPC character with the mouth rigged, the character will "lip-sync". ( Does not work with all sounds )
NOTE |
You can only override the volume and pitch if you use the filename, not the sound script/manifest name. |
NOTE |
It is recommended to use sound scripts ( see sound.Add ) over direct file paths. This will allow you to use Entity:StopSound to stop the played sound scripts. |
BUG |
This does not respond to SuppressHostEvents. Issue Tracker: #2651 |
Arguments
string soundName
The name of the sound to be played.
NOTE |
Ensure this string has no whitespace at the start or end (you can use string.Trim), or else you'll get an error. |
Arguments
number soundLevel=75
Arguments
number pitchPercent=100
Arguments
number volume=1
Arguments
number channel=CHAN_AUTO
The sound channel , see CHAN_ Enums
NOTE |
For weapons, the default is CHAN_WEAPON. |
Examples
Example
Plays sound from the first player on the server.
Entity(1):EmitSound( "path/to/sound.wav", 75, 100, 1, CHAN_AUTO ) -- Same as below Entity(1):EmitSound( "path/to/sound.wav" ) -- You can remove the arguments that have default values.