Sets a
sound modifier to be applied to all sounds played that do not have a modifier already set.
Modifier precendence from highest to lowest is:
- Modifier given as parameter to Sound or SoundAt
- Modifier assigned to the player owning the viewport which has its center closest to the sound source
- Global modifier (as set by SetGlobalSoundModifier(modifier, nil);)
Only one modifier is applied at the time. It is not possible to combine multiple modifiers.
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.