Loot system rarity levels dont work as expected

Hello,
I created an Loot System, where an enemy drops a weapon on death.
The select I filled with my Weapon blueprints.
0,1,2 = Common weapon
3,4,5 = Rare weapon
6,7 = Epic weapon
8,9 = Legendary weapon
To give rarity levels different drop chances, I generated a random integer between 0 and 99, which I then check for range and set the rarity level index range for this with dropStartInt and dropEndInt to start and end weapon indexes of these rarity levels. Then I generate a random Int between dropStartInt and dropEndInt and have my weapon index.

I hope this made it a bit clear.
The problem is, I think something is not working as expected, Commons are dropped maybe 1 in 20 or something, which doesnt fit my expectations for the settings I made.

Hey @florian_17.20

There could be a problem with the differences in your random generation scale being different from the rarity scale. If you were to multiply your rarity scale by 10, it might fit the feeling you were going for a bit better. I hope this helps!

1 Like

You were expecting 48%, right?

Yes. The drop rates are pretty crazy, index number 1 is dropped about 10x often than index number 0. Index number 9 is never dropped.

This might be a dumb question… but are all these same class?


As a sugestion: creating an enum with the tiers, a struct with the enum + float (percent), and finally a data table will allow you to edit more easily and maintain consistency.

For example, this is one way to achieve this:
image

The numbers in this tables are calculated adding their previouse tiers + the their respective percentage: Tier2 = Tier1 + 10, Tier3 = Tier2 + 20. So in the end the result should be distributed roughly 1%, 10%, 20% and 69% respectively.

Rather than checking if the generated number is in range, you could check if it is less than starting with your lowest value. Then you can iterate through it like this, for example:

This is debuging the logic generating 1000 random floats:
RarityTable

Hope it helps.

1 Like

What bothers me greatly is that I can’t poke a whole in OP’s logic. Seems sound. My current theory is that the issue is in the measurement process, @florian_17.20 - how are you counting it?

Eyeballing does not cut it. :eyes: