How do I make a system of odds or percentages? example:
T1 = 20%
T2 = 30%
T3 = 15%
T4 = 35%
How do I make a system of odds or percentages? example:
T1 = 20%
T2 = 30%
T3 = 15%
T4 = 35%
you can get a percentage by dividing them with 100
examples:
print(20 / 100) -- 0.2, same as 20%
print(30 / 100) -- 0.3, same as 30%
print(15 / 100) -- 0.15, same as 15%
print(35 / 100) -- 0.35, same as 35%
print(100 / 100 -- 1, same as 100%
and if you wanted to use it, this is an example:
print(200 * (25 / 100)) -- 25% of 200 = 50
Or, with maximum numbers.
Example:
Maximum is 150.
local max = 150
print(20 / max)
print(80 / max)
print(150 / max)
If you’re talking about how to choose from a collection of differently weighted items, this post provides some example code of its implementation.
Thanks to all of you, you helped me a lot, that’s what I wanted