Trigger Dialogue by name in script

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
boz
Posts: 76
Joined: Mon Oct 19, 2020 8:59 pm

Trigger Dialogue by name in script

Post by boz »

Howdy,

Is there a way to do something in script like, say...

Code: Select all

DialogueSystem.TriggerDialogue("NameOfConversation");
I tried this but I'm not sure how to use it correctly:

Code: Select all

public DialogueDatabase database; //Assigned in editor

DialogueSystemTrigger trigger = new DialogueSystemTrigger();
trigger.selectedDatabase = database;
trigger.trigger = DialogueSystemTriggerEvent.OnUse;
trigger.conversation = "NameOfConversation";
trigger.OnUse();
Thanks for any help :D
User avatar
Tony Li
Posts: 21987
Joined: Thu Jul 18, 2013 1:27 pm

Re: Trigger Dialogue by name in script

Post by Tony Li »

Hi,

Use DialogueManager.StartConversation():

Code: Select all

DialogueManager.StartConversation("NameOfConversation");
You can optionally specify the actor GameObject, conversant GameObject, and starting entry ID. (See the API reference in the link.)
boz
Posts: 76
Joined: Mon Oct 19, 2020 8:59 pm

Re: Trigger Dialogue by name in script

Post by boz »

Perrrrrfect, thank you!
User avatar
Tony Li
Posts: 21987
Joined: Thu Jul 18, 2013 1:27 pm

Re: Trigger Dialogue by name in script

Post by Tony Li »

Happy to help!
Post Reply