How to set conversation to a dialogue trigger?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
rauljl1
Posts: 55
Joined: Fri Apr 15, 2022 7:40 pm

How to set conversation to a dialogue trigger?

Post by rauljl1 »

Hi, Tony.
I want to change the conversation title on a dialogue system trigger.
So, I have the string yet and I assign the dialogue trigger to a public Dialogue Trigger. But, when I try to do:
dialogue Trigger.conversation = "new conversation";
Isn't work. :cry:
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to set conversation to a dialogue trigger?

Post by Tony Li »

Hi,

Do you want to change what conversation a Dialogue System Trigger plays at runtime?

If so, then if you have a variable 'triggerObject' that points to the Dialogue System Trigger's GameObject you can do something like this:

Code: Select all

var dialogueSystemTrigger = triggerObject.GetComponent<DialogueSystemTrigger>();
dialogueSystemTrigger.conversation = "new conversation";
User avatar
rauljl1
Posts: 55
Joined: Fri Apr 15, 2022 7:40 pm

Re: How to set conversation to a dialogue trigger?

Post by rauljl1 »

Thanks! So, finally. How could I change a variable Initial Value with a script?
Also, the type number of the variables support floats?
Thanks a lot for your help, Tony!
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to set conversation to a dialogue trigger?

Post by Tony Li »

Hi,

If you're talking about changing variable values at runtime, you don't change the initial value. You change the current value. To do this, use DialogueLua.SetVariable(). For example:

Code: Select all

DialogueLua.SetVariable("Score", 42);
DialogueLua.SetVariable("Color", "blue");
At runtime, treat the dialogue database like it's read-only. Changes are made through the Dialogue System's runtime Lua environment.

Under the hood, Number variables are doubles. But you can use them as doubles, floats, or ints.
Post Reply