Page 1 of 1

Trigger Dialogue by name in script

Posted: Mon Aug 23, 2021 3:17 am
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

Re: Trigger Dialogue by name in script

Posted: Mon Aug 23, 2021 8:13 am
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.)

Re: Trigger Dialogue by name in script

Posted: Mon Aug 23, 2021 9:29 pm
by boz
Perrrrrfect, thank you!

Re: Trigger Dialogue by name in script

Posted: Mon Aug 23, 2021 9:51 pm
by Tony Li
Happy to help!