Get nodes from another scene?

Godot Version

4.3.stable

Question

I'm making a game which uses a GridMap as a tileset, and in order for some of the interactive tiles to work, I need to be able to reference nodes from another scene(namely, the player). Is this possible, and how would I do this?

Communication between nodes is certainly possible.

As for how it is done, that depends on what you are trying to do. Could you be a bit more specific about what you are trying to accomplish?

1 Like

Sure. I have two tiles that I want players to interact with: the Chest and the Tree. the chest(as the name implies) is a chest which stores items and opens a GUI when right-clicked. The tree is a tree(who knew) which is cut down when the player hits it with an axe.

If the chest / tree is an area, you can use an area on the player to get the nodes.

1 Like

OK, that’s helpful. Thanks :slight_smile:

Hmm, I tried it and it doesn’t work for some reason. I used an Area3D to detect the character moving near the chest and then checking for r-click to open it, but it doesn’t even detect the player.

Are you listening for the signals emitted? There are different ones for the two events.

Yeah, I linked the body_entered and body_exited functions to a script within the chest, should I move the script or do something else?

At this point, I think it would be helpful to see the actual code you are using for the player and the chest. Please post it in a pre-formatted text box - makes it much easier to read.

A screenshot of the node configuration for both the player and the chest would also be helpful.

The mouse click signal is completely separate, but for the moment let’s focus on detecting the player.