Chance (easy random items + luck modifiers)!

local generator = Chance.new({
    Rare = 30,
    Epic = 20,
    Legendary = 10,
    Mythical = 1,
    Exotic = 0.1,
})

local runs = 0
for i = 1, 100 do
    runs += 1

    local type = generator:Run() or "Common"
    if type == "Exotic" or runs == 50 then
        type = "Exotic"
        runs = 0
    end
    
    print(type)
end

With this code, you will get an exotic after 50 attempts. This is unbalanced, but you get the idea.

2 Likes

If you’re making an RNG game like Sol’s RNG, do you find this module hard to use? It’s not necessarily meant for the 1 in x chance system, but it could still work. If it doesn’t work well with RNG games, what interface would you like to see that makes it easiest to work with?

Additionally, it would help if I made a new luck logic system. I currently do not like the luck system, but I’m not sure of how to code a better one. :pensive:

Was waiting for someone to release something like this for a while as developing my own would be poor in areas.

Such a well needed release :+1:

working on a PVE game similar to decaying winter and I need random spawn rates for items, this module will be epic just for that.