Hey, thank you for your advice. However, I don’t think that would solve the problem regarding the balance between casual and pro players. So I’ve recently implemented grading system, this time it will calculate the percentage instead of points. So here we are
We have two arrays to summarize, one is requirements, and one is player information
--Table of rank requirements
local ranks = {
["S"] = {min = 1, max = math.huge},
["A"] = {min = 0.7, max = 1},
["B"] = {min = 0.4, max = 0.7},
["C"] = {min = 0.2, max = 0.4},
["D"] = {min = 0.1, max = 0.2},
["E"] = {min = 0, max = 0.1},
}
--Table of player summaries (IN WAVE)
local players = {
{name = "JOY", currentKills = 6, currentAssists = 0, lessThan20Damage = true},
{name = "GLENN", currentKills = 6, currentAssists = 0, lessThan20Damage = true},
{name = "JOHN", currentKills = 9, currentAssists = 0, lessThan20Damage = true},
{name = "DOE", currentKills = 9, currentAssists = 0, lessThan20Damage = true},
}
Next, we calculate the percentage in each player and declare their personal rank. We also store player’s score for future reference
local function Round(n, decimals)
decimals = decimals or 0
return math.floor(n * 10^decimals) / 10^decimals
end
print("===============")
local waveMobs = 30 --How many mobs in current wave?
local trueSum = 0
for i, v in pairs(players) do
local noMissBonus = (v.lessThan20Damage and 0.15 or 0) --Increase percentage by 0.15 if u dont take more than 20% damage
local sum = v.currentKills + (v.currentAssists * 0.5) --Halve assist count
local percentage = Round((sum / waveMobs) + noMissBonus, 3)
local rank = "F"
for ii, vv in pairs(ranks) do
if percentage >= vv.min and percentage < vv.max then
rank = ii
end
end
--Print personal rank info
print("name: "..v.name.." - score: "..percentage.." - no miss: "..(v.lessThan20Damage and "YES" or "NO").." - personal rank: "..rank)
trueSum += percentage --For future reference
end
Lastly, we accumulate percentages from all players and then average to get overall rank
local truePercentage = Round(trueSum / #players, 3) --Divide by numbers of players
local trueRank = "F"
for i, v in pairs(ranks) do
if truePercentage >= v.min and truePercentage < v.max then
truePercentage = i
end
end
print("===============")
--Accumulate percentages from all players and then average to get overall rank
print("wave score: "..truePercentage.." - overall rank: "..trueRank)
And we finally have results…
There’s still one problem though, all players get having fair amounts of kills still get lower rank. This can be solved by reducing requirements. But for me, I’m uncertain.
If you have any ideas, don’t hesitate to ask or answer me
Edit: I marked this reply as a solution so people can use it as a reference.