Hi, so I’m finishing up on a fishing system, and apparently, no matter how I arrange it, the fish chance key-tables I’m creating just do not want to iterate correctly. It’s always the one certain value that’s always the first to get iterated on. This completely ruins my system. A little background as to what I’m doing:
I have a system set up similar to this:
local fish = {
[25] = {name = "Goldfish"};
[100] = {name = "Common Goldfish"};
}
Basically, each time the player fishes, a random number is drawn from 1-100. Then, a loop iterates through the fish stats for whatever fishing rod the player is using, and determines which fish has been caught. Why it’s important that the loop iterates through these keys smallest to largest, is because I check to see if the number drawn is smaller or equal to the chance of the fish. So like, an example of the problem, if the number drawn is 20, technically it should get the rare Goldfish. But, if the loop iterates through the 100 value first, it’ll select the common goldfish.
Thanks for reading!