Godot Version
4.2.1
Question
Here’s a rough overview of the trees in my project
(Enemy01 Scene)
- Enemy01
- EnemyClassNodes
- …some other nodes
(EnemyClassNodes Scene)
- EnemyClassNodes
- StateTree
- IdleState
- …some other nodes
For context, Enemy01 is a specific enemy and EnemyClassNodes is a bunch of nodes that each enemy should have, including nodes that manage hitboxes, hurtboxes, player detection etc, so each enemy should have them. This is why I have an extraa scene here.
I want to connect a signal from IdleState to a callable in Enemy01. I can’t do this in the editor since the IdleState node is in a separate scene compared to Enemy01. I guess I need to do it via code. The problem is that the new version of the .connect function only seems to be able to connect a signal from IdleState to a callable from IdleState. I’ve tried the following.
(code for Enemy01):
$EnemyClassNodes/State/Root/Idle.connect(“state_phyiscs_processing”, _on_idle_physics)
print($EnemyClassNodes/State/Root/Idle.is_connected(“state_phyiscs_processing”, _on_idle_physics))
I get “false” printed a lot.
Does this code connect the signal with the _on_idle_physics function of IdleState or that of Enemy01? Is there any way I can make this work without having to move both nodes into the same scene or doing some other weird workaround?
Note that I cannot add any code to IdleState directly since that node has its own external script. Let me know if anything needs clarification, thanks.