Repeat current dialogue node

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
jmnb
Posts: 22
Joined: Thu May 26, 2022 4:38 am

Repeat current dialogue node

Post by jmnb »

What is the best way to set a node to repeat itself via code? This is to give the option to hear the audio a second time.
User avatar
Tony Li
Posts: 21975
Joined: Thu Jul 18, 2013 1:27 pm

Re: Repeat current dialogue node

Post by Tony Li »

Hi,

You can tell the conversation controller to re-run the current state:

Code: Select all

DialogueManager.conversationController.GotoState(DialogueManager.currentConversationState);
jmnb
Posts: 22
Joined: Thu May 26, 2022 4:38 am

Re: Repeat current dialogue node

Post by jmnb »

The GotoState function looks like it should work (I checked with Debug statements), but unfortunately it still isn't replaying the audio associated with a state. I'm not sure where/how the system is playing audio, but there must be something preventing it from working. Please let me know if you have an suggestions on where to look! Thanks.
User avatar
Tony Li
Posts: 21975
Joined: Thu Jul 18, 2013 1:27 pm

Re: Repeat current dialogue node

Post by Tony Li »

Hi,

How are you playing the audio? Are you using an Audio/AudioWait() sequencer command? Here's an example:

DS_RepeatLineExample_2022-08-19.unitypackage

It's a modified version of DemoScene1 with this script:

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;
public class RepeatLineExample : MonoBehaviour
{
    public void RepeatLine()
    {
        DialogueManager.conversationController.GotoState(DialogueManager.currentConversationState);
    }
}
Talk to Private Hart and click the Repeat button to repeat the current dialogue node.
jmnb
Posts: 22
Joined: Thu May 26, 2022 4:38 am

Re: Repeat current dialogue node

Post by jmnb »

I'm using AudioWait(entrytaglocal);

Thanks for the tip - I will check the demo scene.
jmnb
Posts: 22
Joined: Thu May 26, 2022 4:38 am

Re: Repeat current dialogue node

Post by jmnb »

I can't see a repeat scene function in the demo scene. I am using a slightly older version of the Dialogue System - was this feature added recently?
Attachments
demoscene.png
demoscene.png (466.66 KiB) Viewed 383 times
User avatar
Tony Li
Posts: 21975
Joined: Thu Jul 18, 2013 1:27 pm

Re: Repeat current dialogue node

Post by Tony Li »

Hi,

After you import the package, the scene will be located in Assets / Dialogue System Examples / Repeat Line Example. The scene is named "Repeat Line Example".

You'll know that you're playing it instead of the original DemoScene1 because it uses the gray Basic Standard Dialogue UI:

reoeatLine.png
reoeatLine.png (174.6 KiB) Viewed 382 times
jmnb
Posts: 22
Joined: Thu May 26, 2022 4:38 am

Re: Repeat current dialogue node

Post by jmnb »

Is it one of these packages? https://www.pixelcrushers.com/dialogue- ... em-extras/ - I can't see it in the latest version.
User avatar
Tony Li
Posts: 21975
Joined: Thu Jul 18, 2013 1:27 pm

Re: Repeat current dialogue node

Post by Tony Li »

It's in the link in my post above.
Post Reply