I have a scene in my game that when you click an object, it should run a dialogue in Yarn, but I am stuck on how to do this with Yarn variables. I have already created a system for it (that doesn’t work) that’s based off of my functioning inventory system. This is it, and I know the clickable objects work, it’s just the way it interacts with Yarn. In short, my question is: Can you use a Yarn variable, so when it’s set to true after clicking an object, run a certain dialogue?
note, there is a line of dialogue and a background change that works fine in the orange node / Scene5. There is also an endif after the if statement 
I think I would do it by launching Yarn nodes, based on what object you clicked. So instead of setting a Yarn variable, you launch dialogue from a node called "food’, “floor” etc.
e.g. Start dialogue from branch “floor”
And have a separate node (and potentially a whole branch of nodes) for each inventory item/clicked item.
I’m not sure from your screenshot how the dialogue is made to launch; I can only see Yarn variables being set. Simply changing the value of a Yarn variable won’t make your dialogue launch. It needs that ‘Start dialogue from branch’ action.
If you’re new to Yarn, I have a tutorial series you might find useful. It goes over the basics of setting up a dialogue system, and a later video gets into Yarn variables. I can paste a link if you like.
1 Like
I never thought of that! Thank you for the advice. You have literally been the only reason I have a game to hand in to my teacher in the first place, so I greatly appreciate you and all the help you’ve given me with your replies and tutorials.
Have just typed it in and tried it, and it works perfectly! I’ll come back if I run into an issue after adding everything else I need to for my game. Thanks 
1 Like
That’s the nicest comment I think I’ve ever had, anywhere
I’m happy for you, and happy to help.
1 Like
Okay, I ran into an issue, 2 actually, but only 1 relates to this. I’ve set up another node that runs after you have clicked on the 6th clickable object, and it runs the dialogue in the node perfectly… but then it repeats in a loop. I’ve tried using the trigger once condition and dialogue isn’t running condtions but it hasn’t worked. This is my event, ended up removing the trigger once condition.
Any thoughts? Sorry if I’m bugging you
I think Scene5Again runs in a loop forever because all of the conditions on the left stay true forever. When Scene5Again has finished, dialogue is briefly not running, and all your other checks are still true. You need something to prevent this loop.
How about a variable that is set to zero initially, but gets changed to 1 when your
‘Start dialogue from branch “Scene5Again”’ action happens?
Conditions:
The global variable StupidSquirrel88 = 0
Branch title “DoorScene5” has been visited
Branch title “FoodScene5” has been visited
etc.
etc.
Actions:
Start dialogue from branch “Scene5Again”
Change the global variable StupidSquirrel88: set to 1
That will stop the event looping because the conditions on the left will no longer all be true, so the actions on the right will only run once.
Then you can do something with that new variable being set to 1, such as check for it in another event that makes something new happen.