S_PauseSound
Jump to navigation
Jump to search
static void S_PauseSound (bool notmusic, bool notsfx)
Usage
S_PauseSound
can be used in ZScript to pause level music and/or level sounds.
This function is defined in the Object class, so it can be called in ZScript in any context. However, the effect is negated as soon as the world ticks, so it can only be effectively utilized while in UI scope.
Parameters
- bool notmusic
- If
true
, level music will not be paused.
- bool notsfx
- If
true
, currently playing sounds will not be paused.
Examples
This event will pause music while any menu based on the ListMenu
class is opened:
class StopMenuMusic : EventHandler
{
override void UiTick()
{
Menu mnu = Menu.GetCurrentMenu();
if (mnu && mnu is 'ListMenu')
{
S_PauseSound(false, false);
}
}
}
Note, resuming the sound manually isn't required in this case, since as soon as the menu is closed, the world will tick and the sounds will be resumed automatically.