How to return to previous node without text being typed again

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
EntertainmentForge
Posts: 23
Joined: Sun Nov 29, 2020 8:50 pm

How to return to previous node without text being typed again

Post by EntertainmentForge »

How can I return to previous dialogue node without it's text being typed again (or voice over being repeated)?

Here's a short video to clarify:
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to return to previous node without text being typed again

Post by Tony Li »

Hi,

To do it without scripting, you can set up two versions of the node: one version to show when first entering the conversation, and a second version to show without the typewriter effect when looping back. To skip the typewriter effect and VO, put Continue()@0.01 in the Sequence field. Example:

repeatWithoutVO.png
repeatWithoutVO.png (47.18 KiB) Viewed 329 times
EntertainmentForge
Posts: 23
Joined: Sun Nov 29, 2020 8:50 pm

Re: How to return to previous node without text being typed again

Post by EntertainmentForge »

Thanks for quick replay!

If I did it that way it would complicate things a bit. Translators would get double text as well as voice actors.

I'd rather solve it with code. Do maybe Nodes know to what other nodes they are linked to? So one Node can tell the other Node to change it's sequence to "Continue()@0.01".

Again a video to clarify if needed:
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to return to previous node without text being typed again

Post by Tony Li »

If you needed to do this everywhere, I'd recommend using SimStatus. However, most nodes will not need this, so you don't need to add the extra memory requirement and extra saved game size of SimStatus.

Instead, I'll propose a different solution. Here is the basic idea:

1. The "I humbly apologize..." node will set a variable to remember that it has been displayed.

2. When the node is used, it will check this variable. If the variable has been set, it will change the Sequence to: Continue()@0.01.

---

To do this, add a Text field to your dialogue entry template. For example, call it "DisplayedVariable".

In the "I humbly apologize..." node, set the DisplayedVariable field to a value of your choice such as "Displayed.RepresentativeAsked".

Add a script to the Dialogue Manager that has an OnConversationLine method. In this method, check if the current node has a DisplayedVariable value. If so, check the variable. If the variable is false, set it true. If the variable is true, change the Sequence. Example:

Code: Select all

public class SkipEffectsOnDisplayedNodes : MonoBehaviour
{
    void OnConversationLine(Subtitle subtitle)
    {
        // Check if the current subtitle's dialogue entry node has a DisplayedVariable:
        var displayedVariable = Field.LookupValue(subtitle.dialogueEntry.fields, "DisplayedVariable");
        if (string.IsNullOrEmpty(displayedVariable)) return;
        if (DialogueLua.GetVariable(displayedVariable).asBool == false)
        { // This is the first time. Set the variable true:
            DialogueLua.SetVariable(displayedVariable, true);
        }
        else
        { // Otherwise change the sequence:
            subtitle.Sequence = "Continue()@0.01";
        }
    }
}
EntertainmentForge
Posts: 23
Joined: Sun Nov 29, 2020 8:50 pm

Re: How to return to previous node without text being typed again

Post by EntertainmentForge »

Thanks a lot, Tony! This solved the issue.

But it created one more small problem:
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to return to previous node without text being typed again

Post by Tony Li »

Hi,

I think you should be able to adjust the menu panel's Animator so it cuts the hide animation short if it needs to be shown again. If you can't get that to work for some reason, you could make a subclass of StandardUIMenuPanel and override the HideResponses method to wait one or two frames. If ShowResponses() is called again in in one or two frames, don't hide. Otherwise hide.
Post Reply