#Help needed with inventory system

1 messages · Page 1 of 1 (latest)

ivory dawn
#

It sounds like whatever function is setting those first four slots to have specific items is being called every time you open the menu. Can we see the code for that?

cedar holly
#

Sure

#

So I've got a dictionary to just write down what initially is in inventory and how much (more detailed data is from json file)

#

2nd one is function to update slots visually and its being used only in that 3rd screenshot

#

function from 3rd screen is autoloaded

ivory dawn
#

Which function(s) are being called when you open/close the inventory menu?

cedar holly
cedar holly
#

just that if im not wrong

ivory dawn
#

i went ahead and looked at the github repo for that tutorial series to get a better idea of what's going on here, and as far as the duplicating items thing goes it looks like the inventory dictionary in PlayerInventory.gd might not be updating properly when you move stuff around, and so when you open/close the menu again it calls initialize_inventory again, which checks for the items listed in the PlayerInventory.gd script, which seemingly haven't changed, with the updated slots in the inventory menu not correcting themselves either.

#

if you click on "Remote" on the scene tree while the game is running you'll be able to see all of the nodes currently present in the game, and you can click on them to reveal their properties in the inspector. this should allow you to see whether or not the inventory dictionary in PlayerInventory.gd is actually updating correctly or not

cedar holly
#

I wouldnt strictly follow/suggest by the github repo because it is somewhat different from what he showed on the video's. So either he did changes between video's that he later didnt show, or he worked on a part 9 that never came out

cedar holly
#

Btw that issue didnt occur before latest changes in code

#

I'll provide screenshots for that in a moment

cedar holly
#

Okay so I inspected the PlayerInventory node

#

and it seems to be updating equips dictionary instead of Inventory dictionary

#

so the problem must be there within the match:

#

because before recent changes in code it looked a little different and it worked fine

#

so to be clear

#

this was modified to add side slots for armor

#

and as far as I see there are no problems with the part that identifies if a item can fit into these slots

cedar holly
#

something is messed up inside of those matches

#

so that it skips all the cases and goes straight up to the last, default one

#

it looked like this before

#

and for comparison again

#

do I not understand something about "match" there and how it works?

cedar holly
#

@ivory dawn Hey so may I still count on for some help with that one from you? Sorry to bother through pings