$3

Random Loot Puller Class for Unity

I want this!

Random Loot Puller Class for Unity

$3

Programming statistics of loot drops can quickly become messy. Too many if/thens and long switches for the percentages alone. Adding new chances becomes a rewrite and math chore.

The Random Loot Puller class is an evolved shuffle bag that elimanates these problems. Simply add the chances into the "bag" using instances or percentages. Whatever is more convenient. Then pull randomly or in order. The prime goal is to make it as easy, quick and performance optimized. Along with being resilient to what is thrown at it.

How easy to use? Here's an example:

RLP<string> lootChest = new RLP<string>();
lootChest.addItem("sword", 25);
lootChest.addItem("shield", 10);
lootChest.addItem("axe", 10);
lootChest.addItem("wand", 5);

That's 50 "chances" in the chest. Now, let's get a random item from that chest:

lootChest.pullRandom(); 

That's it. It's fully functional. You now have a bag with a respective 50%, 20%, 20%, and 10% chance of pulling those items. 

Need to add another item that has a 10% chance of showing up because the player just unlocked it?

lootChest.addItem("coolNewWeapon", 0.1f);

Done! 

Want to return an item class you created instead? Something special that speeds up your development process?

RLP<yourCustomClass> lootChest = new RLP<yourCustomClass>();

The pulls will now return the items you put in. That's a lot less conditionals to worry about if you just get the item you need instead.

Other features:

-Inclusive and exclusive percentage based item adding.
-Pick items in order (think drawing from a deck of cards)
-Shuffle contents as many times as desired
-Template bag contents to load into bags for adding and clearing
-Debug aids

This class is an evolution of my usage. I've made it extremely simple to use and resilient. It's great for beginners and has worked in both game and non-game environments I've thrown it into.

And a bonus!

I included loot chest and loot bag models for you to freely use in your game! The blend files are included, as well as a Unity asset package that you can quickly import and start using immediately.

To help with learning the features, there's an example project included as well. The FullHowTo is extremely well commented explaining how to use it in a practical setting.

Have fun and feel free to ask me questions!

I want this!
Size
796 KB