Hi there! I’m Cain.
I’m working on a game that includes a crate system where players can roll for items. I want to implement item rarities, but also include a luck booster mechanic. The problem is — I’m not entirely sure how the math behind these luck systems works.
I’ve seen some systems where they multiply the chances by 10, then generate a random number from 1 to that new value, but it’s kind of confusing to follow. Math isn’t my strongest area, but I’m doing my best to understand how it all works.
I’m not asking for a full script — just looking for some direction or explanation on how the math behind this works so I can build it myself.
I came across this system on the DevForum that supposedly works. It applies luck and rolls a rarity when a button is clicked — the solution post is what I’m referencing.
Thanks in advance to anyone who can help explain!
1 Like
You can do it in multiple ways, the most common one is lets say you will go to lowest luck of 0.01% so you generate a number from 1 to 10k. and then do the stuff to check what you actually rolled. now if you had 100% more luck you could just start from rarest one so if it was lets say 50%, 25%, 20%, 5% in a crate make all boosted so you get 100%, 50%, 40%, 10%. now of course the most common would be discarded in that way, but if you want to make it little more complex you can make it have full effect on rare ones, but the more common ones get less effected. Lets say the rarest gets 100%, next one gets 80%, then 60%… depending on how much items you have in the crate. Basicly you can go any way you like and make it complex or simple.
1 Like
how do i go about the math to alter these chances? i can mostly understand it, i have the rarist chance be like 0.001, and i can divide that by the luck to increase the chance, but this also increases the common chances. how can i shrink the common ones while GROWING the rare chances
well to make it all cap to 100% total would be lil hard, but it would be easiest to just instead of first checking if 0.001% is filled you check the chance x2 so 0.002% for that one, then next one instead of 0.5 make it 1% and so on. you can make the boost go from x2, to x1.8, to x1.6 so it gradually loses power and more common ones still have chance to be obtained