Page 1 of 2

How to change Dialogue Variable Boolean value?

Posted: Sun May 10, 2020 2:49 pm
by Soundmartell
Hello,
I just started using Dialogue system a few days ago.
Is it possible to change the value of a Boolean Variable from false to true?
Let say I have a Player who will peak an object (Access Code) if the player has not take the Access Code Object yet the Variable Access_Code has a value of false. As soon as the player take the Object I want to change the Variable to True so I can use the Conversation according to the Variable value.
Please note I already create the Database, Actors(Player and NPC), Variable(Access_Code with false), Conversation( Start and from start 2 child nodes: Node a = Access denied with condition = Variable["Access_Code"] == false. Node b System activated with condition = Variable["Access_Code"] == true
I will appreciate any help.
Thanks.

Re: How to change Dialogue Variable Boolean value?

Posted: Sun May 10, 2020 3:15 pm
by Tony Li
Hi,

Thanks for using the Dialogue System!

Yes, you can change the variable value in a C# script like this:

Code: Select all

using PixelCrushers.DialogueSystem; // (include at top of script)
...
DialogueLua.SetVariable("Access_Code", true)
There are also equivalent visual scripting actions for PlayMaker, etc.

You can also use a Dialogue System Trigger. For example, if the player learns the access code by entering a trigger area, you can add a Dialogue System Trigger to the trigger area:

setAccessCodeTrue.png
setAccessCodeTrue.png (29.24 KiB) Viewed 3338 times

Re: How to change Dialogue Variable Boolean value?

Posted: Fri May 22, 2020 7:50 pm
by Soundmartell
Hey, Thank you very much. Sorry for the very late answer, I was waiting for email notification about a reply but never arrived.
I will try it and I will let you know if I solved.
Regards.

Re: How to change Dialogue Variable Boolean value?

Posted: Sun Aug 01, 2021 9:07 am
by pewldo
Hi I've been trying to use the Synch Bool action to transfer a boolean value from playmaker to dialogue system without much luck. Im sort of stuck, and wondering if there is some step that I am missing.

I am sequencing events from dialogue system to playmaker, but I would be very interested in an explanation of the process of transferring values from playmaker to dialogue system.

Thanks for you time.

Re: How to change Dialogue Variable Boolean value?

Posted: Sun Aug 01, 2021 9:30 am
by Tony Li
Hi,

If you just want to transfer the value of a PlayMaker Boolean variable to a Dialogue System Boolean variable, use the Set Variable action. It's much simpler. The Sync XXX actions are useful for transferring the value every frame (i.e., keeping them in sync), but if you only need to transfer the value once then it's simpler and more efficient to use Set Variable.

Re: How to change Dialogue Variable Boolean value?

Posted: Sun Aug 01, 2021 10:03 am
by pewldo
Thank you i'll diffinitely try that one.

My problem persist, and I suspect that it is due to lack of knowledge on my part:)

The playmaker actions description says "Sets the value of a lua variable in the Variable[] table". As it is now the only thing I've created is a bool inside of the Dialogue Managers Variables section. Is this variable table something else?

Re: How to change Dialogue Variable Boolean value?

Posted: Sun Aug 01, 2021 10:15 am
by Tony Li
No, that's it.

Have you also defined a Boolean variable in PlayMaker? If so:
  • Configure your PlayMaker FSM with a Dialogue System > Set Variable action.
  • Set the Variable Name field to the name of the Dialogue System variable.
  • Set the Bool Value field to your PlayMaker variable, or set it to a literal true/false value if you prefer.
  • Leave the other fieids (String Value, Float Value, Int Value) set to None.

Re: How to change Dialogue Variable Boolean value?

Posted: Sun Aug 01, 2021 10:26 am
by pewldo
That is odd.

I am quite positive thats what im doing, Should I be able to see the Bool inside of the Dialogue Manager change from false to true at runtime?

Re: How to change Dialogue Variable Boolean value?

Posted: Sun Aug 01, 2021 10:32 am
by pewldo
I apologize, it does indeed work. It has to with my own logic!

Still, thank you for your time.

Re: How to change Dialogue Variable Boolean value?

Posted: Sun Aug 01, 2021 10:50 am
by Tony Li
Glad to help!