Page 1 of 1

Interaction with other scripts

Posted: Fri Feb 11, 2022 3:49 pm
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

Re: Interaction with other scripts

Posted: Fri Feb 11, 2022 5:19 pm
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);

Re: Interaction with other scripts

Posted: Fri Feb 11, 2022 5:39 pm
by CaseyJarmes
Thanks, this'll help a lot

Re: Interaction with other scripts

Posted: Fri Feb 11, 2022 9:25 pm
by Tony Li
Happy to help! :-)