Let’s make the dialogue interactive by adding response options:
~ startNathan: Hi there! Welcome to Dialogue Manager.Nathan: Would you like to learn more?- Yes, tell me more! Nathan: Great! Dialogue Manager makes it easy to create branching conversations. Nathan: You can add conditions, variables, and much more.- No, I'm good. Nathan: No problem! Come back anytime.
Response options start with - and their nested dialogue is indented with a tab.
Create a new scene with a basic node (like a Node2D or Control).
2
Add a script
Attach a script to your node with the following code:
extends Node2Dfunc _ready(): # Load your dialogue resource var dialogue_resource = load("res://my_first_dialogue.dialogue") # Show the dialogue starting from the "start" label DialogueManager.show_dialogue_balloon(dialogue_resource, "start")
DialogueManager.show_dialogue_balloon() is the simplest way to show dialogue. It uses the built-in example balloon by default.
3
Run your scene
Press F6 to run your current scene. You should see your dialogue appear in a speech balloon!
Click or press Space/Enter to advance through dialogue
Use Arrow Keys and Enter to select response options
Here’s a more complete dialogue example showcasing different features:
~ startNathan: Welcome to my shop!Nathan: What can I help you with today?- Tell me about yourself Nathan: I'm Nathan, the shopkeeper. Nathan: I've been running this place for years. => shop_menu- Show me your wares => shop_menu- Goodbye => END~ shop_menuNathan: Here's what I have in stock.- Health Potion ($10) Nathan: A classic choice! => shop_menu- Magic Scroll ($25) Nathan: Powerful stuff! => shop_menu- Nothing for now Nathan: Come back anytime! => END
Besides show_dialogue_balloon(), you can also get dialogue lines manually for more control:
extends Node2Dfunc _ready(): var dialogue_resource = load("res://my_first_dialogue.dialogue") # Get a single line of dialogue var dialogue_line = await DialogueManager.get_next_dialogue_line(dialogue_resource, "start") # Access the line's properties print(dialogue_line.character) # "Nathan" print(dialogue_line.text) # "Hi there! Welcome to Dialogue Manager." # Get the next line dialogue_line = await DialogueManager.get_next_dialogue_line(dialogue_resource, dialogue_line.next_id)
This approach gives you full control over how dialogue is displayed, letting you create custom dialogue UI that matches your game’s style.