How would I make a gun spawn more than another gun? IDK how to deal with these tpye of probabbilities.
You need to use a weighted random. An explanation is on stackoverflow. Here's some code I've written, with a demo:
function WeightTotal(weights) total = 0 for i = 1, #weights do total = total + weights[i] end return total end function WeightedRandom(weights, total) --returns index of random value (ex if weights are {0, 1, 0}, it would always return 2) local v = math.random() * total local i = 0 while v >= 0 do i = i + 1 v = v - weights[i] end return i end --Demonstration local weights = {1, 7, 2} local total = WeightTotal(weights) local sum = {} local index local n = 1000 math.randomseed(os.time()) math.random() for i = 1, total * n do index = WeightedRandom(weights, total) sum[index] = (sum[index] or 0) + 1 end print("Option, Expected # Times Selected, Times Selected") for i = 1, #weights do print(i, weights[i] * n, sum[i] or 0) end
To use this in your situation, you would associate a different weapon with each index and then use WeightedRandom to select a random one.