Dialogue [Using Yarn] Issue Help Beginner

Hello!

I’m new to GDevelop and I’m in the process of learning how to make my own game with little to no sense of coding. Currently, making a witching rpg style game. This is what it looks like so far.

So, I’m trying to make my character interact with objects in the room resulting in a textbox pop up. Some of those will have multiple options. I’ve been following tutorials on youtube. Especially this one:
Dialog with Yarn 2022

I did successfully make the first interaction with cauldron. When I copy the format for the pumpkin on the left, of course changing some the sprites and text to match what I want to do, this happens when I talk to the cauldron:

https://gyazo.com/ce61cfb47248cf8f40724380ba6a25c4
https://gyazo.com/410bc574797717ce82e4b789ad19f2aa

and this is what happens when I talked to the pumpkin:
https://gyazo.com/ab43ab00b3800062d2677befd68f92c5

My events page looks like this:
https://gyazo.com/1a43a8036ac2b12039513dbd7f1c2bef
^ (the one that works by itself if the second dialogue added wasn’t there)

https://gyazo.com/2554bd30a6d0c2a6b27d99c80b1128d9
https://gyazo.com/095c0bc448d7d1f3202967c64e9638ca

Yarn Dialogs:

https://gyazo.com/234742a64a24a520c2e5ca8bb7558898

https://gyazo.com/9c20db9e7e5c217122d282187eef3072

Sorry about the formatting of the post, it’s the only way to post multiple links with the limitations.
I don’t know where to find the solution, the other youtube tutorials just show me how to do 1 dialogue in one scene. I plan on making multiple dialogues and events that will trigger and occur. If someone has a better tutorial for what I’m looking for that will be great. [the solution would also be great]

Hopefully, I’m clear about my issue and its an easy thing to fix.

Much appreciated.

Hello. Nice graphics :slight_smile:

Your variable ‘dialogueState’ is used for both dialogue launch events, so I would do a structure variable instead, so your variable would be ‘dialogueState.cauldron’ and ‘dialogueState.pumpkin’. Otherwise, when it changes to 1 for the cauldron it will also be 1 for the pumpkin before you have interacted with the pumpkin for the first time, so you will never see the first pumpkin dialogue. There is only one NPC in my tutorial, so I did not cover how to track multiple NPCs/objects.

BBText tags like [b] won’t work unless you use a BBText object. I only used a regular text object when I made the tutorial, to keep it simple. I cover BBText in other videos, but it’s a pretty straightforward swap.

It won’t be giving you dialogue issues, but I noticed that your activate/deactivate actions are not filled in. You need to put the platformer/top-down behaviour in the red bit, so that the action disables something.

Have you got more than one copy of the text object in your scene? It looks like the dialogue is being copied into two text objects, or one of them is going into your options text object. Make sure that text is not also being copied into your options box each time. In one of your screenshots, where cauldron texts overlaps, it seems to me that the options text object is getting the same text put in it as the regular text object. If you don’t have a separate text object for your options, you need to set that up. I cover that in the tutorial.

I also noticed your json dialogue file doesn’t have a .json on the end, but if the dialogue is displaying it probably isn’t an issue. Mine looks like this, though:
image

Here is how I deal with more than one NPC/object to talk to, and track them both. There is stuff in it that won’t apply to your example, but you can see how I track the dialogue stage, like I talked about at the beginning of my reply. I have three NPCs in this scene and they all work in the same way. I’m experimenting with ‘distance to’ instead of using collisions, so that’s why the two NPCs are a little different. Ignore that.

I hope one or more of these suggestions helps.

Edit: One more thing: you don’t need a separate text object for each dialogue. You only need one text object for all of your main dialogue and then another for your options - so just two text objects for all your dialogue.

OOoh, from the youtuber I’ve been watching O.O
Nice to meet you,

So, I’ve been working at the dialogue event for a while and I’ve fixed my double line issue by adding a “collision condition” when my Dialogue is running. Who knew. Also, the nameTag command isn’t working for me but I’ve found a different way to go about that.

I’ve taking your ‘dialogueState’ advice and implemented in it, its exactly one of the things I wanted to make the dialogue more alive.

The BBtext obj is something I havent tried yet but I have a good sense of what will happen, will add that in soon and I’ve filled the activate/deactivate actions.

The reason why I have created 2 text sprites is because I intend to have 2 types of conversations. Ones with other NPCs, where there will be a nametag so the text will have to be lower and ones where the player is talking to objects for exploration, stuff like, “this is a bed”

When I’ve created the dialogue with the ‘create with yarn’ button, it just showed up like that? It doesn’t seem like it affects anything.

And that’s a great reference. I will be saving that for later in case I need it.
Thanks for the reply, it helps a lot in terms of how gdevelop works and its limitations.


Now, I have some new questions.

I’ve tried adding a second dialogue with options. The first one is working fine.

Working dialogue with options:

Code that was used

But the second one isn’t showing up at all.
The first node worked but the second node doesn’t show up at all.

https://gyazo.com/8d14abe8902998817bdb606e8b58fa92
https://gyazo.com/fbb6d89903b7f006b9e66d96118763fb

Is there a different format or a variable I need to add?

Hi Echo. The reason your second node isn’t launching is because you can’t use spaces in your options answers. Try not_yet instead of not yet, and don’t forget to change the name of the node too, though a new one called not_yet will be created for you if you change the option text in the dialog_yarn_bed1 box.

A few other things about your original issue:

  • Collision checks (e.g. start dialogue if I collide with something) won’t fix dialogue that’s producing double text, so there was probably something else going on. You already had collision checks for launching your dialogue. But I’m glad it’s working now. I see you are experimenting with ‘distance to’. I understand that this is a less intensive check for GDevelop to perform than a collision check, and can help to make a game run better. Sometimes collision checks are what is better for a game, though, but it depends on the type of game and what you want. I am using ‘distance to’ for most of my interactions now because my game isn’t an action game and doesn’t need lots of collision checks happening quickly and constantly.

  • You have created two dialogue state variables, which is good for tracking multiple NPCs/objects properly, but it would be tidier in the long run to use a structure variable. You could call is dialogueStates, and give it a child variable for each NPC/object you want to talk to. Each child would be a number variable. Otherwise, your main list of global variables is going to get very long and the number of things you’ll have to specify in a save file will get longer too. This is how mine looks, but you can call things anything you want.

In my events I reference the values with npcDialogueStage.npcOne and npcDialogueStage.npcTwo.

image

  • I believe Yarn itself can handle remembering dialogue states (what choices are made in options etc.), but I prefer to track dialogue stuff myself with the dialogueState variable. The way I have done it in the video is only one solution.

  • There is no problem having as many text objects as you like in your dialogue set-up, but I mentioned it yesterday because you were having an issue with double text appearing and I thought it might be a possible cause. It’s not a problem in itself. There isn’t a rule about only having 1 box for main dialogue and 1 for options. It’s just a simple way of doing it that will be enough for some games.

Yarn can be a tricky thing, which is why I made the video once I figured it out. But I don’t know everything about it - far from it. There are things it can do that I haven’t used.

Happy dialogue-ing!