Hello everyone,

I'm currently following a youtube tutorial on how to make an inventory system in godot 4. Here is the link and timestamp:


21:20

I've run into an issue that says that one of my functions is not found in base self and I am not sure what that means or what to do. The function not found is set_inventory_data(), which is found in a script attached to a PanelContainer Node called inventory. That PanelContainer Node is a child of a regular control node called InventoryInterface. A script attached to the InventoryInterface is the one calling the set_inventory_data() function. I have attached images to help understand my problem. I welcome any and all advice on this issue. Thank you all!

  • xyz replied to this.

    Derek9132 If one script is calling a method in a script attached to another object it needs to do so by specifying that object via dot syntax:

    object.method()

    In your case, guessing from the snapshots, that might be:

    $Inventory.set_inventory_data(...)

      xyz Thank you, I wasn't following the tutorial closely enough and missed that. Sorry to be a bother, but a new error has popped up, an on base Nil error. I have done some searching and I think this is probably because of an incorrect call or misspelling. I can't seem to find it, however, and i would really appreciate an extra pair of eyes to help search. I've provided more images for better understanding. The set_inventory_data function takes in an InventoryData data type as an argument, and the InventoryData class has a a variable called slot_datas that is an array of SlotData datatypes. However, it seems that the console is telling me that inventory_data doesn't have anything called slot_datas. Thank you for continuing to help me on my learning experience, xyz.

      • xyz replied to this.

        Derek9132 When calling set_inventory_data() you need to pass it an object of type InventoryData as an argument. Check that the caller script created and initialized such an object. Making the class InventoryData doesn't create any actual objects of that type.