I want a players fishing rod to determine the kinds of fish they can catch. Higher skill the fishing rod has, the more rare fish are added. The FishData has a value called ‘Rarity’ and I basically add however much the Rarity is of each fish into a table. Like so
-- Go through all the fish
for fish, v in pairs(WaterType) do
-- Loop through fish rarity
for i = 1, v.Rarity do
table.insert(AllFish, fish)
end
end
So the higher the Rarity value is, the more likely you are to catch that fish, as it gets added into the table more times.
How can I incoprorate the rods skill to increase the rarities of lower rarity fish? At first I thought something like
-- Go through all the fish
for fish, v in pairs(WaterType) do
-- Loop through fish rarity
for i = 1, v.Rarity * RodSkill do
table.insert(AllFish, fish)
end
end
But that’d also increase the more common fish, and would actually make it harder to catch the rarer fish.
The rod data
return {
Rods = {
-- Skill determines rarity of fish
['Basic Rod'] = {
Skill = 1,
},
['Iron Rod'] = {
Cost = 150,
Skill = 2,
},
['Special Rod'] = {
ID = 12345678,
Skill = 10,
},
},
}
And the FishData
return {
['Freshwater'] = {
-- Common
['Smelt'] = {
Rarity = 20,
Cash = 1,
Difficulty = 1,
},
['Goby'] = {
Rarity = 20,
Cash = 1,
Difficulty = 1,
},
['Ito'] = {
Rarity = 20,
Cash = 1,
Difficulty = 1,
},
-- Uncommon
['Eel'] = {
Rarity = 15,
Cash = 1,
Difficulty = 2,
},
['Bowfin'] = {
Rarity = 15,
Cash = 1,
Difficulty = 2,
},
['Catfish'] = {
Rarity = 15,
Cash = 1,
Difficulty = 2,
},
['Kokanee'] = {
Rarity = 15,
Cash = 1,
Difficulty = 2,
},
-- Rare
['Carp'] = {
Rarity = 10,
Cash = 1,
Difficulty = 3,
},
['Black Bass'] = {
Rarity = 10,
Cash = 1,
Difficulty = 3,
},
['Trout'] = {
Rarity = 10,
Cash = 1,
Difficulty = 3,
},
--
['Alligator Gar'] = {
Rarity = 5,
Cash = 1,
Difficulty = 4,
},
-- Legendary
['Arapaima'] = {
Rarity = 1,
Cash = 1,
Difficulty = 5,
},
},
}