Simple way to disable all audio in the Dialogue System?
Simple way to disable all audio in the Dialogue System?
I want to give the player the option to disable the voice acting audio if they wanted in my options menu. I was wondering if there was a simple way to do so? Thanks for any info.
Re: Simple way to disable all audio in the Dialogue System?
Hi,
If the only audio that you play through the Dialogue System's sequencer commands is voice acting, then you can set a Dialogue System variable named "Mute" to true. If "Mute" is true, sequencer commands will not play audio.
You can set the variable in C#:
Or in Lua code (e.g., dialogue entry's Script field):
If you use sequencer commands to play other audio, you'll have to do something different. The easiest way is to use a {{shortcut}}. For example, create a shortcut named {{voiceover}} and use it in your dialogue entries' Sequence fields.
If voice acting is enabled, set {{voiceover}} to something like: AudioWait(entrytag)
If voice acting is disabled, set {{voiceover}} to: None()
You can set the shortcut using C#:
or using a SequencerShortcuts component.
If the only audio that you play through the Dialogue System's sequencer commands is voice acting, then you can set a Dialogue System variable named "Mute" to true. If "Mute" is true, sequencer commands will not play audio.
You can set the variable in C#:
Code: Select all
DialogueLua.SetVariable("Mute", true);
Code: Select all
Variable["Mute"] = true
If voice acting is enabled, set {{voiceover}} to something like: AudioWait(entrytag)
If voice acting is disabled, set {{voiceover}} to: None()
You can set the shortcut using C#:
Code: Select all
Sequencer.RegisterShortcut("voiceover", "AudioWait(entrytag)");
Re: Simple way to disable all audio in the Dialogue System?
Ah that makes sense. Thank you. I am using the sequences only for voice acting audio. I know how to use variables to control the dialogue tree, but how do I do a sort of:
if(mute==true){
//don't run AudioWait();
}
I still want it to go through the dialogue conversation, just text only. I can set the variable 'mute' in script no issue, but how do I have only the sequence code rely on the variable condition? Can I do it within the dialogue entry itself?
if(mute==true){
//don't run AudioWait();
}
I still want it to go through the dialogue conversation, just text only. I can set the variable 'mute' in script no issue, but how do I have only the sequence code rely on the variable condition? Can I do it within the dialogue entry itself?
Re: Simple way to disable all audio in the Dialogue System?
If you set the "Mute" variable true (using either of the ways I described above), AudioWait() will still wait for the duration of the audio clip; it just won't play the clip.
If you don't want to do that, you can use the other option -- the {{shortcut}}. For example:
If you don't want to do that, you can use the other option -- the {{shortcut}}. For example:
- If voice acting is enabled, set {{voiceover}} to: AudioWait(entrytag)
- If voice acting is disabled, set {{voiceover}} to: Delay({{end}})
Re: Simple way to disable all audio in the Dialogue System?
Hello, sorry I'm still missing something here. How do I specifically make it only skip the sequence commands? I can create and set the variable, but how do I set the condition that mute has to be true without skipping the dialogue entry as well? Like where would I set that? Somehow within the 'Sequence' field? I can't use the 'Conditions' field because it would skip the text?
Re: Simple way to disable all audio in the Dialogue System?
Hi,
If I understand you correctly, you won't want to skip the sequence entirely. Instead, you want to show the text without playing audio.
To do this and show the text for a duration based on the text length, set the sequence to:
This will process the audio, but if Mute is true then it won't actually play it; it will just silently wait for an equivalent amount of time.
If, when the player turns off voiceover, you instead want to show the text immediately without waiting, set the sequence to:
and define a sequence shortcut named "voiceover". When the player has specified to hear voiceover, set this shortcut to AudioWait(entrytag):
If the player has turned off voiceover, set the shortcut to:
This will immediately continue to the next step in the conversation without playing any audio.
If I understand you correctly, you won't want to skip the sequence entirely. Instead, you want to show the text without playing audio.
To do this and show the text for a duration based on the text length, set the sequence to:
Code: Select all
AudioWait(entrytag)
If, when the player turns off voiceover, you instead want to show the text immediately without waiting, set the sequence to:
Code: Select all
{{voiceover}}
Code: Select all
Sequencer.RegisterShortcut("voiceover", "AudioWait(entrytag)");
Code: Select all
Sequencer.RegisterShortcut("voiceover", "Continue()");