Rarity System, with increasing Luck

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I’m trying to make a Rarity System, similar to Sword Factory X, with increasing Luck, that than gets rid of the item within the LootTable after it too common

  2. What is the issue? Include screenshots / videos if possible!
    I know how to make a simple Rarity System, but I don’t understand how to add luck and than eliminate items that are too common

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve searched all over for a explanation but no clear vision, if someone can demonstrate a simple version for me that would be wonderful.

local weights = {100, 50, 200, 1}

local Target = 200

local MaxLuck = 20

local AdjustedWeights = {}

for Luck = 0, 20 do
	print("luck value:", Luck)
	for i, weight in ipairs(weights) do
		local fraction = Luck / MaxLuck
		local distance = Target - weight
		AdjustedWeights[i] = weight + distance * fraction
	end
	table.foreach(AdjustedWeights, print)
end
2 Likes