Slot based inventory that does NOT depend on a whole bunch of widgets and umg elements?
Hey all I'm trying to make a slot based inventory that would allow the player to have options on what to do with items when you select them.
Problem; every inventory system tutorial I find wants to either use really specific numbers to make things work or use a fuckton of widgets. I'd rather just have all inventory functions centered in one hud and one bp.
So from what I can find it seems like this is something I have to figure out myself, so if anyone could point me in the right direction to any of the problems I will list below that would be amazing.
Allow actors to pick up an object(which is just getting added to inventory)
Actually have items get added to the inventory with stacking, weight, proper quantity etc..
Have a menu pop up on mouse location when you click the object in your inventory.
Functionalities such as, ability to move objects slots with mouse, and functions to fill the menu pop up. (Remove item, equip, use, etc...)
If anyone could point em in the right direction to get this setup that would be great! I already have an idea of how to do a lot of this but me being super fucking new, I'm more then sure it's gonna be tedious and full of errors ant not very efficient.
All the tuts I find usually want to make an inventory hud, then the slot widgets, then add them based if they have something. I'd rather just have the inventory and slots already there and just show info if they are full. That is where I'm running into problems cause any problem I have isn't fixable by looking at the tut since they are doing it different from me.
Just to save you time researching. It cannot be done and should not be done. Using custom widgets is the most powerful feature of the UMG, by trying to cram everything into a single blueprint you'll be shooting yourself in the foot. Modularity and code reusability are key. It's also about performance, user experience, overcoming UMG's limitations (not talking about Slate here) and, most important of all, maintenance.
Admittedly, inventories are far from easy to code so:
...is a valid reason for struggle. Perhaps you should consider breaking it into small elements and work on them one-by-one, as you go.
Interestingly enough, this is the way to do it, actually - your way. Notice how you said you want the slots to be already there, indicating you need more widgets (slots) rather than less widgets; pretty much negating what you stated in the topic.
TL;DR - unfortunately, you will need bunches of widgets to pull it off. A fully-featured moderately complex inventory is a rat's nest of wires, Event Dispatchers and Interfaces all spread unevenly across multiple blueprints (some of them cannot even be widgets since they do not Tick offscreen and are prone to Garbage Collection and also get destroyed when transitioning from level to level.
answered Apr 25 '19 at 06:46 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here