Error about connecting nonexistant signal to nonexistent callable

Godot Version

4.2

Question

I am troubleshooting an error created when I instance a mob. An example of the error message is:

E 0:00:03:0684 cave.gd:20 @ spawn_mob(): In Object of type ‘Node’: Attempt to connect nonexistent signal ‘die’ to callable ‘CharacterBody2D(minion.gd)::die’.
<C++ Error> Condition “!signal_is_valid” is true. Returning: ERR_INVALID_PARAMETER
<C++ Source> core/object/object.cpp:1344 @ connect()
cave.gd:20 @ spawn_mob()
cave.gd:16 @ _ready()
scene_manager.gd:5 @ _on_screen_fade_transition_transitioned()
screen_fade_transition.tscn::GDScript_lt1ek:15 @ _on_animation_player_animation_finished()

I do not have either a signal named ‘die’ or a callable in the base_enemy class (which every mob type extends from) named ‘die’.

#Cave scene code
extends Node
@onready var viewport_x: float = get_viewport().size.x
@onready var viewport_y: float = get_viewport().size.y
@onready var MobTypes: Dictionary = {
	"Minion": preload("res://mobs/minion.tscn"),
	"Dash": preload("res://mobs/dash.tscn"),
	"Tower": preload("res://mobs/tower.tscn"),
	"Landmine": preload("res://mobs/landmine.tscn"),
	"Shield": preload("res://mobs/shield.tscn"),
	"Split": preload("res://mobs/split.tscn")
}
var level: int

func _ready():
	for i in range(30):
		spawn_mob(MobTypes.values()[randi() % MobTypes.size()], Vector2(randi_range(200, 800), randi_range(200, 800))) #random mob
	
func spawn_mob(type: PackedScene, spawn_position: Vector2) -> void:
	var mob = type.instantiate()
	mob.position = spawn_position
	spawn_position = mob.get_global_position()
    #Attributes below are used in its wander state
	mob.spawn_position = spawn_position
	mob.chosen_position = spawn_position
	mob.starting_position = spawn_position
	add_child(mob)
#BaseEnemy
#has a bunch of variables for speed, damage, attack range, etc.

func get_ready() -> void:
	player = get_parent().get_node("Player")
	var health_bar: Node = get_parent().get_node("MobHealthBar")
	attack_signal.connect(%HitBox.attack)
	damaged.connect(health_bar.mob_health_bar_update)
	%HitBox.scale = Vector2(attack_range, attack_range)
	%AggroRange.scale = Vector2(aggro_range, aggro_range)
	%AnimatedSprite2D.play()

func died() -> void:
	queue_free()
#Minion class
extends BaseEnemy

func _ready():
	get_ready()

As far as I can tell, this is the only relevant code. I used to have a signal and function named ‘die’, but I changed the names when trying to fix the error. Now that all the names have been changed, it still tries to connect a signal named ‘die’ to a function ‘die’, both of which do not exist.

did you ever connect the die signal from inspector?

Yes, I did connect the die signal from the inspector before I changed the name.

then disconnect the connection from inspector, iirc right click the connected path and choose disconnect

Please help me, see my post about the camera region

There is no signal to disconnect. When I add the signal ‘die’ back, no error happens, but the signal is never used, so I don’t know why an unused signal has to be made. I cannot find where the signal is being connected because it is not in any of the files.

The Split enemy had a different function name for dying, causing the error.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.