GSC reference › Built-in
PlaySoundOnTag()
Built-in (engine)
Server
Called on: entity
Play the sound alias as if coming from the tag
Signature
<entity> PlaySoundOnTag(<aliasname>, [tag], [team], [ent])
Called on an entity: entity PlaySoundOnTag(...)
Parameters
| Name | Required? | Details |
|---|---|---|
| aliasname | Required | The sound alias to play, this can be the string name, or the integer hash |
| tag | Optional | If present, the sound will play at the position of the given tag |
| team | Optional | If present or not undefined the sound will only be heard by the specified team |
| ent | Optional | If present the sound will also be heard on the specified entity |
Example (from Treyarch's docs)
self PlaySoundOnTag( soundAlias, "J_Head")
Real uses in BO3's scripts
Called 46 times in the decompiled scripts. A few, zombies first:
- scripts/zm/_zm_ai_spiders.gsc, line 434
self playsoundontag("zmb_spider_vocals_ambient", "tag_eye"); - scripts/zm/_zm_ai_thrasher.gsc, line 1240
self playsoundontag("zmb_vocals_thrash_ambient", "j_head"); - scripts/zm/_zm_audio.gsc, line 854
self playsoundontag(sound_to_play, "J_Head"); - scripts/zm/_zm_genesis_spiders.gsc, line 395
self playsoundontag("zmb_spider_vocals_ambient", "tag_eye"); - scripts/zm/bgbs/_zm_bgb_mind_blown.gsc, line 207
self playsoundontag("zmb_bgb_mindblown_pop", "tag_eye");
Related built-ins
- PlaySound()Play the sound at the entity
- PlayFXOnTag()Play fx on a particular tag of an entity
- PlaySoundAtPosition()Play the sound alias from a position
- PlayLoopSound()Play a looping sound with an optional fadetime in seconds.
- GetTagOrigin()Gets the origin of the tag
- StopLoopSound()Stops the looping sound with an optional fadetime.
- GetTagAngles()Gets the angles of the tag
- PlaySoundToPlayer()Play the sound alias as if coming from the entity, so that only one player can hear it
- PlaySoundWithNotify()Play the sound alias as if coming from the entity
- PlayLocalSound()Plays a sound locally
- StopAllLoopSounds()Stops a loop sound
- StopSounds()Stop all sounds on an entity.
New to GSC?
Start with the basics, or paste a compile error to get the fix.
Built-in descriptions, parameters and examples come from Treyarch's BO3 mod tools docs. Usage links point at shiversoftdev/t7-source (decompiled BO3 scripts).