Hey guys,
Sorry for the bad code your about to see but I’ve been watching a tutorial by Maker Tech to make a Action RPG. I’ve got to a part where im trying to insert the items I pick up into my inventory but when I walk over the items to pick them up I get a “Invalid call. Nonexistent function ‘insert’ in base null” right now the insert func just has a pass on it to check to check that it works like in the tutorial I’m watching but obviously I’am getting this error. Any help with this would be great and again sorry for the dumb question/bad code
From the code, it seems like you might have a node or something that is of class inventory, so if it’s a resource, you can make a new one in the inspector.
Hey, in this screenshot you’re showing the script “player.gd” and referencing the variable inventory. Find the place in the 2d, graphical editor where you stuck your player and click on it. Because you have @export var inventory: Inventory there should be a line in the inspector on the right side of your editor that says “Inventory” with a value next to it. Can you screenshot that?
If there’s nothing there that’s your problem. The solution depends on the tutorial (and I don’t want to mess that up), but you could start by clicking the drop-down in that empty area next to “Inventory” and making a new Inventory resource.