I gave up
Inventory System with Randomly Generated Loot
Hey fellas, I've recently started a new project. To make it simple, it's a game similar to clicker heroes, but with loot. What I wanted to was rather simple on paper. Make an inventory system where every time you kill an enemy, an item with randomly generated values get added to the inventory. However, I ran into a lot of trouble. None of the tutorials available fit what I was trying to achieve, and since I'm not a genius programmer, I still haven't figured it out. Here are the details of how the Inventory would work:
-Killing an enemy adds an item to the inventory. This item isn't part of an item list or dictionary or whatever as the sprite and values are randomly generated upon obtaining said item.
-The items are gear pieces which means you can equip them to a character. To equip items you simply drag them to another slot next to the inventory which is the character. After equipping the item, it's stats are added to the character's stats.
-The inventory either works with a slot system or with a grid layout group containing game objects as items. Whichever one would work best with what I'm going for
-None of the items are stackable
-I, of course, need to save the items somewhere to make sure the player finds his whole inventory when opening the game again
This is basically it. I'm not asking for anybody to make it for me, I just need some insight from more brilliant people. Anything helps.
Answer by Aether808 · Jan 23, 2019 at 09:18 PM
I might seem like a wimp after saying this but an inventory system is simply too hard for me. Instead, I spent an hour or so trying to find another way to manage loot in this game and I found it. It doesn't involve an inventory which might make the game a bit less feature packed but to be honest I never expected to even finish this game so it's fine to me. Thanks to ray2yar because thanks to you I have an awesome way to save and store data. Thanks, bud.
Answer by ray2yar · Jan 23, 2019 at 12:36 AM
Why not save the data in a file?
One method is right on the unity website: https://unity3d.com/learn/tutorials/topics/scripting/persistence-saving-and-loading-data
You can even use this method to save custom data.
Since you have a certain number of item slots you could save the contents of each slot.
Ah yes this seems like it would be very good for the inventory. Thank you for your answer!