Hey Developers! I am making different items and pets, that has a different Rarity with them. Now my question, is how can I make it Efficient?
My first idea is to make a table, and add 1,000 objects to it, and so if a item was 10% Rare, There would be 100 of that item. I Hate this Idea, because it seems so unnecessary.
My problem is this:
There is some REALLY rare items. like 0.001% items. And there is a lot of items, so doing something like…
local RandomNumber = math.random(1, 1000)
if RandomNumber >= 1 and RandomNumber < 10 then
--Whatever comes next
elseif RandomNumber >= 10 and RandomNumber < 20 then
end
and repeating that, will be hard as there is 20-30 different items. There must be an eaiser way to do this? Anyone able to help? Any help is appreciated!!