So I'm trying to find the best way to make a chest in my game. I originally tried to use an array but I don't know how to display the items in the chest doing that, nor do I know how to set each X value to a random number(loot generation). I instead made 10 variables on the chest which choose random numbers (each is an ID of an object/item). When you press E after having opened the chest, It adds ALL of them to your inventory. To make a selection of which item you want easier, I scratched that idea. I don't really want to go with the variable generation either, it seems tedious and a bad method. Let me explain what I'm trying to do.
(Chest code for reference)
So I came up with the idea to show a small chest inventory like the player inventory shows. So each inventory slot is an object and the frame determines the object ID and adds it to your inventory accordingly.
What I wanna do is make it so all of these boxes for the inventory slots will do one of the following- Either move them to the chest you have opened and slightly to the left, or for each chest on the start of the layout spawn inventory boxes. But then it would be hard to set the UD and LR id's (that's how I get WASD control in the chest inventory)
Also depending on how the above problem is fixed, I may need help creating random generation for the chests (If I end up going with random generation by chest instance variable, help with this part won't be needed). If each chest ends up spawning boxes at the start I won't need help, I have a concept that will work. If the boxes end up moving to the chest each time you open one I'm going to need a way to store the information of the chest contents and be able to retrieve them if you open the same chest, and adjust the inventory boxes accordingly.
If you wish to mess around with it and test yourself, here is the capx. The troublesome code is on the "Object" event sheet and bookmarked. Press E to open the chest, TAB to close and resume control of the player- https://www.dropbox.com/s/6ujs1cjnoiia5 ... .capx?dl=0
Any help is appreciated <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">