Yarn and the dialogue tree doesn't work

So i’ve been following the dialogue tree tutorial of @worriedpixels but i’ve come across a huge problem. The dialogue just refuses to launch and instead freezes my game. Not in a way of it stops responding but instead it just freezes and then keeps going.

Here is the said video :

And here is my events tab :

The stuff that’s supposed to happen in the beginning are in the “Beginning” event group.

Here are the extensions just in case if anyone thinks they might be having a clash :

resim_2023-09-02_152103812

I’m not sure what am i doing wrong here. It’s basically 1:1 except the graphical pointer. According to @worriedpixels on YT comments it works just fine for him but for some reason i can’t get it to work.

Any idea why? Thanks in advance for all the help.

Hi GrocKing,

Your events are not 1:1 with mine. You use two ‘distance to’ events, for example, that are not present in my project.

But the big issue: your ‘dialogue line is text’ event is different from mine and will not work to put text in your text object. Instead of populating a text object, you try to put the dialogue into a global variable called dialogueState. No text will appear in your text object because no event is putting text into it. In my tutorial I use a variable called dialogueState to control what dialogue branch is launched eg. 0: “Hello”, or 1: “We spoke before!”.

Mine:


Yours:

There may be other problems with your set-up, but this was the first one I noticed.

1 Like

Sadly since it’s been a long time before i’ve got an answer i have already made my own dialogue system using the typewriter extension , what i learned while trying to get yarn to work and by modifying a text object. It works pretty well so far. Still haven’t done the options part but i think i can make it work using X Y coordinates or some basic sprites similar to main menu design.

Looks something like this :

But i’ll still try my best to answer questions etc.

If you look closely i actually did use the collision event. That’s just a “leftover code” that just shows “Press “E” to interact” text above the NPC. I was originally using that as a trigger (and am using it on my current system) but just to make sure i used the collision trigger.

Honestly that’s probably the cause. I haven’t really noticed that at all.

I was wondering why it didn’t work at all since it did work when i was looking at older tutorials and the only problem was the text wouldn’t appear in a typewriter effect which was what led me to your tutorial since a lot of people were having the same problem with me on that part.

I could honestly swear that i did it 1:1 and i’ve gone through your tutorial multiple times to check if something is wrong. Call it stress or a burnout from trying to get it work but i guess i just didn’t notice :smiley:

I’ll still stick to my own dialogue system though since i think it’s pretty easy to understand for me. But still thanks for taking your time to answer my question!

I’m sorry it took me a while to reply. I have been away for the week and didn’t have access to my PC. But it seems you found a solution that works for you and that’s great :slight_smile:

I have been using GDevelop for about a year and a half now and I think some of the best learning experiences I’ve had were when something I watched or read didn’t work the way I wanted and I went away and figured it out on my own. Sometimes I end up making something from scratch instead that works better for me, or that I understand better. I made an inventory from scratch because I couldn’t understand the GDevelop examples. It was a brilliant learning experience. It sounds like maybe this happened for you. It’s cool that you made your own dialogue system. Good luck with your game.

1 Like

Honestly, that’s kinda thanks to you. I’ve had no idea that GDevelop had a typewriter extension. Actually found that out after you’ve mentioned it on YT comments. That (and some other guy who also made a system without yarn) pushed me to make my own. Basically just mixed what i learnt from both tutorials :smiley:

Completely agree. I try my best to do it by myself instead of looking at tutorials for every single bit and it made me understand how the engine works so much more. And thanks for the kind words!

1 Like

Just a bit of an update to the situation :

I actually tried to do it again by duplicating my current scene since my own system were having problems. It worked alright-ish with key presses etc. but had a hard time automating it during cutscenes by itself. For some reason typewriter extension couldn’t recognize object variables.

Long story short. After changing the wrong line it still doesn’t work and just stutters my game sadly.

Here are the code lines. Haven’t done the options and speed up part but i’m guessing it should at least work to some extent by this point as it did on yours. Like before, dialogue file is loaded on a different event tab and all the UI elements are hidden there aswell.

One thing I noticed that will trip you up if you get your dialogue to work: these two events will both trigger when dialogueState is 1 and you press Return to end the first dialogue. So the text box will get hidden and you’ll never see your second ‘C4RR13R_End’ dialogue. Use ‘e’ instead of Return for both of your dialogue launch events and keep the Return key just for your dialogue close event (and perhaps other cancel/go back/close type things in your game). That way, launching any dialogue always uses the same button.

Without seeing your whole project it’s hard to say why the dialogue doesn’t work at all. I’m assuming that no text appears, no text background - nothing at all - when you press ‘e’. There’s nothing in your screenshot to explain that. You said that you have some dialogue events ‘on different event tabs’ and I think you mean external event sheets. Something in one of those may be causing the issue. Something isn’t being pulled in when it needs to or perhaps things are not in the right order to trigger properly. Are you linking to the external event sheet from the event sheet you took the screenshot of? A few more thoughts:

  • Try disabling the event that hides everything in your external event sheet. If all the objects show now but there is still no text appearing, then you’ll know that the issue is likely noting to do with the external event sheet’s hide stuff.

  • Do you create the scrollText timer somewhere? If it is not created in an action, the events that need it will never run. I create mine at the beginning of the scene.

  • Check that the text object (‘Text_Dialog’) doesn’t have the typewriter extension behaviour on it from the other system you talked about. Text won’t animate properly if you do because the extension clashes with Yarn’s own typewriter stuff.

  • Be sure that the variable dialogueState is set to zero in the global variables list. If it doesn’t have a starting value of zero your first dialogue will never launch because the condition ‘dialogueState = 0’ isn’t true.

Yep. Exactly what’s happening here. After enabling the UI it just has the default “Text”.

I do have a code at the beginning of the scene to start a scrollText timer yes.

I’ve actually had it before you said it but sadly removing that also did not help.

It’s also set to 0.

Not really sure why it doesn’t work honestly… As far as i’ve noticed the engine is struggling to launch the commands for some reason looking at the stuttering that occurs when i press the button.

If it’ll help here is everything i can show :

Events :

Beginning

Dialogue itself :

Text_Dialog variables :

Global variables :

Everything else in my scene shouldn’t be interfering with the dialogue system as far as i know. Like i said again i’m not sure why it doesn’t work. I can also share the project as a single scene (if i can figure it out how) if that will be any help.

Update :

It’s… fixed? i think it had something to do with the .json file. I edited it to change some text and it’s just fixed by itself for some reason. I guess the file was corrupted and that’s why the engine had trouble launching a dialogue. Never would’ve guessed honestly.