Category: Effects
/ Sound
Since engine version: 7.0 OC
SetGlobalSoundModifier
Description
Sets a sound modifier to be applied to all sounds played that do not have a modifier already set.
Syntax
bool SetGlobalSoundModifier(proplist name, int player);
Parameters
- name:
- Modifier to be applied to all sounds.
- player:
- [opt] If non-nil: Modifier is applied to sounds played in viewports owned by this player.
Remark
Modifier precendence from highest to lowest is:
Only one modifier is applied at the time. It is not possible to combine multiple modifiers.
Example
func Timer() { // Is there a player? var player = GetPlayerByIndex(0, C4PT_User); if (player >= 0) { // Is the player controlling a clonk in a cave? var mod = nil; var clonk = GetCursor(player); if (clonk) if (clonk->GetMaterial() == Material("Tunnel")) { // Controlled clonk is in a cave - do some cave sounds! mod = Ambience.CaveModifier; } SetGlobalSoundModifier(mod, player); } }
Scenario timer script: When this function is called, it sets a cave reverb sound modifier whenever the clonk of the first player is in front of tunnel background.