Conditional Dialogue Flow Between Child Nodes

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
elektronische
Posts: 9
Joined: Mon Dec 03, 2018 4:31 pm

Conditional Dialogue Flow Between Child Nodes

Post by elektronische »

Hello!

I'm working on a new feature and have come across a scenario I'm unsure about.

I have a parent node, let's call it Node A, which has two child nodes: Node B and Node C. My objective is to set up the system in such a way that after Node A's dialogue is displayed, the system would transition to Node B if a certain condition is met. However, if that condition isn't met, it should proceed with Node C's dialogue.

Is there a way to implement this conditional transition between the child nodes based on the state of the specified condition?

Thank you in advance for any guidance!
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Conditional Dialogue Flow Between Child Nodes

Post by Tony Li »

Yes, absolutely. Please see Conversation Conditions Tutorial.

You can also use your own C# methods in Conditions by registering the methods with Lua.

See also: Conversations Evaluate Conditions One Extra Level Ahead
elektronische
Posts: 9
Joined: Mon Dec 03, 2018 4:31 pm

Re: Conditional Dialogue Flow Between Child Nodes

Post by elektronische »

Thank you so much for the response! I have already achieved the functionality I wanted.

Now I have a new question regarding a different topic, but it eventually relates to my project. It's about the process of localizing variables, for instance, if I have a variable that I want to display inside a node, which I set from the code, like this:

Code: Select all

DialogueLua.SetVariable("Choice1", "Text Choice 1");
And then I display it in a node like this:

[var=Choice1]

I need to modify that Choice1 value in runtime not only for the "Dialogue Text" but also for each localization language. Do you know if there's any efficient way to do this?

Thank you.
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Conditional Dialogue Flow Between Child Nodes

Post by Tony Li »

Hi,

Dialogue databases have their own localization.

However, if you want to set the variable value from another source using C#, you can use a text table. For example, say your text table has a field named "Dance" with English(en/default) = "dance" and German(de) = "tanzen".

Then assign the text table to the Dialogue Manager's Localization Setting section, and use DialogueManager.GetLocalizedText:

Code: Select all

DialogueLua.SetVariable("Choice1", DialogueManager.GetLocalizedText("Dance"));
Post Reply