A condition for a Variable

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Feed
Posts: 5
Joined: Sun May 12, 2019 11:56 am

A condition for a Variable

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

Re: A condition for a Variable

Post 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
conditionLastCheck.png (19.81 KiB) Viewed 683 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?
Feed
Posts: 5
Joined: Sun May 12, 2019 11:56 am

Re: A condition for a Variable

Post by Feed »

The Dialoge system shows it as false, the whatch as true.

Yes, the variable is false when the Dialogue System Trigger starts.
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: A condition for a Variable

Post 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.
Feed
Posts: 5
Joined: Sun May 12, 2019 11:56 am

Re: A condition for a Variable

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

Re: A condition for a Variable

Post 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:

Image
Feed
Posts: 5
Joined: Sun May 12, 2019 11:56 am

Re: A condition for a Variable

Post 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.
Last edited by Feed on Sat Aug 03, 2019 12:39 pm, edited 1 time in total.
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: A condition for a Variable

Post 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.
Post Reply