Page 1 of 1
Variables wont set
Posted: Mon Oct 10, 2022 6:29 am
by DigitalCauldron
Hi!
I've started using the Dialogue System very recently so please forgive any obvious errors.
Sorry if this is a solved issue, I did not find anything like it in the forum.
I have a conversation for one of my NPCs.
The conversation has two paths, and looks like this:
- Convo.PNG (21.77 KiB) Viewed 256 times
One variable "FirstMessageTriggered" exists.
- Variable.PNG (9.05 KiB) Viewed 256 times
This variable is supposed to control wich path of the messages get selected.
The first path has a script, which is supposed to set the variable to true.
- inspector.PNG (15.64 KiB) Viewed 256 times
However, this is where the problem lies. The variable does not get set to true.
I am certain that the chat selection itself works, because I have tested it by manually setting the variable in the editor, which causes the correct chat to be selected.
I dont know if this is a common issue or if you have any idea as to why this is happening.
Thank you for your help.
Best regards
Digital Cauldron
Re: Variables wont set
Posted: Mon Oct 10, 2022 8:06 am
by Tony Li
Hi,
Thanks for using the Dialogue System!
Are you perhaps looking at the Dialogue Editor window's Variables section at runtime? You may have noticed that, at runtime, the Variables section shows this message:
"(Use Watches section or Variable View window for runtime values.)"
[I also just noticed that the positioning of this message is a little off in Unity 2021+. I'll fix that in the next release.]
The Variables section only shows the
Initial Value. To see runtime values, use the Watches tab, which becomes available at runtime:
- watches.png (17.75 KiB) Viewed 251 times
Or use the separate
Variable View window, which is also handy to use in parallel with the Dialogue Editor window when you're writing content.
In builds, you can check variables using a
Lua Console.
Also, something to be aware of regarding conditions, although I don't think it's in play here:
Conversations Evaluate Conditions One Extra Level Ahead
Re: Variables wont set
Posted: Mon Oct 10, 2022 8:48 am
by DigitalCauldron
Thank you for your reply.
I checked out the variable window and it is quite helpful.
However, the information it gives me confuses me a bit more.
Is it possible that the runtime variable is not the variable that gets used to check the condition?
I ask this because while the runtime variable is behaving correctly, changing its value to true, it does not influence the outcome. However, if I change the initial variable through the editor (even during runtime) it does change the outcome to the wanted result.
(If what I mean is unclear, I can elaborate with screen shots).
Is that a possibility? Does the system make a difference between runtime and initial variables/ does the difference even exist?
Thank you for your help!
Edit: I also added an extra level for evaluation, but it does not seem to make a difference.
Re: Variables wont set
Posted: Mon Oct 10, 2022 9:11 am
by DigitalCauldron
Solved.
Hey again, I figured it out.
The issue was on my end. I cleared the database on starting a NPC interaction, which reset all the variables.
Thank you for the input, it helped me to figure my mistake out.
Re: Variables wont set
Posted: Mon Oct 10, 2022 10:22 am
by Tony Li
Glad to help!
Regarding "Conversations Evaluate Conditions One Extra Level Ahead", you only need to do this when you would change a variable in one node and then reference that variable in the very next node's Conditions. Otherwise (as in your example), you don't need to add the extra node between them.