Page 1 of 1

When the conversation is at the end of node, how to restart the conversation from the start entry

Posted: Sat Sep 11, 2021 1:13 pm
by Triphail
Hi, I am just started using the plungin, and creat a converstion tree.
And when the conversation is at the end of node, I want to use script to restart the conversation from the start entry node. But don' t kown the correspoding API.
Also I 'm trying to call an Event from the Dialogue node when a Conversation ends, but there is only the On Execute() event that I can call. And the event need a prefab, why can' t just use the gameobject from the scene like the button onclick event of UGUI
And how to get the conversation from DialogueSystemTrigger through script(not the conversation name).

Re: When the conversation is at the end of node, how to restart the conversation from the start entry

Posted: Sat Sep 11, 2021 1:42 pm
by Tony Li
Triphail wrote: Sat Sep 11, 2021 1:13 pmwhen the conversation is at the end of node, I want to use script to restart the conversation from the start entry node. But don' t kown the correspoding API.
If you want to do it within the conversation itself, you can create a link from the final node to the first node.

If you want to know when the conversation has ended, there are several options:
Triphail wrote: Sat Sep 11, 2021 1:13 pmAlso I 'm trying to call an Event from the Dialogue node when a Conversation ends, but there is only the On Execute() event that I can call. And the event need a prefab, why can' t just use the gameobject from the scene like the button onclick event of UGUI
You can use a scene GameObject. In the OnExecute() section, click Add Scene Event.
Triphail wrote: Sat Sep 11, 2021 1:13 pmAnd how to get the conversation from DialogueSystemTrigger through script(not the conversation name).
Do you mean a reference to the actual Conversation object in the dialogue database? If so, use DialogueManager.masterDatabase.GetConversation(). Examples:

Code: Select all

// Get the conversation that was most recently started:
Conversation conv = DialogueManager.masterDatabase.GetConversation(DialogueManager.lastConversationStarted);

// Or get the conversation assigned to this GameObject's Dialogue System Trigger:
DialogueSystemTrigger trigger = GetComponent<DialogueSystemTrigger>();
Conversation conv = DialogueManager.masterDatabase.GetConversation(trigger.conversation);