Cute and Simple Dialog Box | Let's Godot

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ก.ค. 2023
  • Taking inspiration from 2019's hit indie game A Short Hike, let's make a very clean and easy textbox. All we need is a textbox scene and a dialog manager to get talking NPCs for our Godot indie game. :)
    🎵 Tropicala - ConcernedApe
    🎵 The Sun Can Bend an Orange Sky - ConcernedApe

ความคิดเห็น • 405

  • @samlee5774
    @samlee5774 9 หลายเดือนก่อน +21

    This is wild, i've been trying to do this ages but never thought to await resized. Thanks!

  • @mewithoutYou52
    @mewithoutYou52 หลายเดือนก่อน +4

    For anyone whose text box is appearing on the top left corner of the scene instead of above the NPC, be sure you're passing the correct node's global_position into the start_dialog function in your scene. Since I was attaching it to an AnimatedSprite2D inside a scene instead of attaching it to a root node it wasn't seeing the NPC's position to pass to the text box.

  • @ian8448
    @ian8448 6 หลายเดือนก่อน +17

    If you want to be able to change the scale of the text box and it still to be in the correct position compared to who is saying it:
    In the textbox display_text() function when you set global_position.x and y multiply it by the scale.x or scale.y accordingly.
    ex: global_position.y -= (size.y + 24)*scale.y

    • @DonTheDevMC
      @DonTheDevMC 6 หลายเดือนก่อน +1

      Life saver you are

  • @Pablito_Dev
    @Pablito_Dev 8 หลายเดือนก่อน +4

    Works Perfect! thank you so much, im new at gameDev and godot so this was super helpful !

  • @bluemelonstudio
    @bluemelonstudio 5 หลายเดือนก่อน +2

    Thanks friend for sharing, your tutorials are amazing

  • @notoreofreakshake
    @notoreofreakshake 8 หลายเดือนก่อน +2

    instant sub, no hesitation. great video!

  • @ianjameshouse
    @ianjameshouse 5 หลายเดือนก่อน +1

    This is amazing, thank you

  • @ricanamvs3390
    @ricanamvs3390 ปีที่แล้ว +24

    I'm really liking your godot videos. Do you plan to continue the tutorials?
    Thanks from Brazil

    • @DashNothing
      @DashNothing  ปีที่แล้ว +13

      Thank you! Yeah, I'm working to get a video out every week

  • @dhdr27
    @dhdr27 หลายเดือนก่อน +3

    If I have the start dialogue und continue dialogue on the same button. The dialogue finished and starts immediately again. I try making a workaround with a timer and a var = chat_finished but it doesn’t work.

  • @TheArsonistGamer
    @TheArsonistGamer 9 หลายเดือนก่อน +8

    Followed everything in half speed, did everything i THINK right, but when i run i get an error that states :Invalid set index 'interact' (on base: 'null instance') with value of type 'Callable'. (It highlights my onready function func _ready():
    interaction_area.interact = Callable(self, "_on_interact")

    • @sims_berner
      @sims_berner 7 หลายเดือนก่อน +5

      i hate that he talks so fast. these are great tutorials, but run so fast it's hard to keep up and understand what's happening.

    • @DashNothing
      @DashNothing  6 หลายเดือนก่อน

      For anyone getting this error - make sure you get your interaction area node with @onready var interaction_area = $InteractionArea and that it's in your scene

    • @yxgen4
      @yxgen4 4 หลายเดือนก่อน

      are you using godot 4? I had this error but I was using godot 3.5

  • @hirador3879
    @hirador3879 8 หลายเดือนก่อน +2

    Useful and good tutorial. 👍

  • @JackDaloots
    @JackDaloots 10 หลายเดือนก่อน +1

    Nice nostalgia from the water level of Mario 64 :D

  • @NDragonGames
    @NDragonGames 10 หลายเดือนก่อน +4

    This video gave me headache :)
    But it worked at the end haha

  • @brensnorf
    @brensnorf 5 หลายเดือนก่อน +2

    I'm having a slight issue if you have any ideas on how to help; one of the places i'm trying to use the dialogue manager in game is a menu that runs while the game is paused. while I’ve been able to find alternate solutions to the "needs to be unpaused" elements, queue_free() in specific is my final hurdle from what I can tell. (at least, I assume queue_free() only works when the game is unpaused... anyways, are there any alternatives to queue_free() that may work when the game is paused?

    • @DashNothing
      @DashNothing  5 หลายเดือนก่อน +1

      I'm not sure, but you can try using free() instead of queue_free() as it doesn't wait until the next frame to free an object.
      But unfortunately, I think the bast course of action is to implement a custom time scale that will only affect specific nodes. It would work by multiplying their velocities, animation speeds, and whatever else needs to be paused, by a custom time scale amount. They eill effectively be paused, while your UI and audio will work like normal.

  • @jboadas
    @jboadas ปีที่แล้ว +5

    Nice tutorial, thanks.

  • @heylavenderbee
    @heylavenderbee 10 หลายเดือนก่อน +3

    Thank you so much for this tutorial!
    There's only an error that I just couldn't fix...
    When you use the connect function in the DialogueManager, connecting 'text_box.finished_displaying' to '_on_text_box_finished_displaying', it just doesnt work for me
    This is the error message: Invalid get index 'finished_displaying' (on base: 'MarginContainer').
    I guess that means that it has something to do that I may wrote the name wrong or something.. but I really don't know, could you help?

    • @DashNothing
      @DashNothing  10 หลายเดือนก่อน +1

      I'm glad you enjoyed the video!
      Check if your finished_displaying signal in text_box.gd is spelled correctly. It needs to be spelled the same in text_box.gd and in DialogManager.gd when you connect it.

    • @MudpuppyGames-zn2qw
      @MudpuppyGames-zn2qw 6 หลายเดือนก่อน +2

      after a LOT of trial and error, for me the problem was that the preload("the_text_box_location.scn") was not the actual MarginContainer with the script but a parent node, therefore it couldn't load the proper script because it was searching one node above it.
      to fix this, i made the branch with the TextBox and its children a seperacte scene and preloaded that scene instead

  • @ItzAstroTheNoob
    @ItzAstroTheNoob 4 หลายเดือนก่อน +5

    Thx! this helped me a lot on my Indie game (even tho all the code gets me tired 😅)

  • @looves132009
    @looves132009 8 หลายเดือนก่อน +4

    I love following your tutorials! I just have one issue I'd love your advice on. The "[E] to interact" label still appears on top of my dialogue box. How can I make it so once I hit the interact input, the label disappears so I can read the dialogue box without the "[E] to interact" text appearing on top?

    • @DashNothing
      @DashNothing  8 หลายเดือนก่อน +1

      Thank you!
      In your _input(event) function you'd get the label like $Label and call .hide() on it to hide it.
      In the _ready() function you would connect to DialogManager's dialog_finished signal and in the callback function call $Label.show() to show it again..

  • @ddmp_er
    @ddmp_er 10 หลายเดือนก่อน +3

    thx for tutorial! i used this in godot 3.5 but i have some questions
    in code u use "await resized" in margin container but godot 3.5 don't have this method. what i can do?

    • @DashNothing
      @DashNothing  10 หลายเดือนก่อน +3

      You can use yield(self, "resized") and it will work exactly the same. Hope that helps!

    • @ddmp_er
      @ddmp_er 10 หลายเดือนก่อน

      thanks! it's work@@DashNothing

    • @mgomezmunoz92
      @mgomezmunoz92 9 หลายเดือนก่อน

      @@DashNothing I am using godot 3.5 and "custom_minimum_size" is not recognized, any idea?

    • @DashNothing
      @DashNothing  9 หลายเดือนก่อน

      @@mgomezmunoz92 I think you can use rect_min_size

  • @godotology
    @godotology 9 หลายเดือนก่อน +5

    Very very good tutorial . Your work is next level .
    Can you make tutorial about scroll container in godot 4 ??

    • @DashNothing
      @DashNothing  9 หลายเดือนก่อน +3

      Thank you. You can see a use of scroll contaimer in my newest video about keybinding, where we use it to get a scrollable list of buttons. Is there anything specific about it that you would like to see?

  • @Just_an_animator
    @Just_an_animator 3 หลายเดือนก่อน

    Thank you SM bro

  • @unconscious5630
    @unconscious5630 7 หลายเดือนก่อน +1

    With long texts in my dialog the size.y after the two awaits only ever is 88, never greater, even if the text makes the box larger than that. This causes the text bubble to grow as more letters are added to it rather than stay the same size. Do you know why this could be happening?

    • @DashNothing
      @DashNothing  7 หลายเดือนก่อน

      I experimented and I couldn't recreate your problem. Is the number 88 something you use in a different place (like MAX_WIDTH)? Also ehat version of Godot are you using?

  • @EliSprinkle
    @EliSprinkle 7 หลายเดือนก่อน +3

    A more in depth look at the test guy script would be appreciated! i followed the interaction manager and dialog manger videos and still a little bit confused.
    i see there is 2 signals on the test guy script for _on_interaction_area_body_entered and exited. i tried creating finding those signal in the node tab under the interactionarea object.
    where does the "InteractionLabel" come from??? is that a @onready var as well? much thanks!

    • @DashNothing
      @DashNothing  7 หลายเดือนก่อน +1

      I didn't go in depth with it because I only wanted to demonstrate the text box, whereas the interaction system I left up to the viewer. That being said, the system I had for this video was a bit hacky, with the InteractionLabel being a singleton any object can reposition. All in all I wouldn't recommend it.
      But if you're interested, I recommend the interaction system from this video:
      th-cam.com/video/ajCraxGAeYU/w-d-xo.htmlsi=T55JLX8nxWCiYC2b
      It's a very flexible system and works well with the dialog system from this video.

    • @EliSprinkle
      @EliSprinkle 7 หลายเดือนก่อน

      i have all the scripts written up with no errors, it is the implementation i am having trouble with. i have DialogManger, InteractionManager, InteractionArea scripts and object all good to go.@@DashNothing

    • @EliSprinkle
      @EliSprinkle 7 หลายเดือนก่อน

      is there a way a better way i can contact you? i really wanna implement your way of dialog and im a inch away from getting it to work@@DashNothing

  • @m1chael_dev
    @m1chael_dev 10 หลายเดือนก่อน +1

    Its a really neat tutorial. Do you know how this can be implemented for 3d games? Thanks

    • @DashNothing
      @DashNothing  10 หลายเดือนก่อน

      To display the text box in 3D you could use the Sprite3D node and assign it a viewport texture to render a viewport with the UI. Here's an example for Godot 3.5, but the general method is the same for Godot 4: godotengine.org/asset-library/asset/127

  • @Dr4w.
    @Dr4w. 6 หลายเดือนก่อน +1

    A Good Tutorial Although one Problem i keep getting is Identifier "_on_text_box_finished_displaying" not declared in the current scope. i don't know why but is there a way to fix it?

    • @DashNothing
      @DashNothing  6 หลายเดือนก่อน

      9:37
      Did you forget to implement this function? Or maybe you misspelled the name?

  • @Jdaucfqluoess
    @Jdaucfqluoess 3 หลายเดือนก่อน +1

    I love it, just implemented it in my game. Question anyone : how would you prevent the player to move during the dialog ? is there a way to capture the input event ?

    • @DashNothing
      @DashNothing  3 หลายเดือนก่อน +2

      I implemented that feature in the follow up video to this one. Basically, I just call player.set_process(false) when the dialog starts and player.set_process(true) when it finishes.

    • @Jdaucfqluoess
      @Jdaucfqluoess 3 หลายเดือนก่อน

      @@DashNothing tranks, I just looked the next video. Actually you check DialogManager.is_dialog_active at the beginning of _process.

  • @TurtleSensor
    @TurtleSensor 4 หลายเดือนก่อน +1

    I'm not sure where I messed up, but I don't see the textbox UI appear? I added some prints and I can see it printing to console the text lines and responding to my taps

    • @yxgen4
      @yxgen4 4 หลายเดือนก่อน

      it might be behind your current layer!

  • @rodneyyt-lf4rd
    @rodneyyt-lf4rd 4 หลายเดือนก่อน

    Good vid, its working for the most part. For some reason, when i get to the sixth line in my seven line array, the textbox offsets to the bottom right, no longer accepts input to advance lines, and the text immediately displays all of itself instead of reading letter by letter. im not sure what to look at first to figure this out.

    • @DashNothing
      @DashNothing  4 หลายเดือนก่อน

      There is a problem with short lines that block the text box because the label is not wide enough to trigger a resize. Could it be that ykur sixth line is only a few characters long?

  • @luckyknot
    @luckyknot 4 หลายเดือนก่อน

    This tutorial was excellent, very well explained and enjoyable to follow along! I'm working on dialogues that have different branching. how would you go about adding conditions and in-game variables that can affect/be affected by dialogues, branching to a new line or entire new text? Maybe it's solvabe with a 2D array? so the first order would store the dialogue line, and the second order of the array would save a certain number of variables? it's seems that things can start getting a bit unmanageable though...

    • @DashNothing
      @DashNothing  4 หลายเดือนก่อน +1

      Thank you!
      I thought about it, and even though this is off the cuff, this is the direction I'd go in:
      - No, don't use nested arrays because the nesting would go crazy even at a few branching options.
      - There are tools to visually edit dialogs or ones that use a scripting language made for creating text based games with branching paths. You can find these in the Godot asset library.
      - If you want to do a quick custom implementation because your use case isn't too complicated (and I respect that and would probably do the same), I'd make seperate array variables for each branch of the dialog. For the lines where there's a decision to make I'd use a dictionary with the reference to the lines array a choice will lead to. Example:
      var hello = [
      "Hey!",
      {
      text: "How are you?",
      choices: [
      {
      text: "Good",
      next: goodResponse,
      },
      {
      text: "Bad",
      next: badResponse,
      },
      {
      text: "ATTACK",
      condition: player.has_weapon(),
      func: aggro_target(player)
      }
      ]
      }
      ]
      var goodResponse = [
      "I'm glad!"
      ]
      var badResponse = [
      "Sorry to hear that"
      ]
      I'd love to try to make that work. Hope this helps!

    • @luckyknot
      @luckyknot 4 หลายเดือนก่อน

      @@DashNothing Thanks for taking the time to reply and write this example, After thinking about it, as I have many text and branching, to make it easier to manage and edit I think that I will go with a Google Sheet, a tab will be a scene that contains all the dialogues for that scene. Each scene will have a column to jump to a relative row or ID in another scene if needed, so if I move a row (dialogue line) that contains a jump, the reference should not break as it´s relative. Then parse it all to a csv with the proper data, and import into the game as a List of Arrays. I'll give it more thought let's see, thanks again!

  • @lambilla14
    @lambilla14 9 หลายเดือนก่อน +1

    So cool video! But it dont work in my project, it doesnt give me an error it just appear the first thext and then stop working.

    • @DashNothing
      @DashNothing  9 หลายเดือนก่อน +1

      Shame you couldn't make it work, but I'm glad you enjoyed the vid

  • @aidenquinn3329
    @aidenquinn3329 3 หลายเดือนก่อน

    I got the textbox to work but now I want it to spawn under the player when I enable it, is there any way of doing this. Until than Imma just keep trying till it works.

  • @user-de9fj1gu2k
    @user-de9fj1gu2k 5 หลายเดือนก่อน +1

    hello thank you so much for your video but the problem now is how to make that text shown up when i interact with characters i am still a beginner and i don't know how to do that

    • @DashNothing
      @DashNothing  5 หลายเดือนก่อน +2

      I got a video for that too: th-cam.com/video/ajCraxGAeYU/w-d-xo.htmlsi=gaVv8iO0qUEoLaLk

    • @user-de9fj1gu2k
      @user-de9fj1gu2k 5 หลายเดือนก่อน +1

      @@DashNothing thank you so much

  • @lucaortolani6907
    @lucaortolani6907 5 หลายเดือนก่อน +1

    Hi! Thanks for the tutorial!
    I get an error at runtime on the text_box script at line 23:
    label.text = text_to_display
    "invalid set index 'text' (on base: 'nil') with value of type 'String'"
    You know what the cause might be? Thanks

    • @DashNothing
      @DashNothing  5 หลายเดือนก่อน +1

      Thanks!
      The error means that the label var is null. Check if you get the label correctly on the @onready var line. Either the path to the label or the label node name is wrong.

    • @lucaortolani6907
      @lucaortolani6907 4 หลายเดือนก่อน +3

      Thanks for the reply. The problem was I was starting the conversation calling the dialogueManager from the _ready() function of a npc i created...@@DashNothing

    • @braxtonsdev9564
      @braxtonsdev9564 4 หลายเดือนก่อน +1

      @@lucaortolani6907 had the same issue, thx for replying with fix

  • @trenom
    @trenom 10 หลายเดือนก่อน +2

    what is the equivalent of the await keyword in godot 3.5? is it "yield()" ?

    • @DashNothing
      @DashNothing  10 หลายเดือนก่อน

      Yes, it's yield()

    • @trenom
      @trenom 10 หลายเดือนก่อน

      @@DashNothing thanks!

  • @Danny1981able
    @Danny1981able 7 หลายเดือนก่อน +1

    Where do you put the InteractionLabel code? I know its an anutoload but I don't see it when its built and I'm having problems with my project.

    • @DashNothing
      @DashNothing  7 หลายเดือนก่อน +1

      For this video I made a scene called InteractionLabel of type label and a script attached to it with a function to show and hide the label. Then I autoloaded that scene (you can autoload scenes as well as scripts which is quite nice).
      This approach isn't the best and I only did it as a quick and dirty way of getting the point across for the focus of this video, which is the dialog system.
      If you are interested in an easy and flexible interaction system that works with the dialog system from this video, check this out: th-cam.com/video/ajCraxGAeYU/w-d-xo.htmlsi=uiRgGisX6dkcqGpr

  • @LMach1
    @LMach1 หลายเดือนก่อน

    Using Godot 4.2 I got this working. Very fun way of typing out text. However, I was hoping to add in a RichTextLabel to use BBCode. I tried a few things with mixed results. The best I could do is have a ColorRect over the label and the RichLabel on top. Does anyone know what would a good way to make RichLabelText work?

    • @DashNothing
      @DashNothing  หลายเดือนก่อน +1

      I actually did figure out how to adapt the rich text label into this over on my discord. It's actually pretty simple. If you're interested join and shoot me a message and I'll point you to it.

    • @LMach1
      @LMach1 หลายเดือนก่อน

      @@DashNothing Awesome, done and done. Thank you.

  • @sabajoglidze9823
    @sabajoglidze9823 2 หลายเดือนก่อน +3

    great tutorial but i have problem when i call functon game crashes so i cant even see whats the problem any idea what could cause it?

    • @DashNothing
      @DashNothing  2 หลายเดือนก่อน +1

      You get an error in the debugger window at the bottom center of Godot when a crash happens. You will see what caused it in red text.

    • @sabajoglidze9823
      @sabajoglidze9823 2 หลายเดือนก่อน

      @@DashNothing godot crushes with game

    • @DashNothing
      @DashNothing  2 หลายเดือนก่อน

      @@sabajoglidze9823 Oh that is not normal. Best you can do is report an issue on Github.

  • @TheTrueUnknownCoder
    @TheTrueUnknownCoder 6 หลายเดือนก่อน +1

    Great tutoriel! I haven't managed to make it work, evry time I run my code this error pops up:Invalid set index 'text' (on base: 'Nil') with value of type 'String'.
    Does anyone know how to fix this?

    • @DashNothing
      @DashNothing  6 หลายเดือนก่อน

      Seems like you don't have a reference to the label when you try to set its text. You should get the label at the top of the script with @onready. Make sure the name is correct, as it is in the scene tree (in case you renamed it).

    • @TheTrueUnknownCoder
      @TheTrueUnknownCoder 6 หลายเดือนก่อน

      @@DashNothing I checked but still (also thanks for the quik answer)

  • @smillbag97
    @smillbag97 5 หลายเดือนก่อน +1

    Great tutorial. Thank you for all the help!
    One problem I ran into is continuing to the next line of dialogue. My NPC just sits there on the first line of dialogue and doesn't continue. 😢 E to interact works and the label disappears, I just cant di anything for that point on

    • @DashNothing
      @DashNothing  5 หลายเดือนก่อน +1

      I'm not sure I understamd the problem. Does the first line text disappear, but the next one doesn't appear? What about the textbox? Can you make sure your current_line_index gets incremented by writing some print statements?

    • @smillbag97
      @smillbag97 5 หลายเดือนก่อน

      @DashNothing the textbox and the first line of dialogue appear. However, the subsequent lines do not appear and the textbox is stuck above the NPC with the first line of dialogue. I will check the current_line-index tomorrow night and get back to you!

    • @zavtronesegodnya
      @zavtronesegodnya 4 หลายเดือนก่อน

      How can I make a dialogue appear when I interact with an NPC?

  • @Horsehater500
    @Horsehater500 3 หลายเดือนก่อน +1

    This works sort of perfectly for me! Only issue is that it covers up the entire sprite? Not sure how to fix that

    • @DashNothing
      @DashNothing  3 หลายเดือนก่อน +1

      The text box covers the sprite? You can set a greater position.y offset in the show_textbox function. I put -24 because it worked for my sprite, but feel free to adjust that.

    • @Horsehater500
      @Horsehater500 3 หลายเดือนก่อน

      @@DashNothingOH Thank you! I don't know why ididnt think of that lol

  • @Flumbingus
    @Flumbingus 3 หลายเดือนก่อน

    love this style of game dialog! but I was wondering if you knew a way to incorporate bbcode into the text? changing the label into a richtextlabel works and everything but I don't want the bbcode to be printed in the textbox along with the dialog, do you know if there's a way to make it skip the bbcode syntax so it doesn't get printed out?

    • @DashNothing
      @DashNothing  3 หลายเดือนก่อน +2

      Thanks! I would have to look into it, but I'd say you'd have to add the open and close bbcode tags into the label before showing the first letter of the line. At the dame time you'd have to change the string in the lines array to remove the bbcode tags. Then if the letters get put in between the tags in the rich text label I imagine it would work.
      Sounds like a good topic for a video, I'll keep it in mind.

  • @devon674
    @devon674 8 หลายเดือนก่อน +4

    so totally just let this minutiae consume my entire evening but if anyone else is confused by this, I thought for a very long time my NinePatchRect texture wasn't working properly, and spent a ton of time trying to fix a problem that wasn't there: what I was doing was using the scale mode tool, instead of using select mode to click and dragon the corner of the Textbox margin container. if this saves everyone, don't be like me. if you use the scale mode tool, it makes it look like the NinePatchRect is refusing to tile and scaling instead and looks like shit. I had to finally stop the video at the exact right instant and actually LOOK at what mode the editor was in.
    anyway um, I will continue with the tutorial now haha.

    • @DashNothing
      @DashNothing  8 หลายเดือนก่อน +1

      Oof I know that feeling

    • @willd2609
      @willd2609 หลายเดือนก่อน

      yeah i have spent an hour just trying to figure out why mine isn't working. Would love to see the source code for this project DashNothing!

  • @RoadSquid
    @RoadSquid 9 หลายเดือนก่อน

    I get an error on the sprite.flip_h line at the end that says “expected else after ternary operator condition

    • @DashNothing
      @DashNothing  9 หลายเดือนก่อน

      Yeah, that line is cut off in the video because it uses stuff like interaction_area which wasn't covered in the video and might not work for you.
      But the error happens because when you use a ternary operator you have to write it as "if ... else ..." all in one line.

  • @DRUYD
    @DRUYD 6 หลายเดือนก่อน +5

    Great video, thanks!
    I had one small issue though, if the text is very short (less than 5 characters), it seems like the first "await resize" doesn't behave as I'd expect, I can't explain why, but it causes the text box to never go away. I fixed it by setting a min length to run that first resize
    if (text.length() > MIN_WIDTH):
    await resized
    If anyone knows of a better approach or can explain why this happens I'd be really happy to understand this better.

    • @user-ih3jm1dk7d
      @user-ih3jm1dk7d 5 หลายเดือนก่อน +1

      bro can you tell me your MIN_WIDTH value? i also meet this problem, i want to fix it

    • @DRUYD
      @DRUYD 5 หลายเดือนก่อน

      ​ @user-ih3jm1dk7d sure, I've set it to 5 and that seems to work for me. I don't fully understand the details of it though so you might need a different value. I hope it helps.
      edit: to clarify, MIN_WIDTH is not a great name for it, as it is minimum text length really. I've set it to 5, as in 5 characters.
      So, if the text is longer than 5 characters, then it does the "await resized", otherwise it skips it. I'm still unaware of the larger implications of this or the underlying reason, but so far I haven't had any issues. If you gain some insight let me know as I'm interested :)

    • @booba_game
      @booba_game 5 หลายเดือนก่อน +1

      Problem is in "await resized", because "resized" is a signal. And for example, if you have margin container, that is bigger than whats inside of it, it doesnt emit a signal and code doesn't go any further

    • @DRUYD
      @DRUYD 5 หลายเดือนก่อน

      @@booba_game that makes a lot of sense, I'll check this when I go back to my project and see how to clean it up so this behaviour is clearer.
      Thanks!

    • @Tech-ib6wg
      @Tech-ib6wg 5 หลายเดือนก่อน

      I had the same issue. Regardless of the min width, this will also happen if two consecutive lines of text are the exact same length (same character count). I solved it by only awaiting when the dialog_lines[current_line_index].length() is different from the previous length (current_line_index - 1). Although this would not catch the scenario some of you described where the the text is less than the min width.

  • @Mazzolli
    @Mazzolli 8 หลายเดือนก่อน

    Very informative video! Thank you! I haven't managed to make it fully work yet... Could you tell me what's the code at the very top if test_guy´s script?

    • @DashNothing
      @DashNothing  8 หลายเดือนก่อน +1

      There's an @onready var sprite = $AnimatedSprite2D to do the turning toward the player and @onready var speech_sound = preload(...) that preloads the short sound that is the last parameter of DialogManager.start_dialog()

    • @Mazzolli
      @Mazzolli 8 หลายเดือนก่อน

      @@DashNothing I think it´s fixed now: The dialog box was being shown all at once, in the wrong place, and it didn´t advance... But removing the "await resized" in line 25 fixed all of that! I'm not sure why xD

  • @AlefeMarinhoFutebol
    @AlefeMarinhoFutebol 7 วันที่ผ่านมา

    What would be the script used in the Interaction Label as it was not shown in the video

  • @bellehuberty9457
    @bellehuberty9457 2 หลายเดือนก่อน

    Thank you so much for the free tutorial! Incredibly useful and easy to follow. Do you or anyone else in the comments have any advice on how we should add the dialogue to objects/scenes in our game? That part was glossed over a bit and I'm a noob who would like more information. Thank you!

    • @DashNothing
      @DashNothing  2 หลายเดือนก่อน +1

      I used this dialog system in my interaction tutorial. Cgeck it out: th-cam.com/video/ajCraxGAeYU/w-d-xo.htmlsi=7se_B4-1Hp8oDC06

    • @bellehuberty9457
      @bellehuberty9457 2 หลายเดือนก่อน

      @@DashNothing awesome, thank you again!!

  • @MistForgeStudios
    @MistForgeStudios หลายเดือนก่อน

    Hello! really enjoyed the videos for the dialog and interact systems! I am running into an issue though. I have a test guy to interact with, he has line size of 4, and after i talk to him, after the second time I advance_dialog, it breaks and wont let me continue. I am not sure why this is happening. my dialog_lines.size() is 4 and my current line index is 2 when it happens. Also the text box changes location after I advance after the second box. Super confused and unsure on why this is happening and the solution. Been going through all the videos in regards to the dialog system and can't seem to find a solution to this... Any help would be awesome!

    • @DashNothing
      @DashNothing  หลายเดือนก่อน

      How long is the third line, then one that doesn't get displayed? There is a problem with short lines because the two resized signals of the textbox don't get called.

    • @MistForgeStudios
      @MistForgeStudios หลายเดือนก่อน

      @@DashNothing third line is longer than the second line, the third textbox does show up but bugs out and changes location of previous textbox. But then I am unable to continue.

    • @DashNothing
      @DashNothing  หลายเดือนก่อน

      @@MistForgeStudios I haven't encountered that so far. Are there any special characters in the third one? What if you switch the third and second line? Does it get displayed then?

    • @MistForgeStudios
      @MistForgeStudios หลายเดือนก่อน

      ​@@DashNothing Out of some strange trial and error, I commented out the line 25 - await resized, and now it works. I have no idea why that would make it work or why that would cause it to bug out. But yeah. it now works. weird. Also, thank you for the quick responses! :)

  • @willd2609
    @willd2609 หลายเดือนก่อน +1

    please please please post the source code for this. I have tried to follow the instructions pausing the video every few seconds and i can't get the dialog box to display correctly. I am sure it's one little checkbox somewhere but I can't see where.

  • @GreedFeed
    @GreedFeed 5 หลายเดือนก่อน +2

    I’m confused. Where is that resized signal coming from?

  • @sixsalt1406
    @sixsalt1406 4 หลายเดือนก่อน +1

    Hello, so I noticed you didn't show how you made your interaction label class and subclasses, I was wondering if this was in a previous video?

    • @DashNothing
      @DashNothing  4 หลายเดือนก่อน +1

      I made the tutorial for the label and thr whole interaction system here th-cam.com/video/ajCraxGAeYU/w-d-xo.htmlsi=maNwZcsNesei19qb

  • @florantheplant
    @florantheplant 11 หลายเดือนก่อน +1

    At the end, you show a script of how to have a reference to DialogManager. But I don't know how to do the @onready for DialogManager correctly. How did you write it?

    • @DashNothing
      @DashNothing  11 หลายเดือนก่อน +2

      In the beginning I went to Project settings -> Autoload and loaded the DialogManager.gd script.
      This makes it available in all scripts in your project, so you don't need to load it with @onready, just call DialogManager from anywhere. You'll know you set it up correctly if Godot gives you autocomplete suggestion for DialogManager when you start typing.
      Hope that helps!

    • @DashNothing
      @DashNothing  11 หลายเดือนก่อน +2

      @@vindhyaganti9738 You can see the whole DialogManager script in the video. My commenz above didn't include a link, but TH-cam recognized the words DialogManager(dot)gd as one. Sorry for the confusion :)

    • @vindhyaganti9738
      @vindhyaganti9738 11 หลายเดือนก่อน +2

      @@DashNothing Thank you so much! Just finished the tutorial, but when I try to add the "DialogManager.start_dialog(global_position, lines)" to my player script, I get the error that "lines" is not declared in the current scope. How do I resolve this?

    • @DashNothing
      @DashNothing  11 หลายเดือนก่อน +1

      @@vindhyaganti9738 Make sure your var lines is declared at the top of the script, along with your other variables. This way all functions will have access to lines. If you declared lines inside a function, other functions will not be able to use it

  • @falkherbig4394
    @falkherbig4394 7 หลายเดือนก่อน

    Everything works great, but when I interact, the dialog box spawns at the origin of the scene. It doesn't seem the give the global position. This is the code:
    extends Sprite2D
    const lines: Array[String] = [
    "Hello World",
    "This is a test"
    ]
    func _process(delta):
    if Input.is_action_just_pressed("advance_dialog"):
    DialogueManager.start_dialog(global_position, lines)

    • @DashNothing
      @DashNothing  7 หลายเดือนก่อน

      In a line before DialogManager.start_dialog(...) can you write print(global_position) and in the output see if the position is correct. It should be something other than 0, 0.
      If that is correct, the problem is probably within the dialog manager's start_dialog function where it sets the textbox's position.

    • @falkherbig4394
      @falkherbig4394 7 หลายเดือนก่อน +1

      @@DashNothingOh, man. I am so stupid. I just forgot the line during 9:19 ...
      Thanks for the quick help👍 earned a sub

  • @dinox8vc46
    @dinox8vc46 11 หลายเดือนก่อน +1

    why cant I find TextBox but only TextEdit and it doesnt work if i use TextEdit

    • @DashNothing
      @DashNothing  11 หลายเดือนก่อน +1

      TextBox isn't a node right out of the box in Godot, instead you can use a Label node with a NinePatchRect node to make your own text box, just like in the video :)

    • @dinox8vc46
      @dinox8vc46 11 หลายเดือนก่อน

      Thanks now it works, great tutorial!@@DashNothing

  • @Zap-Plays
    @Zap-Plays 7 หลายเดือนก่อน

    Another excellent tutorial.
    I am unfortunately running into an issue. I'm not getting any errors, but when I go up to the npc character and press [E] to interact... Nothing happens. I fixed all the errors I was getting with the other tutorial, and I don't see any differences in code with this tutorial and my own. Is there something I'm missing? If you could help, that be greatly appreciated.

    • @DashNothing
      @DashNothing  7 หลายเดือนก่อน +1

      With the interaction system from the other video you should be able to just call DialogManager.start_dialog() in the object you want to interact with. Like it was shown at the end of that video.
      You can add a print() at the beginning of your npc's interact function and see if the gsme even gets to that point.

    • @Zap-Plays
      @Zap-Plays 7 หลายเดือนก่อน +1

      @@DashNothing @DashNothing DialogManager.start_dialog() is being called in my npc's script, but as I implemented the print() to my npc's interact func, it appears nothing is happening.
      I'm going to try again from scratch on a new file, because I honestly don't know why the text box isn't showing up above my npc when they're at least flip_h when I interact from both sides.

  • @danbryandalisay8547
    @danbryandalisay8547 7 หลายเดือนก่อน

    My solo npc dialogue its working fine but when i add another npc, both of them the dialogue are not working and not showing like pop up then disappear immediately 😞
    Sorry my for grammar 😅

    • @DashNothing
      @DashNothing  7 หลายเดือนก่อน +2

      This happens because there is no check to see which npc is closer to the player before starting the dialogue, so both start it at the same time. You need to implement some sort of interaction system to handle interactions by distance to the player. Or you can check out my interaction system which works well with this dialogue system here th-cam.com/video/ajCraxGAeYU/w-d-xo.htmlsi=uiRgGisX6dkcqGpr

  • @fempie9417
    @fempie9417 23 วันที่ผ่านมา +2

    Hey, my words dont move as they should. Only the box appears witht he text already in it. Also, when i press space the dialog doesn't advance, it just displays the first line and is stuck there. I have made "advance_dialog" an input.

    • @Ghostabo
      @Ghostabo 10 ชั่วโมงที่ผ่านมา

      make the "default" text box super thin. it seems this bug happens when a line is too short to trigger a line break, so resizing the box is one solution

  • @kacpereee8181
    @kacpereee8181 2 หลายเดือนก่อน

    Hello, love the tutorials. I get en error on line 20 on textbox file. "Invalid set index 'text' (on base: 'Nil') with value of type 'String'.". I type everything as in video but it seems that when I use label.text I get nothing.
    The label var is set as @onready so there shouldnt be a problem

    • @DashNothing
      @DashNothing  2 หลายเดือนก่อน +1

      Make sure that the path to the label after $ in the @onready line is correct. Seems like Godot couldn't find your label at the path you provided and instead returns null.

    • @kacpereee8181
      @kacpereee8181 2 หลายเดือนก่อน

      @@DashNothing Yes, I tripple checked that in the first place. I even right clicked on the Label and copied its path to ensure that I don't make any typos. :/ Thats why I wrote the comment

    • @DashNothing
      @DashNothing  2 หลายเดือนก่อน

      @@kacpereee8181 You can check what's stored in var label by writing print(label) in the _ready() func to see if it was fetched. If it is in there, but it's null when you try to assign text, it could be that the variable is changed somewhere in the code.

  • @zeroxxero5651
    @zeroxxero5651 4 หลายเดือนก่อน

    Hey great Video!
    I followed along your Tutorial and managed to display the First Message, but the second message just pops up with the next text in a slightly different location and the scale from the previous text and doesn't want to advance further.
    I printed in the _unhandled_input(event)
    can_advance_line and is_dialog_active
    and can_advance_line seems to be at false and I don't understand why

    • @DashNothing
      @DashNothing  4 หลายเดือนก่อน +1

      I noticed I get the same thing happening if the line is only one letter long. Is this the case for your second line?

    • @zeroxxero5651
      @zeroxxero5651 4 หลายเดือนก่อน

      @@DashNothingIt was just one Test Word but after changing it to a whole sentence it works just perfectly now!

    • @DashNothing
      @DashNothing  4 หลายเดือนก่อน +1

      @@zeroxxero5651 I found that changing the DialogManager's show_text_box function so can_advance_line is above text_box.display_text() line fixes this issue. So with that you can also have one letter lines (for example sometimes you'd like to just show "!").

    • @zeroxxero5651
      @zeroxxero5651 4 หลายเดือนก่อน

      @@DashNothingyou're a hero! everything works fine now! thank you for your fast responses

  • @WinterManPlay
    @WinterManPlay หลายเดือนก่อน

    Hi, a very cool video. only one thing I didn't understand is how to make the interact button appear when approaching a character? I don't understand where it is located in the code. and is there any other way to make the main character unable to move during the dialogue? so that he just stood in place, and at the end of the dialogue, the control appeared again?

    • @mimivrc4148
      @mimivrc4148 หลายเดือนก่อน

      it's a different video th-cam.com/video/ajCraxGAeYU/w-d-xo.html

    • @DashNothing
      @DashNothing  หลายเดือนก่อน +1

      The interaction is from this video: th-cam.com/video/ajCraxGAeYU/w-d-xo.htmlsi=payF90S3z1uuS9xS
      And stopping the player is in the textbox followup: th-cam.com/video/QvkGnDNbLaQ/w-d-xo.htmlsi=izBc9pxv88t2qBEw

    • @WinterManPlay
      @WinterManPlay หลายเดือนก่อน

      @@DashNothing спасибо, обязательно попробую 👍

  • @rebelape4257
    @rebelape4257 6 หลายเดือนก่อน

    func _display_letter (): is giving me a "Standalone lambdas cannot be accessed. Consider assigning it to a variable." error

    • @DashNothing
      @DashNothing  6 หลายเดือนก่อน

      Sounds like you're missing the keyword func in front of the _display_letter function to me

  • @Technobote
    @Technobote 14 วันที่ผ่านมา

    Hello thanks for the tutorial, that was really good. But do you know how to put it in a 3d scene?

    • @DashNothing
      @DashNothing  14 วันที่ผ่านมา +1

      @@Technobote You'd have to use a quad mesh and a viewport texture to render the 2D elements (textbox) onto it.

    • @Technobote
      @Technobote 14 วันที่ผ่านมา

      Thanks

  • @stormm69
    @stormm69 6 หลายเดือนก่อน

    First of, really cool and well made tutorial, earned a sub.
    Though im having some trouble with it. Sometimes the next dialog box that's supposed to come just doesn't show up at all when i advance dialog, it seems to be dependent of the lines and the MAX_WIDTH variables, for example i might have three sentences in my lines parameter, then the first two works like a charm, but when i advance_dialog, the third line might just never show up, but if i then change the text sometimes it works, and also if i change the MAX_WIDTH one line might work but others ceases to work, and i haven't quite figured out the correlation.
    Ive then tried debuggin the code by putting print("something") into it, and i discovered that when i try to show the textboxes that doesn't work, it doesn't seem to get past the two "await resized"'s in the code. Like if i put print("something") in front of them it prints, but if i put it right behind it doesn't. Still i cant seem to figure out what exactly is causing my problem. Any help would be GREATLY appreciated.
    Heres the code as i have written it(including the speech sfx's of your other video):
    --------------------------------------------------------------------------------------------------------------------------------
    extends MarginContainer
    @onready var label = $MarginContainer/Label
    @onready var timer = $LetterDisplayTimer
    @onready var audio_player = $AudioStreamPlayer
    const MAX_WIDTH = 160
    var text = ""
    var letter_index = 0
    var letter_time = 0.045
    var space_time = 0.06
    var punctuation_time = 0.2
    signal finished_displaying()
    func _ready():
    scale = Vector2.ZERO
    func display_text(text_to_display: String, speech_sfx: AudioStream):
    text = text_to_display
    label.text = text_to_display
    audio_player.stream = speech_sfx
    await resized
    custom_minimum_size.x = min(size.x, MAX_WIDTH)
    if size.x > MAX_WIDTH:
    label.autowrap_mode = TextServer.AUTOWRAP_WORD
    await resized # wait for x resize
    await resized # wait for y resize
    custom_minimum_size.y = size.y
    global_position.x -= size.x / 2
    global_position.y -= size.y + 24
    label.text = ""
    pivot_offset = Vector2(size.x / 2, size.y)
    var tween = get_tree().create_tween()
    tween.tween_property(
    self, "scale", Vector2(1, 1), 0.15
    ).set_trans(
    Tween.TRANS_BACK
    )
    _display_letter()
    func _display_letter():
    label.text += text[letter_index]
    letter_index += 1
    if letter_index >= text.length():
    finished_displaying.emit()
    return
    match text[letter_index]:
    "!", ".", ",", "?":
    timer.start(punctuation_time)
    " ":
    timer.start(space_time)
    _:
    timer.start(letter_time)
    var new_audio_player = audio_player.duplicate()
    new_audio_player.pitch_scale += randf_range(-0.05, 0.05)
    if text[letter_index] in ["a", "e", "i", "o", "u"]:
    new_audio_player.pitch_scale += 0.1
    get_tree().root.add_child(new_audio_player)
    new_audio_player.play()
    await new_audio_player.finished
    new_audio_player.queue_free()
    func _on_letter_display_timer_timeout():
    _display_letter()
    -------------------------------------------------------------------------------------------------------------------------------
    extends Node
    @onready var text_box_scene = preload("res://scenes/text_box.tscn")
    var dialog_lines: Array[String] = []
    var current_line_index = 0
    var text_box
    var text_box_position: Vector2
    var sfx: AudioStream
    var is_dialog_active = false
    var can_advance_line = false
    func _process(_delta: float) -> void:
    pass
    func start_dialog(position: Vector2, lines: Array[String], speech_sfx: AudioStream):
    if is_dialog_active:
    return
    dialog_lines = lines
    text_box_position = position
    sfx = speech_sfx
    _show_text_box()
    is_dialog_active = true
    func end_dialog():
    if is_dialog_active == true:
    text_box.queue_free()
    is_dialog_active = false
    current_line_index = 0
    func _show_text_box():
    text_box = text_box_scene.instantiate()
    text_box.finished_displaying.connect(_on_text_box_finished_displaying)
    get_tree().root.add_child(text_box)
    text_box.global_position = text_box_position
    text_box.display_text(dialog_lines[current_line_index], sfx)
    can_advance_line = false
    func _on_text_box_finished_displaying():
    can_advance_line = true
    func _unhandled_input(event):
    if (
    event.is_action_pressed("advance_dialog") &&
    is_dialog_active &&
    can_advance_line
    ):
    text_box.queue_free()
    current_line_index += 1
    if current_line_index >= dialog_lines.size():
    is_dialog_active = false
    current_line_index = 0
    return
    _show_text_box()

    • @guurff9581
      @guurff9581 5 หลายเดือนก่อน

      having this exact same problem and still havent found a fix. It looks like the the await x resize runs find as you can put a print between the two and it works but anything after the second await doesnt run at all

  • @cmrdgi
    @cmrdgi 7 หลายเดือนก่อน +1

    Hey! Thanks for the tutorial. I almost got it to work but I am getting the following error after the first line of text is displayed:
    Invalid get index '44' (on base: 'String'). line 44 is : label.text += text[letter_index]. I am a complete beginner at both Godot and programming at large, help would be really appreciated :)

    • @DashNothing
      @DashNothing  7 หลายเดือนก่อน +1

      This means your letter_index is somehow becoming larger than the number of letters in the text, which shouldn't happen. Is this error happening at the end of displaying the first textbox or after you press the advance dialog button to go onto the next textbox?
      Check 2 lines down from where the error happens (if letter_index >= text.length()). Make sure you wrote >= and not >.
      Hope this helps!

    • @cmrdgi
      @cmrdgi 7 หลายเดือนก่อน

      @@DashNothing ( if letter_index >= text.length(): ) is written properly, and the error is happening at the end of the first textbox being displayed. I am now somehow also getting an error for the _on_letter_display_timer_timeout() function at (_display_letter()). I guess this is because it's calling back to the function causing the error..

    • @cmrdgi
      @cmrdgi 7 หลายเดือนก่อน

      well actually it is now displaying the first letter, then breaking at (_display_letter()) only

    • @DashNothing
      @DashNothing  7 หลายเดือนก่อน +1

      @@cmrdgi Check your textbox's timer and make sure oneshot is enabled. Otherwise it will keep timing down and trying to display a letter when it shouldn't.

    • @cmrdgi
      @cmrdgi 7 หลายเดือนก่อน +1

      @@DashNothing omg, stupid mistake hahaha. Thanks so much for the help! Hope you have a great day :)

  • @delqyrus2619
    @delqyrus2619 8 หลายเดือนก่อน +4

    Nicely done. The only thing i would think of to improve it is to generalize the text timer/label(make it his own scene), so you can have coherent text behaviors between different types of displaying text. I have played a lot of games, where it was so annoying that different types of text ran with different speeds/behaviors...

    • @DashNothing
      @DashNothing  8 หลายเดือนก่อน +3

      Great idea. That would also allow adjusting text speed in the settings.

  • @bananalips279
    @bananalips279 5 หลายเดือนก่อน

    at the line 29 for the dialogue manager script it tells me that instantiate is not a function in godot how do you fix it?

    • @DashNothing
      @DashNothing  5 หลายเดือนก่อน +1

      If you're using Godot 3 the function is called instance()

  • @lPandoraBox
    @lPandoraBox 5 หลายเดือนก่อน

    Hello, so I have been messing around with ur script for a few days, and I have a question: Do u have any idea how I could make a animation on resize? I have no idea how to do it, already tried a lot of things, none of them seem to work...
    If possible I would like to contact u trough discord.

    • @DashNothing
      @DashNothing  5 หลายเดือนก่อน

      I don't have a discord yet, but a popup animation for the text box is one of the things shown in the follow up video here: th-cam.com/video/QvkGnDNbLaQ/w-d-xo.htmlsi=JBMBSTvq2bDy8vsW

    • @lPandoraBox
      @lPandoraBox 5 หลายเดือนก่อน

      @@DashNothing I know how to make a popup animation, my issue is: Imagine that one npc have 2 lines of a dialogue, right? When I want to change from one to another, I dont want to make another popup instead, I want to resize with an animation the current bubble

    • @lPandoraBox
      @lPandoraBox 5 หลายเดือนก่อน

      @@DashNothing and ty for the answer btw

  • @starstriker4960
    @starstriker4960 8 หลายเดือนก่อน

    Hello, where is InteractionLabel initialized? I was trying to follow this but cannot find that anywhere

    • @DashNothing
      @DashNothing  8 หลายเดือนก่อน

      It wasn't covered in the video, but it's an autoloaded scene with just a label with methods for showing and hiding. If you wanna learn more, a much better interaction system including an interaction label is covered in this video th-cam.com/video/ajCraxGAeYU/w-d-xo.htmlsi=lx_pFQT755mDVp7m

    • @starstriker4960
      @starstriker4960 8 หลายเดือนก่อน

      @@DashNothing see I do watch both and followed it, right now going inside the area will cause an error on area1 global position and crash the game. Other issue I was having was the label would never hide. Was a great video and removing the area stuff let’s it work, but that has the issue of you can press e to interact no matter the distance, and it will still not hide

  • @sakthisridhar835
    @sakthisridhar835 7 หลายเดือนก่อน +1

    Bro i had problem in show_label is non existence which is in base margine container help me bro to figure it out

    • @DashNothing
      @DashNothing  7 หลายเดือนก่อน +1

      Post the error message and I'll try to help out.

    • @sakthisridhar835
      @sakthisridhar835 7 หลายเดือนก่อน +2

      @@DashNothing bro thanks but i fix it thanks for replying bro ❤️

  • @legoreptyle1048
    @legoreptyle1048 4 หลายเดือนก่อน

    Hello! I'm trying to make your dialogue but when I start it, the only letter that display is the first one. I typed "text" and it wrote "t". Can someone help me pls?

    • @DashNothing
      @DashNothing  4 หลายเดือนก่อน

      Is the timer getting set after every letter? Its timeout callback is what makes new letters appear.

    • @legoreptyle1048
      @legoreptyle1048 4 หลายเดือนก่อน

      @@DashNothing I fixed it but if I press space after the end of the dialogue it keeps looping. Why?

    • @DashNothing
      @DashNothing  4 หลายเดือนก่อน

      @@legoreptyle1048 It could be because the same key is for starting a dialog and advancing lines. In the dialog manager you can call accept_ecent in dialog manager's _input() function to eat the input. Let me know if this helps.

  • @tomnom
    @tomnom 3 หลายเดือนก่อน +1

    10:35 For me, after the last line of dialog, the text box doesnt dissapear and just starts over right again. How can i make it dissapear after using it?

    • @DashNothing
      @DashNothing  3 หลายเดือนก่อน +1

      You probably have the same key to start and advance the dialog, so right after it gets dismissed it gets triggered again. You can call accept_event() at the end of the input function in the DialogManager to stop the event propagating further.

    • @tomnom
      @tomnom 3 หลายเดือนก่อน

      @@DashNothing wow such a fast response! Thank you for your awesome tutorials and dedication!

  • @hackdotslash
    @hackdotslash 2 หลายเดือนก่อน

    Any idea why my text box doesn't seem to show up? Godot says it's created in the remote view, but I have no idea where it is haha

    • @DashNothing
      @DashNothing  2 หลายเดือนก่อน +1

      You can also check its position and size in the remlte view's inspector. That will tell you more about what happened.

  • @brookewarsaba8401
    @brookewarsaba8401 6 หลายเดือนก่อน

    Hi, loved the video but i really need some more in depth help on how to interact with a character. If anyone knows please help me

    • @DashNothing
      @DashNothing  6 หลายเดือนก่อน

      Thank you. I made an interaction system tutorial that works perfectly with this dialogue system. Check it out: th-cam.com/video/ajCraxGAeYU/w-d-xo.htmlsi=VqlyW3GHRrnYCGjU

  • @greasykiwi2935
    @greasykiwi2935 6 หลายเดือนก่อน

    Is there any way to have the text box move with the character?

    • @DashNothing
      @DashNothing  6 หลายเดือนก่อน

      Maybe you could make the text box a child of the scene that it's triggered over. This would be done in the dialogue manager every time you create a new text box.

  • @MochiRosu
    @MochiRosu หลายเดือนก่อน

    Good Day to you Sir. Just wondering, if someone wanted to add a dialog system to the game, could they not just use the Dialogic add on?

    • @DashNothing
      @DashNothing  หลายเดือนก่อน +1

      Of course. I don't know how flexible Dialogic is when it comes to UI though - that is to say does it support text bubbles rather than fixed text boxes.
      But this is a relatively simple solution for games where you need a simple dialog system.

    • @MochiRosu
      @MochiRosu หลายเดือนก่อน

      @@DashNothing Thank you

  • @tinielcerulis6829
    @tinielcerulis6829 3 หลายเดือนก่อน

    How can the NinePatchRect be auto resized according to the label text content? I don't see anything you do which can enable that and on my side, it doesn't do that.

    • @DashNothing
      @DashNothing  3 หลายเดือนก่อน

      The part at 1:30 sets it up so it tiles nicely when its size changes.

    • @tinielcerulis6829
      @tinielcerulis6829 3 หลายเดือนก่อน

      @@DashNothing I'm not talking about how it resizes in itself, but how it's changing while you're changing the label text in the editor ? My label just go over the texture as it wasn't contained or what.

    • @tinielcerulis6829
      @tinielcerulis6829 3 หลายเดือนก่อน

      Maybe the video is using Godot 3 ? And some behaviors changed with Godot 4 ? Anyway got it working with a PanelContainer and StyleboxTexture which is the same and it resizes with the label accordingly.

    • @tinielcerulis6829
      @tinielcerulis6829 3 หลายเดือนก่อน +1

      Ok I got it when I saw at 3 min your gd script, the Textbox is a MarginContainer itself, that's why ^^ i got a little too fast in the first minute of the video!

  • @148mrafiif5
    @148mrafiif5 8 หลายเดือนก่อน

    the box is too big for me, when i resize the scale of parent margin container, the text is not on the center. anyone could help?

    • @DashNothing
      @DashNothing  8 หลายเดือนก่อน +1

      You can set the anchor point of the parent to be center, then resize by holding the alt key and dragging the dots around it. Idk if you did this, but don't use scale on ui elements to resize them. Scale is good for animations.

    • @148mrafiif5
      @148mrafiif5 8 หลายเดือนก่อน +1

      @@DashNothing i just tried it but it dont work or maybe it's just my bad. but i found how to fix it, i scaled it to 0.5, then i edit the global position x from / 2 to /4 in text_box.gd. so the box is smaller now and it's position is still on the center

    • @148mrafiif5
      @148mrafiif5 8 หลายเดือนก่อน +1

      @@DashNothing thanks btw for the tutorials. very useful for me 👍👍👍

  • @jasonozolins8781
    @jasonozolins8781 4 หลายเดือนก่อน

    When I go to test it I keep getting the error "Invalid get index '47' (on base:'String')", not sure where I went wrong. Any help would be appreciated. I checked timer to make sure it was set to one shot, and the code was written correctly (I think) as suggested to someone else experiencing this issue. However, it is still crashing with that error message.

    • @DashNothing
      @DashNothing  4 หลายเดือนก่อน

      Well it seems that your line has 47 characters, and the code tries to get the 48th character which doesn't exist. Func _display_letter() increases this index, and it should never reach a value larger than the string length because of the if letter_index >= text.length(), which is followed by a return statement. Can you post this part of your code here?

    • @jasonozolins8781
      @jasonozolins8781 4 หลายเดือนก่อน

      @@DashNothing
      func _display_letter():
      label.text += text[letter_index]
      letter_index += 1
      if letter_index >= text.length():
      finished_displaying.emit()

    • @DashNothing
      @DashNothing  4 หลายเดือนก่อน +1

      @@jasonozolins8781 So you're missing a return after finished_displaying.emit(). Check the vid at 6:12

    • @jasonozolins8781
      @jasonozolins8781 4 หลายเดือนก่อน +1

      @@DashNothing Thanks so much! That fixed it. I appreciate the help.

  • @fyofyoriosity2350
    @fyofyoriosity2350 9 ชั่วโมงที่ผ่านมา

    This is such a cool dialogue box! I am new to coding, and I am trying to replicate this in an earlier version of Godot our current project is running in, we can't use Godot 4, but 3.6 does not have the await functionality, and some other snippets throw an error - and signals confuse me. Does anyone know how to translate this code back one engine?

    • @DashNothing
      @DashNothing  6 ชั่วโมงที่ผ่านมา +1

      @@fyofyoriosity2350Godot 3 uses a yield() function instead of await. The yield function takes in 2 params: object who's signal you're waiting for, and the signal name. So in this case it would look like yield(self, "resized"). Assuming resized is a signal in Godot 3, which I'm not sure about. Reference: docs.godotengine.org/en/3.5/classes/class_%40gdscript.html#class-gdscript-method-yield

    • @fyofyoriosity2350
      @fyofyoriosity2350 5 ชั่วโมงที่ผ่านมา

      @@DashNothing
      #Thanks a ton! There are a few other things that don't parse correctly,
      #Can I ask about them as well? I'll try to leave a comprehensive list of all issues I encountered in case other Beginners 3.6 wants to follow~
      #Any help would be damn appreciated.
      #The yield seems to be fine now~ 3.5 however has the following issues:
      #SOLVED
      #signals are having slightly different syntax - instead of ( signal fnished_displaying() ),
      #leave the brackets away ( signal finished_displaying ).
      #Similarily, don't write ( finished_displaying.emit(), but (emit_signal("finished_displaying") ).
      #OPEN
      #3.6 does not allow the user to simply write size.x - it will throw an error, saying
      #size was not declared in the current scope. Is it the same as self.size.x?
      #SOLVED (But with question)
      #3.6 does not have await, use yield(self, "resized")
      #Do I have to use yield twice here too for both x and y?
      #OPEN/SOLVED?
      #custom_minimum_size.x does not exist - Should use rect_min_size.x instead?
      #OPEN
      #Okay, the autowrap mode line is where I absolutely found no way to solve it.
      #TextServer seems to be an addition to GD4? But it does not at all exist;
      #And while not throwing errors for autowrap_mode, it also does not suggest that
      #parameter, which means it might not exist? Only label.autowrap is suggested
      #(I have to reiterate that I am a noob and there is probably something i am overlooking)
      #What do I write instead of ( label.autowrap_mode = TextServer.AUTOWRAP_WORD )?
      #OPEN
      #global_position.x also does not exist - can I use rect_global_position.x instead?
      #OPEN
      #var dialog_text : Array[String] = [] does not work under any circumstance.
      #I suspect syntax, the godot 3.6 documentation writes something like var array = [insertstuffhere],
      #but as a beginner I have no clue how to translate parts from one definition to another
      #and which ones are important : ' D It is fine if I write var arr_dialog_text : Array = [],
      #But how do I definte that the inside of the brackets need to be String type?
      #Similar question for start_dialog(position : Vector2, lines : Array[String):
      #OPEN
      # .instantiate() is not a thing, should I use .instance()?
      #OPEN
      #text_box.finished_displaying.connect(_on_textbox_finished_displaying)
      #Throws an error. Even if the function is made, it said it doesn't exit.
      #Solution potentially:
      #Make it into a string? The error goes away, but idk if it would still work
      #text_box.finished_displaying.connect("_on_textbox_finished_displaying")
      #OPEN
      # text_box.global_position does not exist. Which other to use?
      # especially when calling the function DialogManager.func_start_dialog(global_position, lines)
      #does not work.
      #------------------------------------------ code -------------------
      #textbox script
      extends MarginContainer
      signal sig_finished_displaying_text
      onready var label = $MarginContainer/Label
      onready var timer = $LetterDisplayTimer
      const MAX_WIDTH = 256 #Textbox cannot be wider than this. Indicates line break.
      var text = ""
      var letter_index = 0
      var letter_time = 0.03
      var space_time = 0.06
      var punctuation_time = 0.2
      # ---- FUNCTIONS ---------------------------------------------------------------
      func func_display_text(text_to_display : String):
      text = text_to_display
      label.text = text

      yield(self, "resized")
      rect_min_size.x = min(self.size.x, MAX_WIDTH)

      if (self.size.x > MAX_WIDTH):
      print(label.autowrap_mode)
      label.autowrap_mode = true
      # = TextServer.AUTOWRAP_WORD
      yield(self, "resized") # wait for x resize
      yield(self, "resized") # wait for y resize
      rect_min_size.y = self.size.y

      rect_global_position.x -= self.size.x / 2
      rect_global_position.x -= self.size.y + 24 #to put text a little bit above the speaker

      label.text = ""
      func_display_letter()
      func func_display_letter():
      label.text += text[letter_index]
      letter_index += 1
      if letter_index >= text.length():
      emit_signal("sig_finished_displaying_text")
      return

      #If there are still characters to display:
      match text[letter_index]:
      "!", ".", ",", "?", ":":
      timer.start(punctuation_time)
      " ":
      timer.start(space_time)
      _:
      timer.start(letter_time)
      # ---- SIGNALS ---------------------------------------------------------------
      func _on_LetterDisplayTimer_timeout():
      func_display_letter()
      #------------------------------------------ code -------------------
      #DialogManager
      extends Node
      onready var text_box_scene = preload("res://scenes/ui/textbox/textbox.tscn")
      #var dialog_text : Array[String] = []
      var dialog_lines : Array = []
      var current_line_index = 0
      var text_box
      var text_box_position : Vector2
      var is_dialog_active = false
      var can_advance_line = false
      # --- FUNCTIONS ---------------------------------------------------------------
      func func_start_dialog(position : Vector2, lines : Array):
      if is_dialog_active:
      return

      dialog_lines = lines
      text_box_position = position
      func_show_text_box()
      is_dialog_active = true
      func func_show_text_box():
      text_box = text_box_scene.instantiate()
      text_box.finished_displaying.connect("_on_textbox_finished_displaying")
      get_tree().root.add_child(text_box)
      text_box.Position2D = text_box_position
      text_box.display_text(dialog_lines[current_line_index])
      can_advance_line = false
      func func_on_textbox_finished_displaying():
      can_advance_line = true
      func func_unhandled_input(event):
      if (
      event.is_action_pressed("ui_click") &&
      is_dialog_active &&
      can_advance_line == true
      ):
      text_box.queue_free()

      current_line_index += 1
      if (current_line_index >= dialog_lines.size()):
      is_dialog_active = false
      current_line_index = 0
      return

      func_show_text_box()
      #------------------------------------------ code -------------------
      #My Main from which I want to try seeing the textbox, no other controls
      extends Node
      const lines : Array = [
      "Hello World!",
      "Lorem ipsum odor et deo.",
      "This is test dialogue."
      ]
      # Called when the node enters the scene tree for the first time.
      func _ready():
      DialogManager.func_start_dialog(self.position * 3, lines)

  • @jacobbiscuitsuuu
    @jacobbiscuitsuuu 6 หลายเดือนก่อน

    Hi great tutorial, but im having an issue where if i place another character that just uses the exact same code but with different lines only the first one that i placed will actually let me advance the text, i can press E for each Line like normal but the second guy i interact with him,but only his first dialog option shows up and i cant advance the dialog lines. I would appreciate the help! Thanks! ❤

    • @DashNothing
      @DashNothing  6 หลายเดือนก่อน +1

      It's hard to say what the issue might be, but you can see what goes wrong if you add some print() statements into the _unhandled_input() func in the dialog manager and print out the values of can_advance_line and is_dialog_active. Both of those should be true when you expect to advance the dialog, and if they're not you should find out why.

    • @jacobbiscuitsuuu
      @jacobbiscuitsuuu 6 หลายเดือนก่อน +1

      @@DashNothing so I put the print_debug() into the unhandled_input function and it appeared whenever i pressed E for advance dialog for the first guy but absolutely nothing shows up for the second, guy, also i forgot to mention that the letters in his dialog box dont show up one letter at a time and his dialog box never goes away, making it impossible to interact with other guys. I can't figure it out so some help would be greatly appreciated

    • @jacobbiscuitsuuu
      @jacobbiscuitsuuu 6 หลายเดือนก่อน

      Also I can interact from anywhere btw how do I fix that too I have no idea, pls help

    • @DashNothing
      @DashNothing  6 หลายเดือนก่อน

      @@jacobbiscuitsuuu Is the interaction system you're using from my other tutorial?
      If so, I suggest you go over the InteractionManager part of it again to make sure you got everything right. It might be that interaction areas don't unregister themselves properly, or something to that extent.

    • @jacobbiscuitsuuu
      @jacobbiscuitsuuu 6 หลายเดือนก่อน +1

      @@DashNothing Since I wrote those replies I ended up figuring it out on my own, it was a problem with apparently there's a like a character limit or something but more like the opposite, I was having him say Hey. That's too little characters so it needs to be 5 or more to work, and the interaction thing was a layering problem

  • @Cool_Kid95
    @Cool_Kid95 ปีที่แล้ว +22

    Godot?! LIKE ACE ATTORNEY?!

    • @DashNothing
      @DashNothing  ปีที่แล้ว +8

      Not quite haha

    • @turquoiseninju7
      @turquoiseninju7 7 หลายเดือนก่อน +2

      Heh, even I was thinking of him when I first heard of Godot.. turns out the creators named the program kind of as a reference to him

    • @fu_games
      @fu_games 3 หลายเดือนก่อน

      could you explain it to someone who never played ace attorney? what is the reference here?

  • @Danny1981able
    @Danny1981able 9 หลายเดือนก่อน

    HI I get the following error at the unhandled_input function. At the sprit.flip_h the true if loop doesn't close and the error says Expected "else" after ternary operator condition

    • @DashNothing
      @DashNothing  9 หลายเดือนก่อน

      That line is cut off in the video because it isn't relevant to the text box. But the error occurs because when using the ternary operator (if ... else ... all in one line), you have to write the else part in the same line as well.
      So something like:
      var a = 1 if b == c else 2

    • @Danny1981able
      @Danny1981able 9 หลายเดือนก่อน

      so what did you write there?
      @@DashNothing

  • @JM-tj5qm
    @JM-tj5qm 15 วันที่ผ่านมา

    Your pixalated font and margins look nice and crisp while mine look blurry.

    • @DashNothing
      @DashNothing  15 วันที่ผ่านมา

      Try putting the resize mode to viewport or canvas_items in project settings -> window

  • @pietrobouery8180
    @pietrobouery8180 3 หลายเดือนก่อน

    how to make it keep looping a text like some sort of radio, should i make an infinite loop inside the code or is there any other possible way.
    Also Great tutorial ,but since im new i wished you could show the full code at the end for the person to interact with.

    • @DashNothing
      @DashNothing  3 หลายเดือนก่อน +1

      You wouldn't make an infinite loop, but you could have a timer and show a new line when it times out. You would have to watch out for the line index not to go over the size of the lines array, as that would lead to an error. That's easy enough, as you just have to reset it back to 0 when it reaches the final line.
      Here's the interaction tutorial that works hand in hand with this dialog system: th-cam.com/video/ajCraxGAeYU/w-d-xo.htmlsi=Sz6PHsFqGmh9wjcd

    • @pietrobouery8180
      @pietrobouery8180 3 หลายเดือนก่อน

      @@DashNothing tysm for replying , ur the best

  • @Byte_Hub
    @Byte_Hub 9 หลายเดือนก่อน +2

    Didn't work for me, using Godot 3.5 with equivalent methods

  • @pietrobouery8180
    @pietrobouery8180 3 หลายเดือนก่อน

    the InteractionLabel is undefined , i couldnt find where did u write it before in the 2 videos, please help me xD

    • @DashNothing
      @DashNothing  3 หลายเดือนก่อน +1

      This was written only to demonstrate the text box and is not explained, as that's outside of the scope of the video. I remade and improved the interaction system in this video: th-cam.com/video/ajCraxGAeYU/w-d-xo.html

    • @pietrobouery8180
      @pietrobouery8180 3 หลายเดือนก่อน

      @@DashNothing oh alright , thank you so much

  • @bluestarkinreddit4180
    @bluestarkinreddit4180 8 หลายเดือนก่อน

    I have done the tutorial several times, but I can never see the text box when I interact with my test_guy, any advice?

    • @DashNothing
      @DashNothing  8 หลายเดือนก่อน

      Check if the function for starting dialog even gets called by putting a print() statement in it.
      If that's okay, check if the textbox scene is visible in the visibility section of the inspector.
      Some people had issues with double await resized, so try removing one await resized and see what happens.
      Hope that helps!

    • @bluestarkinreddit4180
      @bluestarkinreddit4180 8 หลายเดือนก่อน

      @@DashNothing I correctly called the start_dialog function, verified that the scene was visible and also tried eliminating some waits, but still nothing was displayed.

    • @Zap-Plays
      @Zap-Plays 7 หลายเดือนก่อน

      Any update? Having the same issue.@@bluestarkinreddit4180

  • @AnnieClaudeT1
    @AnnieClaudeT1 หลายเดือนก่อน

    Hello, I encounter this error and I can't find why it does this : At :6.50, timer.start(punctuation_time), timer.start(space_time) and timer.start(letter_time) appear red and the error said:
    ""Error at (44, 17): Identifier ''timer" not declared in the current scope"
    I'm using Godot 4
    Thank you!

    • @DashNothing
      @DashNothing  หลายเดือนก่อน

      Make sure you get the reference to the timer node at the top of the script with the line @onready var timer =$... putting the name of the timer node in your scene after the $.

    • @AnnieClaudeT1
      @AnnieClaudeT1 หลายเดือนก่อน

      @@DashNothing Omg! That's it :D Thank you for the video and thank you for the fast answer! Have a nice day/evening!

  • @1r1sh50
    @1r1sh50 5 หลายเดือนก่อน

    Could you help me out with something? I did both of your tutorials and it's pretty much working,.the only thing is it only displays the first line of dialogue, then if I click advance it just restarts the first line displaying

    • @DashNothing
      @DashNothing  5 หลายเดือนก่อน

      Could it be that you don't increment the current line index (at 10:10)?

    • @1r1sh50
      @1r1sh50 5 หลายเดือนก่อน

      I have the increment implemented in the code but it doesn't seem to increment to the next line in my lines array, just stuck restarting

    • @DashNothing
      @DashNothing  5 หลายเดือนก่อน

      @@1r1sh50 You can write some print statements to check the value of the current_line_index periodically, and see if it matches up. You can do the same to check which line is currently showing. Thrn you can figure out what's out of place.

    • @1r1sh50
      @1r1sh50 5 หลายเดือนก่อน

      @@DashNothing i tried doing trhat and it seems the unhandles input in the dialogue manager is never being called. i am using godot 4, and so insterad of event.is_action_pressded... i changed to Input.is_action_pressed, and still it wont change to the next dialogue lines

    • @DashNothing
      @DashNothing  5 หลายเดือนก่อน

      @@1r1sh50 The video was made with Godot 4, so I would suggest leaving it at event.is_action_pressed. Maybe you didn't bind a key to the advance_dialog action? Check in project settings -> input map

  • @diegoandradex12
    @diegoandradex12 9 หลายเดือนก่อน

    Could you tell the rest of the code at 10:46 after line 30?

    • @DashNothing
      @DashNothing  9 หลายเดือนก่อน

      That was the old way of hiding the interaction label, so if you followed my interaction video you don't want that line, nor the function above it.
      But it was this:
      InteractionLabel.hide_label()

  • @braxtonsdev9564
    @braxtonsdev9564 4 หลายเดือนก่อน

    When I’ve reached the end of my dialogue the popup doesn’t go away. Any advice?

    • @braxtonsdev9564
      @braxtonsdev9564 4 หลายเดือนก่อน

      The text also appears without any wait time at all

    • @DashNothing
      @DashNothing  4 หลายเดือนก่อน

      @@braxtonsdev9564 Did you set your timer to one shot?

  • @PikaWarrior1222
    @PikaWarrior1222 6 หลายเดือนก่อน

    This is a great tutorial, but there's one small issue though. Whenever I try to make the dialogue happen it stops at the first letter. Is there a way to fix that?

    • @DashNothing
      @DashNothing  6 หลายเดือนก่อน

      Sounds like there's an issue with the timer. Are you calling timer.start() and did you connect the timer's timeout signal?

    • @PikaWarrior1222
      @PikaWarrior1222 6 หลายเดือนก่อน

      @@DashNothing yes, but it still only displays one letter.

  • @TechBoi1115
    @TechBoi1115 8 หลายเดือนก่อน

    Hi, How can I start the dialogue without my character interacting with something or someone

    • @DashNothing
      @DashNothing  8 หลายเดือนก่อน

      Just call DialogManager.start_dialog from any script at any time

    • @TechBoi1115
      @TechBoi1115 8 หลายเดือนก่อน

      @@DashNothing it says "unexpected identifier"

    • @DashNothing
      @DashNothing  8 หลายเดือนก่อน

      @@TechBoi1115 Can you post the whkle error message?
      Make sure DialogManager is autoloaded and that you pass in the appropriate paeameters to start_dialog (the lines array and sound effect)

    • @TechBoi1115
      @TechBoi1115 8 หลายเดือนก่อน

      @@DashNothing ok

  • @josueruiztorres4103
    @josueruiztorres4103 10 หลายเดือนก่อน

    My Text_box dont dessapear. Help

    • @DashNothing
      @DashNothing  10 หลายเดือนก่อน

      In the DialogManager in the unhandled_input function when the advance dialog action is pressed make sure you have text_box.queue_free() called. Hope that helps!

  • @Holkerzu
    @Holkerzu 5 หลายเดือนก่อน

    Hey idk if you could response fast, but I have an error at the timer part.
    Parser Error: Identifier "timer" not declared in the current scope.
    Please do help, a newbie here. Thanks!

    • @DashNothing
      @DashNothing  5 หลายเดือนก่อน

      Did you get the @onready reference to the timer like at 3:20? Also make sure that the scene tree timer's name matches the one on that line after the $ symbol.

    • @Holkerzu
      @Holkerzu 5 หลายเดือนก่อน

      @@DashNothing THANK YOU! I think I drag and hold ctrl the timer into the script without changing the name. Cheers mate, new subs!

    • @Holkerzu
      @Holkerzu 5 หลายเดือนก่อน

      @@DashNothing I'm so sorry for bothering you, but after fixing this, i have a new error in which I couldn't figure out how to fix it. Please do let me know how I could improve it.
      Invalid set index 'text' (on base: 'Nil') with value of type 'String'.

    • @DashNothing
      @DashNothing  5 หลายเดือนก่อน

      @@Holkerzu This looks like the same problem, but with the label this time. Are the names in your scene tree and the @onready var label line the same?

    • @Holkerzu
      @Holkerzu 5 หลายเดือนก่อน

      @@DashNothing yep! It is.
      Textbox (margin container)
      - NinePatchRect
      - Margin Container
      - - Label
      - Timer

  • @CosmicKingEvol
    @CosmicKingEvol 3 หลายเดือนก่อน +1

    I did this tutorial and my whole screen glitching up when it spawns.. :/

    • @CosmicKingEvol
      @CosmicKingEvol 3 หลายเดือนก่อน

      would really love some help..please
      The code for the text box
      extends MarginContainer
      @onready var timer = $LetterDisplayTimer
      @onready var label = $MarginContainer/Label
      const MAX_WIDTH = 256
      var text = ""
      var letter_index = 0
      var letter_time = 0.02
      var space_time = 0.06
      var punc_time = 0.2
      signal finished_displaying()
      func display_text(text_to_display: String):
      text = text_to_display
      label.text = text_to_display

      await resized
      custom_minimum_size.x = min(size.x, MAX_WIDTH)

      if size.x > MAX_WIDTH:
      label.autowrap_mode = TextServer.AUTOWRAP_WORD
      await resized
      await resized
      custom_minimum_size.y = size.y

      global_position.x -= size.x / 2
      global_position.y -= size.y + 24

      label.text = ""
      _display_letter()

      func _display_letter():
      label.text += text[letter_index]

      letter_index +=1
      if letter_index >= text.length():
      finished_displaying.emit()
      return

      match text[letter_index]:
      "!", ".", ",", "?":
      timer.start(punc_time)
      " ":
      timer.start(space_time)
      _:
      timer.start(letter_time)
      func _on_letter_display_timer_timeout():
      _display_letter()
      Code for the Dialogue Manager.
      extends Node
      @onready var text_box_scene = preload("res://textbox.tscn")
      var dialog_lines: Array[String] = []
      var current_line_index = 0
      var text_box
      var text_box_position: Vector2
      var is_dialog_active= false
      var can_advanced_line = false
      func start_dialog(position: Vector2, lines: Array[String]):
      if is_dialog_active:
      return

      dialog_lines = lines
      text_box_position = position
      _show_text_box()

      is_dialog_active = true


      func _show_text_box():
      text_box = text_box_scene.instantiate()
      text_box.finished_displaying.connect(_on_text_box_finished_displaying)
      get_tree().root.add_child(text_box)
      text_box.global_position = text_box_position
      text_box.display_text(dialog_lines[current_line_index])
      can_advanced_line = false


      func _on_text_box_finished_displaying():
      can_advanced_line = true


      func _unhandled_input(event):
      if (
      event.is_action_pressed("advance_dialog") &&
      is_dialog_active &&
      can_advanced_line
      ):
      text_box.queue_free()

      current_line_index += 1

      if current_line_index >= dialog_lines.size():
      is_dialog_active = false
      current_line_index = 0
      return

      _show_text_box()

      Just..why would my whole screen be glitching up. Any help, I would be very thankful of.

    • @DashNothing
      @DashNothing  3 หลายเดือนก่อน

      @@CosmicKingEvol Well that's new. How exactly is it glitching up? What do you see?

    • @CosmicKingEvol
      @CosmicKingEvol 3 หลายเดือนก่อน

      @@DashNothing actually, it appears to ber something to do with the forward+ thing and not with your code, so sorry for my mistake. It happening after adding the dialogue code was coincidence.

  • @justrosy5
    @justrosy5 4 หลายเดือนก่อน

    What painting program did you use to create the sprite?

    • @DashNothing
      @DashNothing  4 หลายเดือนก่อน

      Aseprite

  • @zavtronesegodnya
    @zavtronesegodnya 4 หลายเดือนก่อน

    How can I use the code we wrote with the bot?

    • @DashNothing
      @DashNothing  4 หลายเดือนก่อน

      If you're looking for a way to interact with NPCs check out this vid th-cam.com/video/ajCraxGAeYU/w-d-xo.htmlsi=BDVtoKdTnlZS5ptp

    • @zavtronesegodnya
      @zavtronesegodnya 4 หลายเดือนก่อน

      I want the dialogue to appear when the main character approaches like in the video ​@@DashNothing

    • @zavtronesegodnya
      @zavtronesegodnya 4 หลายเดือนก่อน

      If I go to the video you posted, will I be able to implement the dialogue? And will I need the code that was written in this video?​@@DashNothing

    • @DashNothing
      @DashNothing  4 หลายเดือนก่อน

      @@zavtronesegodnya Yes, you will need the code from here for the dialog, and in the linked video you'll learn hoe to enable the player to interact eith objects based on proximity and after a button press. The interaction system works perfectly with this dialog system.

  • @Gamesablaze
    @Gamesablaze 3 หลายเดือนก่อน

    Hi, I'm having an issue with making an NPC talk.
    The code I used was this:
    var can_talk = false
    const lines: Array[String] = [
    "Hello!", "What brings you here?" ]
    func _on_area_2d_body_exited(body):
    if body.has_method("player"):
    can_talk = false
    func _on_area_2d_body_entered(body):
    if body.has_method("player"):
    can_talk = true
    func _physics_process(delta):
    if can_talk == true and Input.is_action_just_pressed("start_dialogue"):
    DialogManager.start_dialog(global_position, lines)
    #The "start_dialogue" button is the tab button.
    But when I move my Character to the NPC and press the tab button, nothing happens.
    Could you please help he solve this problem?

    • @DashNothing
      @DashNothing  3 หลายเดือนก่อน

      Does the player really have a method called "player"? You put that as a requirement to enabling can_talk.

    • @Gamesablaze
      @Gamesablaze 3 หลายเดือนก่อน

      @@DashNothing Yes

    • @DashNothing
      @DashNothing  3 หลายเดือนก่อน

      @@Gamesablaze Then check if the area detects the player at all - area's collision mask should include player's collision layer.

    • @Gamesablaze
      @Gamesablaze 3 หลายเดือนก่อน

      @@DashNothing I checked and the area’s mask is equal to the layer of the player.
      I even added print(“hello”) after the if statement to make sure if the if statement works, and it was printing “hello” when I tested it, but nothing else happened.

    • @DashNothing
      @DashNothing  3 หลายเดือนก่อน

      @@Gamesablaze Do a similar print statement at the start of DialogManager's start_dialog function to see if that gets called

  • @sixsalt1406
    @sixsalt1406 4 หลายเดือนก่อน

    Hello, I have followed your tutorial, however I cannot seem to get it to work properly. It is only showing the first letter of the first line for me, any ideas on how I might fix this?

    • @DashNothing
      @DashNothing  4 หลายเดือนก่อน

      Sounds like your timer's timeout signal isn't connected. Can you check that?

    • @sixsalt1406
      @sixsalt1406 4 หลายเดือนก่อน

      @@DashNothing thank you that fixed it but now it is printing infinitely until I click again

    • @DashNothing
      @DashNothing  4 หลายเดือนก่อน

      @@sixsalt1406 What do you mean by infinitely? Do the letters of the line repeat in a loop?

    • @sixsalt1406
      @sixsalt1406 4 หลายเดือนก่อน

      @@DashNothing yes that's exactly right, the line repeats

    • @DashNothing
      @DashNothing  4 หลายเดือนก่อน

      @@sixsalt1406 Are you missimg the return at 6:16? It stops the timer from starting again and the dialog should be stopped until advance_dialog key is pressed.