So i should start off by saying ive looked up almost every inventory tutorial and have tried to learn all the data structure types but im still struggling to adapt something into what i need.
From what ive seen Structs seem to be the best method for when items have alot of variables and info attached to them. I followed this tutorial:
But only the part about setting up the constructors. My project is setup in a way to where i need every object in the game to essentially be one object but have its variables replaced with the info from an item struct. I also need to create each item in the very beginning of the game in an initialize script. This is because not only can the player have an item but the obj_item can be placed on the ground, shop keepers and other NPCs have an inventory, chests and storage things can have an inventory, so it needs to be possible for everything in the game to have any item. But i dont want to create an item more than once. Simmilar to a bethesda game having a list of items and being able to pull an item from a list (item.#) would be perfect.
I dont want to create a thousand global variables and have to reference them in order to pull the info so im looking into data structures as a global.item to store the structs. So then i wouldnt need global.itemburningsword3, but instead global.item.241 or something. The issue is im not sure how to set this up and have it work well with constructors, or rather which data structure would be best. I dont think id need more than 1dimension because i just need the list to tell me which struct im referencing and thats it. Then objects that store things can use 2d lists to see which and how much of each item it has. Any thoughts? Thank you all in advance!
From what ive seen Structs seem to be the best method for when items have alot of variables and info attached to them. I followed this tutorial:
I dont want to create a thousand global variables and have to reference them in order to pull the info so im looking into data structures as a global.item to store the structs. So then i wouldnt need global.itemburningsword3, but instead global.item.241 or something. The issue is im not sure how to set this up and have it work well with constructors, or rather which data structure would be best. I dont think id need more than 1dimension because i just need the list to tell me which struct im referencing and thats it. Then objects that store things can use 2d lists to see which and how much of each item it has. Any thoughts? Thank you all in advance!