[FOUND SOLUTION] Are these pet chances broken? (pet system)
Asked by
4 years ago Edited 3 years ago
I feel like there's something wrong with the local Chance. People have been reporting that the pets that are under 1% are very hard to hatch. If I make it (0,TotalWeight) I'm pretty sure it won't work. Anyone can tell me if it's broken?
01 | function ChoosePet(Egg) |
02 | local Data = Eggs [ Egg ] |
03 | local Pets = Data [ "Pets" ] |
05 | for i,v in pairs (Pets) do |
06 | TotalWeight = TotalWeight + v.Rarity |
08 | local Chance = math.random( 1 ,TotalWeight) |
10 | for i,v in pairs (Pets) do |
11 | Counter = Counter+v.Rarity |
12 | if Counter > = Chance then |