How to skip executing sequence and script when jumping to a specific node (entry).

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Zabu
Posts: 1
Joined: Sun Sep 24, 2023 7:27 am

How to skip executing sequence and script when jumping to a specific node (entry).

Post by Zabu »

Hi.

Thank you for the great asset.
I would like to know how to prevent the execution of a sequence and script when jumping to a specific entry.

I am currently working on a system to interact with animals.
If I pat its head at any point during the conversation, it will interrupt the conversation and respond in a special entry, but if I remove my cursor from its head, I want it to return to the original entry.
I can do just going back and forth between Entries, but I would like to know how to return to the display of choices without executing any sequence and script in the entry to which I return.


Specifically, what I would like to achieve is like the following.

Dog :ruff ruff! (I picked up the item you asked for!)

Player (Show selections): [Praise and feed] [Praise and give a new toy]

Then the player strokes its head. Jump to the entry that has been pre-determined.
Dog: whine whine (Pet me more!)

The player removes his/her hand. Return to the original entry.
Dog :Woof! (I picked up the item you asked for!)
*I would like to avoid playing this again. I think it looks unnatural to repeat the same line.

Player (Show selections again): [Praise and feed] [Praise and give a new toy]


The code for moving between Entries by player interaction is as follows.
How to skip executing sequence and script when GotoState()?

Code: Select all

    private void JumpNode(int entryID)
    {
        var entry = DialogueManager.masterDatabase.GetDialogueEntry(DialogueManager.lastConversationID, entryID);
        var state = DialogueManager.conversationModel.GetState(entry);
        DialogueManager.conversationController.GotoState(state);
    }
Thank you.
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to skip executing sequence and script when jumping to a specific node (entry).

Post by Tony Li »

Hi,

Instead of this:

Code: Select all

var entry = DialogueManager.masterDatabase.GetDialogueEntry(DialogueManager.lastConversationID, entryID);
var state = DialogueManager.conversationModel.GetState(entry);
you can just use this:

Code: Select all

var state = DialogueManager.currentConversationState;
To return to the state without playing its sequence:

Code: Select all

state.subtitle.sequence = "Continue()@0"; // Show subtitle and immediately proceed (e.g., to response menu).
DialogueManager.conversationController.GotoState(state);
You don't need to do anything to skip the script since it runs in GetState(), and the code above no longer uses GetState().
Post Reply