対戦時にランク、得点差などを表示するスクリプトコードです。
要するにかたさんとDJさんのパクリです。
---------- listing up by rank internally. thx Kata, here based on your script.
function RANK()
for P in Players() do
P._rank = 1
for i = 0, #Players - 1 do
if Game.type ~= "tag" then
if Players[i].points > P.points then
P._rank = P._rank + 1
end
else
if Players[i].points < P.points then
P._rank = P._rank + 1
end
end
end
end
end
------------------------------------------------
-------- Showing texts Rank, Score, etc,. -------------
function HUDS()
for P in Players() do
if (P._rank == 1) then -- TOPSCORE
TOPSCORE = P.points
P.overlays[0].color = 3 --DEEP GREEN
elseif (P._rank == #Players) then -- worst rank
P.overlays[0].color = 2 --RED
SPREAD = P.points - TOPSCORE
elseif (P._rank == #Players - 1) then
P.overlays[0].color = 5 --YELLOW
else
P.overlays[0].color = 1
end
-------- Caliculate time(minuites, seconds, ticks) remaining. -------------
-------- 残り時間から、分、秒、カンマ以下を計算します↓
local min, sec, tik, mzro, szro, tzro = 0, 0, 0, "", "", ""
min = math.floor(Game.time_remaining / 1800)
sec = math.floor(Game.time_remaining / 30) - min * 60
tik = math.floor(((Game.time_remaining - sec * 30 - min * 1800) / 30) * 99)
-------- keeping figures of min, sec, tik to 2. look better!
-------- それぞれ分、秒、カンマ以下の単位の桁数を揃えています。見た目重視!↓
if min < 10 then mzro = "0" else mzro = "" end
--keep figure numbers of min
if sec < 10 then szro = "0" else szro = "" end
--sec
if tik < 10 then tzro = "0" else tzro = "" end
--tik
-------- Showing caliculated time like "Remaining Time: 00min:00sec:00".
-------- 以上の計算結果を、"Remaining Time: 00min:00sec:00"といった具合に表示します。
P.overlays[2].text = " Remaining Time: "..(mzro)..min..":"..(szro)..sec..":"..(tzro)..tik, 0
-------- Showing each player's rank, points, and spread. -------------
-------- スコアはP.pointsをそのまま表示、得点差はこの場で計算しています↓
P.overlays[1].text = "Score: "..P.points.." Spread: "..math.floor(P.points - TOPSCORE)..""
P.overlays[1].color = 4 -- Light Blue
P.overlays[0].text = "Rank: "..P._rank.."\/"..#Players..""
-------- wanna show messages for each players and different one to specified player? -------------
-------- then seen right under here. --------
if P == SAINT then
P.overlays[4].text = " You're SAINT! Punish Resistance!"
P.overlays[4].color = math.floor(Game.global_random(8))
else
P.overlays[4].text = " You're Resistance. Kill the SAINT!"
P.overlays[4].color = 0
end
end
end
PR