Hello you lovely deviants, I wanted to share that I have been working on the Item Dropping Logic/Code
Each Enemy would have set and assigned Items they can potentially drop, that could be a 1 x Petty Item, 2x Unusual Item or could be 1 x Valuable Item, 1 x Precious Item, and 1 x Priceless Item. The Enemy would also then have a Max Drop Count (ie the max number of chances to drop items - so if it had a max drop count of 5, it has 5 potential chances of dropping items)The enemies rarity would affect the likely hood of a successful drop of that item. The below is a common enemy drop chances. Where a Petty Item has an 80% chance of successfully dropping But still a 20% of failure.
The below is the Rare drop chance success rates (just ballpark numbers for now) where if a Petty item were to be selected as the possible drop, it would always succeed with a 100%
There will also be items that can be marked as "guaranteed" that would be for story or side quest purposes
But this is how it would actually work:
Guaranteed items always drop first
After that, the system selects random non-guaranteed items and rolls against their rarity chance until the maximum drop count is reached - it does this by:
Firstly picking a random item from the possible list of items the enemy can drop
It then looks up its rarity chance (in the example below that is Petty = 0.8 with a common enemy
The system then Rolls a random value from 0.0 → 1.0
If the number you roll is equal or lower than that item's chance it will drop the item - for example, if you were to get a 0.43 you would succeed. (It sounds a little strange as rolling a lower number is what makes it successful haha, but it just helped me visually look at the chance sliders as setting 0.8 as an 80% success rate, instead of it showing a 20% failure rate instead.)
And if we take that a step further, using the common enemy chances, the below would be the rough estimates on how often you would potentially see a common item drop the below rarities (assuming, the enemy was able to drop all rarities)
Petty - 1.25 Almost always drops
Unusual - About every 2 rolls
Valuable - About every 3–4 rolls
Precious - About every 6–7 rolls
Priceless - About every 20 rollsI hope this kind of made sense, but would love to hear your feedback or suggestions on how this could be improved.