Hi! I’m currently making an RTS Survival type game and I’ve just implemented a basic inventory system, but I have a problem that I’m trying to get some help about. When I collect an item it goes to a “general” inventory instead of the unit’s inventory who picked/harvested it.
I want to make it so every unit has an individual inventory but I don’t know a way to “split it” and make it individual.
I can drop the bps here if that helps.
Thanks in advance
Hi, yes sure!
I have a BFL as a base blueprint, to add and remove items, to spawn the inventory widget and update it. Then I have a simple actor bp for the item pickup action. And then some widgets for the visuals, datatables to store the item info and that’s it if I’m not mistaken.
Ok, thats fine! And where is separation logic at the moment? Do actors store their inventories in some property? In fact it should be almost independent from UI and widgets and be connected mostly with owning actors… In some project use TArray of UClasses (storing a list of added items classes only) or TMap of UClasses and uint8 (added items classes and corresponding num). It is rather good solution if those items are simple pickups and have no dynamic params or data =) But if they do, then one should also store this data and things gets more nasty… If you want a bit of abstraction you can even create component for this purpose…
When you say store added items and classes, do you mean like a datatable or not really?
It is almost independent from UI, only used it to display the items, nothing else
Most of the work is done on the BFL