How to change Dialogue Variable Boolean value?
-
- Posts: 9
- Joined: Sun May 10, 2020 2:02 pm
How to change Dialogue Variable Boolean value?
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.
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?
Hi,
Thanks for using the Dialogue System!
Yes, you can change the variable value in a C# script like this:
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:
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)
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:
-
- Posts: 9
- Joined: Sun May 10, 2020 2:02 pm
Re: How to change Dialogue Variable Boolean value?
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.
I will try it and I will let you know if I solved.
Regards.
Re: How to change Dialogue Variable Boolean value?
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.
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?
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.
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?
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?
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?
No, that's it.
Have you also defined a Boolean variable in PlayMaker? If so:
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?
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?
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?
I apologize, it does indeed work. It has to with my own logic!
Still, thank you for your time.
Still, thank you for your time.
Re: How to change Dialogue Variable Boolean value?
Glad to help!