Godot Version
4.3
Question
this is my code in my dialogue script, what I want to do is have a system where when the static text shows, it moves to the next one, but sometimes there will be conditional text, like tutorial text which has a timer and shows UI, right now it’s working halfway, my last index text takes all the logic to itself, logic works but it can’t reference correctly to the right index, so my tutorial is index 1 in the array, how can I reference it so that the logic will work on that only and not on the last index
func show_ui_prompt_callback() -> void:
if current_dialogue_index == 1: # Check if it's the tutorial text (second dialogue)
hide_tutorial_text(9.0)
show_ui_prompt()
func hide_tutorial_text(delay: float) -> void:
await get_tree().create_timer(delay).timeout
text_label.visible = false
func print_completion_message() -> void:
print("Dialogue complete. Ready for the next phase!")
# Array of dialogues
var dialogues = [
{
"text": "Welcome! My name is the one. I'm glad you have arrived.\nI'm going to teach you the basics of this world and how to survive.",
"on_finish": null # No special action on finish
},
{
"text": "Press any key to move.",
"on_finish": show_ui_prompt_callback # Reference to the prompt callback
},
{
"text": "Great! You now know how to move. Let's proceed with the adventure.",
"on_finish": print_completion_message # Reference to the print callback
}
]