Page 1 of 1
A condition for a Variable
Posted: Thu May 23, 2019 3:33 pm
by Feed
Hello again.
I've made a simple variable wich does turn the component light on, but, when i introduce the condition, it stops working, the code seems to be fine, what am i doing wrong?
Thanks
Re: A condition for a Variable
Posted: Thu May 23, 2019 7:01 pm
by Tony Li
Hi,
In play mode, please inspect the Dialogue System Trigger. It will show the result of checking the Condition. It will either be True (in green) or False (in red):
- conditionLastCheck.png (19.81 KiB) Viewed 678 times
Is it possible that the variable is not true before the Dialogue System Trigger starts?
Also, are there any specific scenarios in which this happens? For example, only when loading a saved game?
Re: A condition for a Variable
Posted: Sat May 25, 2019 3:48 am
by Feed
The Dialoge system shows it as false, the whatch as true.
Yes, the variable is false when the Dialogue System Trigger starts.
Re: A condition for a Variable
Posted: Sat May 25, 2019 8:37 am
by Tony Li
Hi,
Feed wrote: ↑Sat May 25, 2019 3:48 amThe Dialogee system shows it as false, the whatch as true.
The
Variables section will always show the original, design-time value.
The
Watches section will show the runtime value. You may need to click Update or turn on Auto-Update to see the current value.
Feed wrote: ↑Sat May 25, 2019 3:48 amYes, the variable is false when the Dialogue System Trigger starts.
Do you want the variable to be false when the scene starts?
If so, then the Dialogue System Trigger will not fire because the Condition will not be met.
If you want the Dialogue System Trigger to fire after you set the variable to true, then change the Dialogue System Trigger to
OnUse. After you set the variable to true, call the Dialogue System Trigger's OnUse() method.
Re: A condition for a Variable
Posted: Sun Jun 02, 2019 10:52 am
by Feed
I really don't want to ask, but i just can't make it work.
I tried to call the OnUse triger and OnConversationStart but i haven't managed to do so, is it explained in the documentation somewhere?
I have made a small proyect with the issue alone, if it helps to explain what i'm stuck with.
[link removed]
Re: A condition for a Variable
Posted: Mon Jun 03, 2019 10:45 am
by Tony Li
Hi,
Thank you for sending the example project. I'm back in the office and responding to posts as quickly as I can.
In your example, the second Dialogue System Trigger is set to
On Conversation Start. This means it will try to work as soon as the conversation starts. But the variable condition is not true when the conversation starts.
Try changing it to
On Conversation End. This will try to work when the conversation ends, at which point the variable will be true.
If you want to turn on the light immediately, you can instead use the SetEnabled sequencer command:
Re: A condition for a Variable
Posted: Tue Jun 04, 2019 12:26 pm
by Feed
Thank you, that was the last thing i needed to figure out.
In case you think it can be useful for someone else in the future, i finished the example with the 2 posibilities done.
Re: A condition for a Variable
Posted: Tue Jun 04, 2019 12:48 pm
by Tony Li
Hi,
Thanks for sharing! I removed the link since it contains the full Dialogue System package. But please feel free to export just your example files (without including Plugins/Pixel Crushers) and post it here to share with others if you like.