How to stop playing audio in conversation?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Evgeny
Posts: 16
Joined: Sun Mar 13, 2016 11:18 am

How to stop playing audio in conversation?

Post by Evgeny »

Next question :)

How to stop playing of audio in conversation when after the answer the following actor begins to speak?

The first actor has a long text, and the user can press the answer button earlier, than the audio will finish.
bohnstudios
Posts: 68
Joined: Sun Aug 16, 2015 3:01 am
Location: St. Louis, MO
Contact:

Re: How to stop playing audio in conversation?

Post by bohnstudios »

How are you telling the audio to play that won't stop? If by chance you are by chance using the AudioWait() sequencer command, then according to the notes in the docs.... "This command waits until the clip is done. If you want to exit immediately, use Audio()."

If you still need to simulate a delay such as the AudioWait() sequencer command, then you can put a conversation node between you player response and your node that plays audio you can't stop. Just use the delay() sequencer command on this new "bridge" node to get the same effect as you get with the AudioWait() sequencer command, except you should be able to exit immediately. Tony is the expert and he might have a completely different and way better answer depending on your specific project.

Source docs:

http://www.pixelcrushers.com/dialogue_s ... dAudioWait
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to stop playing audio in conversation?

Post by Tony Li »

If you're using AudioWait(), it will automatically stop playback when the user presses the answer button early.

If you're using Audio() then, as bohnstudios writes, the Dialogue System starts playing the audio clip and forgets about it. In this case, it's up to you to stop the audio.

If that doesn't help, please describe how you're playing the audio. Thanks!
Evgeny
Posts: 16
Joined: Sun Mar 13, 2016 11:18 am

Re: How to stop playing audio in conversation?

Post by Evgeny »

In Sequence field in Dialogue Entry:

Audio(Voiceover/Narrator/narrator00001)
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to stop playing audio in conversation?

Post by Tony Li »

Try changing:

Code: Select all

Audio(Voiceover/Narrator/narrator00001)
to:

Code: Select all

AudioWait(Voiceover/Narrator/narrator00001)
If you have a lot of voiceover lines, also consider using entrytags.
Evgeny
Posts: 16
Joined: Sun Mar 13, 2016 11:18 am

Re: How to stop playing audio in conversation?

Post by Evgeny »

The problem is that if the script of ConversationTriger is located not on DialogueManager, and more than two characters participate in dialogue, then AudioSource is created both on DialogueManager and on that object where there is ConversationTriger.
And the sound isn't interrupted even after the end of dialogue.

I have solved a problem having transferred ConversationTriger to DialogueManager, and there choosing the necessary dialogue.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to stop playing audio in conversation?

Post by Tony Li »

Hi,

It sounds like you got it working. If I can provide additional help, just let me know.

If you're using the Audio() sequencer command, it doesn't stop the audio at any point, not even after the end of dialogue. (The AudioWait() command does stop the audio.)

If you haven't specified a subject for the Audio() or AudioWait() commands, it will use (or create) an AudioSource on the current speaker. If this is the conversation's primary Actor or Conversant, it will use the GameObjects specified in the Conversation Trigger. If you haven't specified an Actor or Conversant in the Conversation Trigger, the Conversation Trigger will try to make a best guess for the GameObjects. If you set the Dialogue Manager's Debug Level to Info, it will report which GameObjects it's using for Actor and Conversant.

For additional characters beyond the primary Actor and Conversant, the Dialogue System will use the GameObject in the scene that matches the character's actor name.
Post Reply