How to combine bark (random phrase) with conversation?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
eonyanov
Posts: 8
Joined: Thu Oct 13, 2022 1:54 pm

How to combine bark (random phrase) with conversation?

Post by eonyanov »

Hello
My NPS starts conversation, then it can be interrupted. I save subtitle.dialogueEntry.id for continue conversation later.
When the NPC can continue the story, he must first say a random phrase. For example, "Where did I stop, oh yes ..."
and then continue conversation from saved entry id.
How can I do it?
User avatar
Tony Li
Posts: 22110
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to combine bark (random phrase) with conversation?

Post by Tony Li »

There are a few ways you could do this. Since it sounds like you're already using a little scripting to save the dialogue entry ID, I'll suggest a scripting solution.

First make sure you're also saving the conversation ID. Let's say they're saved in variables named savedConversationID and savedEntryID.

Write a conversation like this that says a random phrase and then goes to a group node:

asIWasSaying.png
asIWasSaying.png (36.31 KiB) Viewed 511 times

In this example, I named the conversation "As I Was Saying". Make a note of the group node's conversation ID and dialogue entry ID. Let's say it's conversation ID 7, entry ID 5. We'll refer to this node as the Resume node.

On the Dialogue Manager GameObject, tick Other Settings > Instantiate Database. This way you can make changes to the database at runtime without permanently changing the database asset file.

When you want to continue the story, set the Resume node's outgoingLinks to point to the saved dialogue entry:

Code: Select all

var resumeNode = DialogueManager.masterDatabase.GetDialogueEntry(7, 5);
resumeNode.outgoingLinks.Clear();
resumeNode.outgoingLinks.Add(new Link(resumeNode.conversationID, resumeNode.id, savedConversationID, savedEntryID));
DialogueManager.StartConversation("As I Was Saying", player.transform, npc.transform);
eonyanov
Posts: 8
Joined: Thu Oct 13, 2022 1:54 pm

Re: How to combine bark (random phrase) with conversation?

Post by eonyanov »

Thanks for the fast reply. It is really helpful. It worked for me 👍
User avatar
Tony Li
Posts: 22110
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to combine bark (random phrase) with conversation?

Post by Tony Li »

Glad to help!
Post Reply