Definition
PauseAllSounds([optional] string exception_1, [optional] string exception_2,..., [optional] string exception_n)
Description
This function pauses all ambient, 3D and resource sounds that are being played except for the ambient, 3D and resource sounds sent to the function.
Parameters
[optional] string exception_1, [optional] string exception_2,…, [optional] string exception_n
Specifies the name of the ambient, 3D and resource sounds that should not be paused by this function. If no name is passed to PauseAllSounds function, all ambient, 3D and resource sounds that are being played will be paused.
Example
function OnTriggerEnter(otherActorName) --nil means main character controller if otherActorName == nil then LoadResource("Sounds", "fire.ogg") LoadResource("Sounds", "river.ogg") LoadResource("Sounds", "ambient.ogg") PlayResourceSoundLoop("Sounds_fire.ogg") PlayResourceSoundLoop("Sounds_river.ogg") PlayResourceSoundLoop("Sounds_ambient.ogg") end end function OnTriggerStay(otherActorName) end function OnTriggerExit(otherActorName) --nil means main character controller if otherActorName == nil then PauseAllSounds("ambient2", "river2", "Sounds_ambient.ogg") end end
Assume that the above script is attached to a trigger named trigger1. Also, “ambient2” and “river2” in the example above are ambient and 3D sounds, respectively.
Whenever the main character enters “trigger1”, we load and play “fire.ogg”, “river.ogg” and “ambient.ogg” resource sounds –In order for LoadResource function to load the resources, you must first add all resources through the Add Resource to Current Project dialog (File > Project > Add/Remove Resource to/from Current Project).
Whenever the main character exits “trigger1”, all ambient, 3D and resource sounds that are playing except the the ambient sound “ambient2”, 3D sound “river2” and resource sound “ambient.ogg” will be paused.
PauseAllSounds