# Procedural Loot Generation

**URL:** <https://forums.unrealengine.com/t/procedural-loot-generation/305528>\
**Category:** UI\
**Tags:** actors, Procedural-Generation, inventory, unreal-engine, Blueprint, question, UMG\
**Created:** [January 31, 2015, 2:18am UTC](https://forums.unrealengine.com/t/procedural-loot-generation/305528 "2015-01-31T02:18:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![gotgrassct](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/gotgrassct/32/734850_2.png) [@gotgrassct](https://forums.unrealengine.com/u/gotgrassct)\
**Post date:** [January 31, 2015, 2:18am UTC](https://forums.unrealengine.com/t/procedural-loot-generation/305528/1 "2015-01-31T02:18:30Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_958fa14f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_958fa14f](https://forums.unrealengine.com/u/anonymous_user_958fa14f)\
**Post date:** [January 31, 2015, 3:15am UTC](https://forums.unrealengine.com/t/procedural-loot-generation/305528/2 "2015-01-31T03:15:27Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![gotgrassct](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/gotgrassct/32/734850_2.png) [@gotgrassct](https://forums.unrealengine.com/u/gotgrassct)\
**Post date:** [January 31, 2015, 5:48am UTC](https://forums.unrealengine.com/t/procedural-loot-generation/305528/3 "2015-01-31T05:48:09Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![gotgrassct](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/gotgrassct/32/734850_2.png) [@gotgrassct](https://forums.unrealengine.com/u/gotgrassct)\
**Post date:** [January 31, 2015, 5:50am UTC](https://forums.unrealengine.com/t/procedural-loot-generation/305528/4 "2015-01-31T05:50:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_958fa14f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_958fa14f](https://forums.unrealengine.com/u/anonymous_user_958fa14f)\
**Post date:** [January 31, 2015, 1:00pm UTC](https://forums.unrealengine.com/t/procedural-loot-generation/305528/5 "2015-01-31T13:00:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![eXi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/exi/32/906583_2.png) [@eXi](https://forums.unrealengine.com/u/eXi)\
**Post date:** [January 31, 2015, 1:40pm UTC](https://forums.unrealengine.com/t/procedural-loot-generation/305528/6 "2015-01-31T13:40:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gotgrassct](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/gotgrassct/32/734850_2.png) [@gotgrassct](https://forums.unrealengine.com/u/gotgrassct)\
**Post date:** [February 5, 2015, 7:07am UTC](https://forums.unrealengine.com/t/procedural-loot-generation/305528/7 "2015-02-05T07:07:46Z")

</div>

You think u can give me a an example?

---

<div class="post-metadata">

**Author:** ![tjnker](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tjnker](https://forums.unrealengine.com/u/tjnker)\
**Post date:** [September 16, 2020, 5:51am UTC](https://forums.unrealengine.com/t/procedural-loot-generation/305528/8 "2020-09-16T05:51:19Z")

</div>

loot for pubg mobile.plear

 ![313642-inkedpubg-mobile-map-li.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/d/9/fd924b67c9974212599379709eeda37682d2fdd5.jpeg)
