How can I add modular item interaction?

Godot Version

Godot 3.5

Question

Hi, just switched to Godot engine for a little side project I’m working on. I was wondering if anybody could site me to some sort of documentation or explanation on how to connect the generic of an item (the template/prefab) to the generic of the player without them both being in the same scene. My problem is when I want a generic signal to be sent (like entering the objects area, or the players cursor changing), I can’t send the signal to the player from the base object, and would have to do it with every item that is in the scene with the player, and there has to be a way to circumvent this. Any help would be appreciated and I apologize if this is a noob question. Thank you.

Hm im not quite sure what exactly you want to do. Can you give a more explicit example?
You can use Area2D-signals to interact with objects

What I mean is when I have an object in its own self contained scene that can be customized and copied in levels, there is no way to generically interact with something else (a player) without connecting every custom items signals to the player, over and over again, customizing what code is ran.

Depends on what kind of interaction you want to have. You can connect signals through code

I understand signals can be connected and created via code. The interaction I want to have is an item system. My item stores data such as name, value, model (ect.) and I need the generic type (the empty template item) to have generic code to connect to the player. However in godot I am only seeing options to connecting my non-generic custom items one by one in the level in which both my player and items are in the scene.

You can use a area to detect items close to you and connect those to your player, or use a static variable /global script to access player directly in code independent of the scene

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