Create a specific instance from a struct?

mckinney

Member
Hey all, I've just followed Peyton Burnham's wonderful tutorial on inventory systems, and I'm trying to go a little further with it by having items appear back on the ground when you've dropped them. I'm storing item names and data in a big struct, then using collision to run a script which destroys the instance that is on the ground, and adds it to an array. Then it draws the inventory items on the screen from the struct data i gave it. All overworld items are stored in a single object, as I'm just using the struct global.item_list and adding the item to the creation code (like global.item_list.hat). This is creating a problem when I try to create a new instance of the stored object because my code doesn't keep track of this global.item_list.hat when the item is picked up. Is there a way to use a variable to make the "hat" part of this changeable? I'd like to create an instance where the global.item_list.X knows which item to create. Thanks
 
Top