I Wanna add procedural loot generation into containers and into houses etc. I’m using the UMG Inventory tutorial assets. How can i get this done?
That’s quite a broad question you are asking. Try to dissect that into smaller bits or try to be more specific. With procedural you mean choosing random loot from a list every time or something more a la Borderlands with random pieces and stats?
Lets say i have these 'Containers" such as a chest, etc. And lets say i have items wich are INSIDE those “Containers” wich every time you open that container, it shows a list of items u can add to your inventory.
I’d like to know HOW to create these “Containers” that hold “items” wich u can add to your inventory. And on “Event begin play” i would like to RANDOMIZE those items.
Lets say sometimes there is items in those containers and sometimes theres not. Variation.
I’d appreciate if u can help me with this!
Also, i’m using the UMG Inventory from the “Inventory UI with UMG” tutorial. You can find that project on the launcher in the learn tab.
I believe you have already asked about the container part so assuming you already have that part done, I’ll get to the random loot part.
First, you would create an array variable holding all the classes of loot that can spawn into the container. Then, a bool such as “spawn loot?”. In your blueprint graph, set " is spawned?" Using the “random bool” function.
Then, branch using that bool. If it’s true, spawn an actor of class and get the class from the loot array using “random integer” as index.
The general idea is to create a widget that is similar to your inventory but based on the “Inventory” of that chest/container. It is like the container has his own Inventory, but without the Drop and Pickup functions.
I haven’t watched the tutorial (no time sorry), but the same way the items are placed in your tutorial, you would spawn them in the Containers inventory.
As dissonanceint already said, you can create an array of classes that hold all your basic items that the chest can spawn. Creating such a bool to prevent the “random” thing to spawn 6 times the same item is optional. You could also count how many items from that specific kind where spawned and limit it to 3 or something.
You think u can give me a an example?