Page 1 of 1

How to combine bark (random phrase) with conversation?

Posted: Thu Oct 13, 2022 2:00 pm
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?

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

Posted: Thu Oct 13, 2022 10:05 pm
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 440 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);

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

Posted: Fri Oct 14, 2022 3:25 am
by eonyanov
Thanks for the fast reply. It is really helpful. It worked for me 👍

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

Posted: Fri Oct 14, 2022 7:51 am
by Tony Li
Glad to help!