This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes
func _speak(dialogue):
    yield(Interaction, "interaction_completed")

func handle_interaction() -> void:
    _speak("hello 1")
    _speak("hello 2")

Calling yield in the first call of _speak() doesn't wait until the interaction is being completed. Is there a sophisticated way to solve this issue with signals?

The problem is mostly about code design.

func handle_interaction() -> void:
        Interaction.say_dialogue("hello 1")
        yield(Interaction, "interaction_completed")
        Interaction.say_dialogue("hello 2")
        yield(Interaction, "interaction_completed")

This looks like ugly code, specially if I have many things that a character says. Can this be solved with yield or should I go with the good old is_finished checks?

Godot version 3.3.2 stable
in Engine by (64 points)

1 Answer

+1 vote
by (4,088 points)

Not really useful for me, but thanks for the effort.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.