Interaction with other scripts

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
CaseyJarmes
Posts: 4
Joined: Fri Feb 11, 2022 3:41 pm

Interaction with other scripts

Post by CaseyJarmes »

I've been working with the Pixel Crushers Dialogue System and am having trouble integrating it with other scripts in my project. Specifically, I need to have a Dialogue Condition based on what a variable in a C# script is set to. This is so I may have the Dialogue System work with my inventory code.

Example: A dialogue option only being available if the booleon "KnifeObtained" is set to true.

Alternatively, if there was a way for me to change the variables in the Dialogue Database via a script, that would also work
User avatar
Tony Li
Posts: 22149
Joined: Thu Jul 18, 2013 1:27 pm

Re: Interaction with other scripts

Post by Tony Li »

Hi,
CaseyJarmes wrote: Fri Feb 11, 2022 3:49 pmI've been working with the Pixel Crushers Dialogue System and am having trouble integrating it with other scripts in my project. Specifically, I need to have a Dialogue Condition based on what a variable in a C# script is set to. This is so I may have the Dialogue System work with my inventory code.

Example: A dialogue option only being available if the booleon "KnifeObtained" is set to true.
Write a C# method to get the valud of KnifeObtained:

Code: Select all

bool IsKnifeObtained() { return KnifeObtained; }
Then register it with Lua (tutorial) so you can check it in your dialogue entry nodes' Conditions fields.
CaseyJarmes wrote: Fri Feb 11, 2022 3:49 pmAlternatively, if there was a way for me to change the variables in the Dialogue Database via a script, that would also work
Use DialogueLua:

Code: Select all

DialogueLua.SetVariable("KnifeObtained", true);
CaseyJarmes
Posts: 4
Joined: Fri Feb 11, 2022 3:41 pm

Re: Interaction with other scripts

Post by CaseyJarmes »

Thanks, this'll help a lot
User avatar
Tony Li
Posts: 22149
Joined: Thu Jul 18, 2013 1:27 pm

Re: Interaction with other scripts

Post by Tony Li »

Happy to help! :-)
Post Reply