0 votes

I've connected a signal between DialogueTrigger (an Area2D) and Player (KinematicBody2D):

func _on_DialogueTrigger_body_entered(body):
    if (body.get_parent().get_name() == "Player"):
        get_node("Dialogue").popup()

so that when the Player moves into the collisionshape2D of DialogueTrigger, the Dialogue PopupPanel would show up. However, nothing happens when the Player runs into that area. I have tried signalling to the root Node instead but this results in "script inherits from native type reference so it cant be instanced in the root node".

Anybody got any clues with this?

Screenshot

(the error sign next to the PopupPanel is just saying that it will be invisible unless popup() is called.)

Thanks!

in Engine by (29 points)
edited by

I've tried adjusting the code to

func _on_DialogueTrigger_body_entered(body):
    if (body.get_name() == "Player"):
        get_node("../Dialogue").popup()

but both this and the old code doesn't work. The debug error every time I enter the shape is displayed as:

Error calling method from signal 'body_shape_entered': 'KinematicBody2D(Player.gd)::_on_DialogueTrigger_body_shape_entered': Method not found.
----------
Type:Error
Description: 
Time: 0:00:04:0643
C Error: Error calling method from signal 'body_shape_entered': 'KinematicBody2D(Player.gd)::_on_DialogueTrigger_body_shape_entered': Method not found.
C Source: core\object.cpp:1202
C Function: Object::emit_signal

In this last code I think you connected a different signal. Try disconnecting all the signals of the DialogTrigger and connecting just the body_entered one

you connected signal to _on_DialogueTrigger_body_shape_entered
but your function name is _on_DialogueTrigger_body_entered

Please log in or register to answer this question.

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 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 webmaster@godotengine.org with your username.

Categories