Page 1 of 1

How to set conversation to a dialogue trigger?

Posted: Tue May 10, 2022 7:15 pm
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:

Re: How to set conversation to a dialogue trigger?

Posted: Tue May 10, 2022 8:12 pm
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";

Re: How to set conversation to a dialogue trigger?

Posted: Tue May 10, 2022 10:30 pm
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!

Re: How to set conversation to a dialogue trigger?

Posted: Tue May 10, 2022 10:37 pm
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.