How to change Dialogue Variable Boolean value?

Announcements, support questions, and discussion for the Dialogue System.
Soundmartell
Posts: 9
Joined: Sun May 10, 2020 2:02 pm

How to change Dialogue Variable Boolean value?

Post 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.
User avatar
Tony Li
Posts: 22118
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to change Dialogue Variable Boolean value?

Post 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 3572 times
Soundmartell
Posts: 9
Joined: Sun May 10, 2020 2:02 pm

Re: How to change Dialogue Variable Boolean value?

Post 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.
pewldo
Posts: 8
Joined: Thu May 13, 2021 5:22 am

Re: How to change Dialogue Variable Boolean value?

Post 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.
User avatar
Tony Li
Posts: 22118
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to change Dialogue Variable Boolean value?

Post 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.
pewldo
Posts: 8
Joined: Thu May 13, 2021 5:22 am

Re: How to change Dialogue Variable Boolean value?

Post 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?
User avatar
Tony Li
Posts: 22118
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to change Dialogue Variable Boolean value?

Post 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.
pewldo
Posts: 8
Joined: Thu May 13, 2021 5:22 am

Re: How to change Dialogue Variable Boolean value?

Post 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?
pewldo
Posts: 8
Joined: Thu May 13, 2021 5:22 am

Re: How to change Dialogue Variable Boolean value?

Post by pewldo »

I apologize, it does indeed work. It has to with my own logic!

Still, thank you for your time.
User avatar
Tony Li
Posts: 22118
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to change Dialogue Variable Boolean value?

Post by Tony Li »

Glad to help!
Post Reply