Non-Existing Signal and Node not Found Issues

Godot Version



Here is the code:

extends CollisionShape2D

@export var transformation = Transform2D()
@export var rotation_speed = 1000 

@onready var pickcollision

var limb
var rotating = false  # Degrees per step
var total_rotation = 0   # Total rotation so far
@onready var beardy = $"../../../CollisionPolygon2D"
@onready var picksprite = $"../AnimatedSprite2D3"
var tilemap
var small_movement = Vector2(0.1, 0.1)
# Called when the node enters the scene tree for the first time.
func _ready():
	limb = $"."
	limb.visible = false
		# Load the scene containing the TileMap
	var scene = load("res://Scenes/Themine.tscn")
	# Instance the scene to access its nodes
	var scene_instance = scene.instantiate()
	# Find the TileMap node within the scene
	tilemap = find_tilemap_node(scene_instance)
	pickcollision = $"."
	pickcollision.set_deferred("disabled", true)

func _process(delta):
	limb = $".."
	pickcollision = $"."
	transformation.origin = pickcollision.global_position
	##var collide
	# Check for key press
	if Input.is_action_pressed("ui_accept"):
	# Check for key release
		rotating = false
		pickcollision.set_deferred("disabled", true)
		limb.visible = true
		pickcollision.rotation = 0

func rotate_limb(delta):
	if rotating:
		# Rotate the limb
		limb.rotate(deg_to_rad(rotation_speed) * delta)
		# Update total rotation
		total_rotation += rotation_speed
		# Check if total rotation reaches 360 degrees
		if total_rotation >= 360:
			total_rotation = 0
			rotating = false

func find_tilemap_node(node):
	# Recursive function to find the TileMap node within the scene
	if node is TileMap:
		return node

Here is the errors:

E 0:00:02:0405 @ _ready(): Node not found: "../../../CollisionPolygon2D" (relative to "/root/PickaxeSwing").
  <C++ Error>    Method/function failed. Returning: nullptr
  <C++ Source>   scene/main/node.cpp:1620 @ get_node()
  <Stack Trace> @ _ready()


E 0:00:02:0454 @ _ready(): Can't emit non-existing signal "pickcollision_ready".
  <C++ Error>    Condition "!signal_is_valid && !script.is_null() && !Ref<Script>(script)->has_script_signal(p_name)" is true. Returning: ERR_UNAVAILABLE
  <C++ Source>   core/object/object.cpp:1026 @ emit_signalp()
  <Stack Trace> @ _ready()

Thanks for your help, as always.

Error 1: The node path is wrong! I don’t know your scene tree, but (at least when the scene gets ready) there’s no such node relative to the node this script is attached to.

Error 2: In order to emit a custom signal, you first have to declare it:

signal pickcollision_ready()

Just add this to the top of your script (below the extends line).

Ok, this worked. Thanks.