Lootdrop Probability
Posted: Sat Apr 06, 2019 3:07 am
A few years ago I changed it on my server so that I could have a float for loot drop, and minimum items. I found this handy to have min and max loot amounts. Plus I wanted ultra rare drops. It looks like the official source has also changed to float, or am I wrong? I am just checking to see the differences on implementation, to see how far off my solution was since I am not as seasoned as some.
On the chance to drop, this is now in.
This was my old code, somewhat close.
I thought they did the same thing, which confused me. Having float on the left in parens did the casting to float. Is one safer?
What does the static cast actually do? I also brought in a random seed. One thing I found was that the loottable never resorts. So things at the top of the loot will always have a higher chance does that make sense? Unless you sort the loot table drops at every roll, those at the top have a higher chance. If you have a list of 20 items to be dropped unless you resort, those at the bottom may never drop. I hope that makes sense? I seem to remember bringing in chrono and using the time as a random seed.
On the chance to drop, this is now in.
Code: Select all
chancedrop = static_cast <float> (rand()) / (static_cast <float> (RAND_MAX / 100));Code: Select all
chance = (float)rand()/((float)(RAND_MAX))*100;What does the static cast actually do? I also brought in a random seed. One thing I found was that the loottable never resorts. So things at the top of the loot will always have a higher chance does that make sense? Unless you sort the loot table drops at every roll, those at the top have a higher chance. If you have a list of 20 items to be dropped unless you resort, those at the bottom may never drop. I hope that makes sense? I seem to remember bringing in chrono and using the time as a random seed.