#Luck system for rolling system

14 messages · Page 1 of 1 (latest)

static snow
#

math.random returns a random normalized value

#

is that what you need?

#

wait thats not the question

wind wingBOT
#

studio** You are now Level 30! **studio

static snow
#

you'll have to calculate the chances based off base chances and chance multipliers

#

im not too sure how you're calculating the chances but you can store the player's rarity multipliers somewhere and just reconfigure the chances when rolling

local AuraChances = require(game.ReplicatedStorage.Modules.AuraChances)

local function deepCopy(original) -- function from roblox docs
    local copy = {}
    for k, v in pairs(original) do
        if type(v) == "table" then
            v = deepCopy(v)
        end
        copy[k] = v
    end
    return copy
end

local DeltaChances = deepCopy(AuraChances)

local RarityMultipliers = { -- example table
  {Name = "Unique", Multiplier = -20}; 
  {Name = "Devil", Multiplier = -70}; 
}

for _, chanceTbl in RarityMultipliers do
  if not DeltaChances[chanceTbl.Name] then warn(chanceTbl.Name.." is not a valid rarity") continue end
  DeltaChances[chanceTbl.Name].Chance += chanceTbl.Multiplier
end
#

@teal osprey and then use DeltaChances instead of AuraChances

#

ok I fixed a few things lmao

#

well I'll need a bit more context on how BonusLuck scales with "rare" rarities, since I'm not sure what fits that title

#

does it scale uniformly or does each "rare" rarity have different bonus luck multipliers

#
local AuraChances = require(game.ReplicatedStorage.Modules.AuraChances)

local function deepCopy(original) -- function from roblox docs
    local copy = {}
    for k, v in pairs(original) do
        if type(v) == "table" then
            v = deepCopy(v)
        end
        copy[k] = v
    end
    return copy
end

local DeltaChances = deepCopy(AuraChances)

local BonusLuck = 5

local RarityMultipliers = { -- example table
  {Name = "Unique", Multiplier = .9}; 
  {Name = "Devil", Multiplier = .7}; 
}

for _, chanceTbl in RarityMultipliers do
  if not DeltaChances[chanceTbl.Name] then warn(chanceTbl.Name.." is not a valid rarity") continue end
  DeltaChances[chanceTbl.Name].Chance *= (BonusLuck * chanceTbl.Multiplier)
end
#

what about this

#

Devil takes 0.7 of Bonus luck, Unique takes 0.9

#

if you set multiplier to 1, it'll multiply the total bonus luck