Page 1 of 1

Automatically Continue Empty Dialogue Nodes?

Posted: Sun Nov 19, 2023 10:17 pm
by Unrighteous
Hello,

This isn't a huge deal, but I've been trying to figure out how to do this myself for a while without much success, so I was wondering if there was a simple solution.

Right now, I have my continue button set to "Always." I always want player confirmation before continuing any dialogue.

I use a lot of empty nodes in my conversations, and I have to add the "Continue()" sequence to all of them, or else the conversation gets stuck as the dialogue panel is hidden and the continue button no longer works. I can't use group nodes because they don't seem to process the dialogue entry fields that I'm using.

I tried a few different ways of getting the conversation to continue through code in the "OnConversationLine" method, but calling something like "DialogueManager.PlaySequence("Continue()")" doesn't work on the same frame; I have to delay it by a frame, and that causes other issues.

I'd like to implement something automatic for this because I keep accidentally forgetting to add "Continue()" to some nodes, and it essentially bricks my game. It would be nice to have this functionally be automatic and also work as a safeguard.

Any help is greatly appreciated, but please don't spend too much time on this; it's not really necessary, I was just wondering if I missed something simple.

Thank you.

Re: Automatically Continue Empty Dialogue Nodes?

Posted: Mon Nov 20, 2023 8:48 am
by Tony Li
Hi,

You can add a script like this to the Dialogue Manager to add that functionality:

AutoContinueBlankNodes.cs

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;
public class AutoContinueBlankNodes : MonoBehaviour
{
    void OnConversationLine(Subtitle subtitle)
    {
        if (string.IsNullOrEmpty(subtitle.formattedText.text))
        {
            subtitle.sequence = $"Continue(); {subtitle.sequence}";
        }
    }
}

Alternatively, if you're using these blank nodes for organization (e.g., a "hub" node) and not to delay evaluation of Conditions, you can just tick the Group checkbox to make a group node. Group nodes always pass through; they don't stop on the node.

Re: Automatically Continue Empty Dialogue Nodes?

Posted: Tue Nov 21, 2023 12:25 am
by Unrighteous
Hey, thanks so much for the response.

Unfortunately, I wasn't able to automate everything. The code provided does work, but the timing is a bit off and it causes some undesirable behavior at times. Although, I did come up with a solution that I'm happy with.

I'll keep putting the Continue sequence in all of the empty nodes, but I check each node through code to see if I missed one somewhere, then if I did miss one, I play the Continue sequence through code and throw a warning.

I really just wanted a safeguard to make sure my game doesn't brick, so I'm more than happy with this.

Thanks for your time, I really appreciate it!

Re: Automatically Continue Empty Dialogue Nodes?

Posted: Tue Nov 21, 2023 7:52 am
by Tony Li
Hi,

Glad to help!

If the timing issue is that certain sequencer commands don't run, put "required" in front of them. The "required keyword guarantees that the sequencer command runs even if a Continue() sequencer command (or the player's continue button click) skips ahead before the command is scheduled to run.