Page 1 of 1

Repeat current dialogue node

Posted: Tue Aug 16, 2022 3:11 pm
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.

Re: Repeat current dialogue node

Posted: Tue Aug 16, 2022 3:41 pm
by Tony Li
Hi,

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

Code: Select all

DialogueManager.conversationController.GotoState(DialogueManager.currentConversationState);

Re: Repeat current dialogue node

Posted: Fri Aug 19, 2022 10:56 am
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.

Re: Repeat current dialogue node

Posted: Fri Aug 19, 2022 11:11 am
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.

Re: Repeat current dialogue node

Posted: Fri Aug 19, 2022 11:20 am
by jmnb
I'm using AudioWait(entrytaglocal);

Thanks for the tip - I will check the demo scene.

Re: Repeat current dialogue node

Posted: Fri Aug 19, 2022 12:14 pm
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?

Re: Repeat current dialogue node

Posted: Fri Aug 19, 2022 12:45 pm
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 396 times

Re: Repeat current dialogue node

Posted: Fri Aug 19, 2022 1:18 pm
by jmnb
Is it one of these packages? https://www.pixelcrushers.com/dialogue- ... em-extras/ - I can't see it in the latest version.

Re: Repeat current dialogue node

Posted: Fri Aug 19, 2022 2:01 pm
by Tony Li
It's in the link in my post above.