Connection signal between two nodes indirectly without global signal uses

Godot Version

4.2

Question

Is there a way to connect two signal between nodes using this pattern. Example

Node Parent (Player)
-----> NodeComponent_1(Skill 1) send signal
-----> NodeComponent_2(Skill 2) receive signal

The idea is that the child nodes communicate with each other autonomously.

Yes. If the child nodes know of each other, e.g. their scripts include an export variable referencing the other node, or you connect them from the parent script.

1 Like

I was reading a little more about the signals and it could be done like you are talking about but I thought a way without the parent but this one is necessary to redirect the signal.

Only to connect it! It does not take any active role in routing the signal. As long as it knows about the paths for NodeComponent_1 and NodeComponent_2, any other node could connect the signal equally well.

Alternatively, you might want to use an AutoLoad node as an event bus:

1 Like

thanks for the video. Im going to review it.
But this is the doubt.
flow Diagram

Implementation


Here 3 nodes
The main idea is sending the signal directly

This was the solution.

EntityNode
   seleccionComponent.connect( "entidadActiva", Callable(movilidadComponent, "perimetroVisualDeMovimiento") )

Thanks for you help…the video was very usefull…!!!

Quick note:

seleccionComponent.connect("entidadActiva", movilidadComponent.perimetroVisualDeMovimiento)

should also work, while being shorter and (potentially) allowing autocompletion. :slight_smile:

1 Like

I´m going to try it out. Thanks!!!

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