Automatically Continue Empty Dialogue Nodes?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Unrighteous
Posts: 36
Joined: Thu Mar 17, 2022 5:32 pm

Automatically Continue Empty Dialogue Nodes?

Post 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.
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: Automatically Continue Empty Dialogue Nodes?

Post 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.
Unrighteous
Posts: 36
Joined: Thu Mar 17, 2022 5:32 pm

Re: Automatically Continue Empty Dialogue Nodes?

Post 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!
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: Automatically Continue Empty Dialogue Nodes?

Post 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.
Post Reply