Hey could you look at this verse code PLEASE It worked perfectly fine, I duplicated the map and now it doesn’t work anymore.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/UI }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Verse.org/Assets }
using { /Fortnite.com/UI }
using { /Verse.org/Colors }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Playspaces}
using { /Fortnite.com/Game}
using { /Verse.org/Random}
using { /Verse.org}
using {/Verse.org/Concurrency}
VersePersistence := struct{
@editable Version : int = 1
}
Rank := struct{
@editable RankName : string = “BRONZE l”
@editable RankEloGoal : int = 0
@editable RankThemeColor : color = color{R:=0.015625,G:=0.015625,B:=0.015625}
}
ProgressBarSettings := struct{
@editable Progress_Bar_Type : ProgressBarType = ProgressBarType.EloCount
@editable Progress_Bar_Delay : float = 0.0
@editable Progress_LeadingColorBlock : color = color{R:=0.416667,G:=0.416667,B:=0.416667}
}
Default_Rank_Value := class{
@editable Value1 : Rank = Rank{RankName:= “UNRANKED”, RankEloGoal:= 25, RankThemeColor:= color{R:=0.0,G:=0.011213,B:=1.302745}}
@editable Value2 : Rank = Rank{RankName:= “BRONZE l”, RankEloGoal:= 50, RankThemeColor:= color{R:=0.549725,G:=0.323515,B:=0.049570}}
@editable Value3 : Rank = Rank{RankName:= “BRONZE ll”, RankEloGoal:= 100, RankThemeColor:= color{R:=0.549725,G:=0.323515,B:=0.049570}}
@editable Value4 : Rank = Rank{RankName:= “BRONZE lll”, RankEloGoal:= 150, RankThemeColor:= color{R:=0.549725,G:=0.323515,B:=0.049570}}
@editable Value5 : Rank = Rank{RankName:= “SILVER l”, RankEloGoal:= 200, RankThemeColor:= color{R:=0.982044,G:=0.976734,B:=0.996654}}
@editable Value6 : Rank = Rank{RankName:= “SILVER ll”, RankEloGoal:= 250, RankThemeColor:= color{R:=0.982044,G:=0.976734,B:=0.996654}}
@editable Value7 : Rank = Rank{RankName:= “SILVER lll”, RankEloGoal:= 300, RankThemeColor:= color{R:=0.982044,G:=0.976734,B:=0.996654}}
@editable Value8 : Rank = Rank{RankName:= “GOLD l”, RankEloGoal:= 350, RankThemeColor:= color{R:=0.678608,G:=0.597254,B:=0.087105}}
@editable Value9 : Rank = Rank{RankName:= “GOLD ll”, RankEloGoal:= 400, RankThemeColor:= color{R:=0.678608,G:=0.597254,B:=0.087105}}
@editable Value10: Rank = Rank{RankName:= “GOLD lll”, RankEloGoal:= 450, RankThemeColor:= color{R:=0.678608,G:=0.597254,B:=0.087105}}
@editable Value11: Rank = Rank{RankName:= “PLATINUM l”, RankEloGoal:= 500, RankThemeColor:= color{R:=0.445905,G:=0.667091,B:=0.949079}}
@editable Value12: Rank = Rank{RankName:= “PLATINUM ll”, RankEloGoal:= 550, RankThemeColor:= color{R:=0.445905,G:=0.667091,B:=0.949079}}
@editable Value13: Rank = Rank{RankName:= “PLATINUM lll”, RankEloGoal:= 600, RankThemeColor:= color{R:=0.445905,G:=0.667091,B:=0.949079}}
@editable Value14: Rank = Rank{RankName:= “DIAMOND l”, RankEloGoal:= 650, RankThemeColor:= color{R:=0.240635,G:=0.231112,B:=0.889298}}
@editable Value15: Rank = Rank{RankName:= “DIAMOND ll”, RankEloGoal:= 700, RankThemeColor:= color{R:=0.240635,G:=0.231112,B:=0.889298}}
@editable Value16: Rank = Rank{RankName:= “DIAMOND lll”, RankEloGoal:= 750, RankThemeColor:= color{R:=0.240635,G:=0.231112,B:=0.889298}}
@editable Value17: Rank = Rank{RankName:= “MASTER”, RankEloGoal:= 800, RankThemeColor:= color{R:=0.412281,G:=0.829424,B:=0.255347}}
@editable Value18: Rank = Rank{RankName:= “CHAMPION”, RankEloGoal:= 850, RankThemeColor:= color{R:=0.283294,G:=0.058818,B:=0.025802}}
@editable Value19: Rank = Rank{RankName:= “UNREAL”, RankEloGoal:= 900, RankThemeColor:= color{R:=0.410254,G:=0.234106,B:=0.891915}}
}
RankDifficulty := struct{
@editable EloGainPerKill : int = 5
@editable EloLossPerDeath : int = 2
@editable Ranks : ?Default_Rank_Value = false
@editable ShowEloUpdates : logic = true
@editable PromotedSound : audio_player_device = audio_player_device{}
@editable DemotedSound : audio_player_device = audio_player_device{}
@editable RankUpXp : accolades_device = accolades_device{}
}
DebuggerTesting := struct{
@editable AddKillsButton : button_device = button_device{}
@editable AddDeathsButton : button_device = button_device{}
}
DisplayStats:= struct{
@editable StatWidgetDisplayTime: float = 5.0
@editable StatsBillboard : billboard_device = billboard_device{}
@editable StatsBillboard2 : billboard_device = billboard_device{}
@editable DisplayPlayerStatsButton : button_device = button_device{}
@editable DisplayPlayerStatsButton2 : button_device = button_device{}
@editable DisplayPlayerStatsMutator : mutator_zone_device = mutator_zone_device {}
@editable StatsXP : accolades_device = accolades_device{}
@editable PlayerReference : player_reference_device = player_reference_device{}
@editable DisplayRankProp : creative_prop = creative_prop{}
}
BackBlingSettings:= struct{
@editable ToggleBackblingSwitch : switch_device = switch_device{}
@editable VfxDetach : visual_effect_powerup_device = visual_effect_powerup_device{}
@editable VfxPowerups : visual_effect_powerup_device = array{}
}
ProgressBarType := enum{
Percentage
EloCount
}
RankSystem := class(creative_device):
@editable Spawners : []player_spawner_device = array{}
@editable Verse_Persistence :VersePersistence= VersePersistence{}
@editable Rank_Difficulty : RankDifficulty = RankDifficulty{}
@editable Progress_Bar_Settings : ProgressBarSettings = ProgressBarSettings{}
@editable Display_Stats : DisplayStats = DisplayStats{}
@editable Debugger_Testing : DebuggerTesting = DebuggerTesting{}
@editable BackBling_Settings : BackBlingSettings = BackBlingSettings{}
S2M<localizes>(value:string)<computes> : message = "{value}"
ATM<localizes>(value:agent)<computes> : message = "{value}"
#-----------------------------------------
StatsMessage<localizes>(Kills:int, Deaths:int,Elo:int,KD:string):message = "Kills: {Kills}\nDeaths: {Deaths}\nElo: {Elo}\nKD: {KD} "
var EloDenominators :[]int = array{ 25, 75, 175, 250, 450, 650, 750, 900, 1200, 1400, 1750 , 2000, 2200,2500, 3000, 3400, 4000,5000,6000}
var RankNamesArray :[]string = array{ "UNRANKED", "BRONZE l", "BRONZE ll", "BRONZE lll", "SILVER l", "SILVER ll", "SILVER lll", "GOLD l", "GOLD ll", "GOLD lll", "PLATINUM l", "PLATINUM ll", "PLATINUM lll", "DIAMOND l", "DIAMOND ll", "DIAMOND lll", "ELITE", "CHAMPION", "UNREAL"}
var RankColors : []color = array{color{R:=0.0,G:=0.011213,B:=1.302745},color{R:=0.549725,G:=0.323515,B:=0.049570},color{R:=0.549725,G:=0.323515,B:=0.049570},color{R:=0.549725,G:=0.323515,B:=0.049570},color{R:=0.982044,G:=0.976734,B:=0.996654},color{R:=0.982044,G:=0.976734,B:=0.996654},color{R:=0.982044,G:=0.976734,B:=0.996654},color{R:=0.678608,G:=0.597254,B:=0.087105},color{R:=0.678608,G:=0.597254,B:=0.087105},color{R:=0.678608,G:=0.597254,B:=0.087105},color{R:=0.445905,G:=0.667091,B:=0.949079},color{R:=0.445905,G:=0.667091,B:=0.949079},color{R:=0.445905,G:=0.667091,B:=0.949079},color{R:=0.240635,G:=0.231112,B:=0.889298},color{R:=0.240635,G:=0.231112,B:=0.889298},color{R:=0.240635,G:=0.231112,B:=0.889298},color{R:=0.412281,G:=0.829424,B:=0.255347},color{R:=0.283294,G:=0.058818,B:=0.025802},color{R:=0.410254,G:=0.234106,B:=0.891915}}
# you store a Custom_Player_Rank class for each player in the game here
var Custom_Player_Rank_Map: [player]Custom_Player_Rank = map{}
# Verse Persistence Stats Manager
var PlayerStatsManager : player_stats_manager = player_stats_manager{}
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
# Initialize the Values from the external editables
InitValues()
# When a Player Leaves we need to remove there Custom_Player_Rank_UI from the map to free up memory
spawn. OnPlayerLeftEvent()
# This Button Increments The Player Ui
Debugger_Testing.AddKillsButton.InteractedWithEvent.Subscribe(OnEliminationButton)
# This Button Decrements The Player Ui]
Debugger_Testing.AddDeathsButton.InteractedWithEvent.Subscribe(OnEliminatedButton)
Display_Stats.DisplayPlayerStatsButton.InteractedWithEvent.Subscribe(UpdateStatsBillboard)
Display_Stats.DisplayPlayerStatsButton2.InteractedWithEvent.Subscribe(UpdateStatsBillboard2)
Display_Stats.DisplayPlayerStatsMutator.AgentEntersEvent.Subscribe(UpdateStatsBillboard)
Display_Stats.DisplayPlayerStatsMutator.AgentEntersEvent.Subscribe(UpdateStatsBillboard2)
# Initialize the spawners (For Join in progress)
InitSpawners()
# Add a Custom Player UI to all players in the game
InitPlayers()
BackBling_Settings.ToggleBackblingSwitch.TurnedOffEvent.Subscribe(ToggleVfx)
BackBling_Settings.ToggleBackblingSwitch.TurnedOnEvent.Subscribe(ToggleVfx)
OnPlayerLeftEvent()<suspends>:void=
loop:
Sleep(0.0)
PlayerLeaving := GetPlayspace().PlayerRemovedEvent().Await()
OnPlayerLeft(PlayerLeaving)
UpdateLeaderboard()
#Function to update the UI of a player
OnEliminated(ER:elimination_result):void=
if(EliminatedPlayer := player[ER.EliminatedCharacter.GetAgent[]] , EliminatingPlayer := player[ER.EliminatingCharacter?.GetAgent[]]):
if(EliminatedPlayer <> EliminatingPlayer):
if(EliminatingCustomPlayer := Custom_Player_Rank_Map[EliminatingPlayer]):
UpdateKillProgress(EliminatingCustomPlayer,EliminatingPlayer)
if(EliminatedCustomPlayer := Custom_Player_Rank_Map[EliminatedPlayer]):
UpdateDeathProgress(EliminatedCustomPlayer,EliminatedPlayer)
else:
Print("Eliminated Player is the same as Eliminating Player")
spawn. ShowStatsWidget(EliminatedPlayer,EliminatingPlayer)
UpdateLeaderboard()
ShowStatsWidget(EliminatedPlayer:player,EliminatingPlayer:player)<suspends>:void=
if(CustomPlayer := Custom_Player_Rank_Map[EliminatedPlayer],EnmyCustomPlayer := Custom_Player_Rank_Map[EliminatingPlayer],EliminatingPlayer.IsActive[],CurrentPlayerStats := PlayerStatsManager.GetPlayerStats[EliminatingPlayer]):
Canvas := CustomPlayer.StatWidget()
if. Texture :=RankIconsArray[EnmyCustomPlayer.CurrentRank] then. CustomPlayer.StatTextureBlock.SetImage(Texture)
CustomPlayer.PlayerNameRank.SetText(ATM(EliminatingPlayer))
CustomPlayer.PlayerStats.SetText(S2M("Kills: {CurrentPlayerStats.Kills.CurrentValue} Deaths: {CurrentPlayerStats.Deaths.CurrentValue}"))
if(CurrentPlayerStats.Kills.CurrentValue > 0 and CurrentPlayerStats.Deaths.CurrentValue = 0 ):
CustomPlayer.PlayerStats.SetText(S2M(" Kills:{CurrentPlayerStats.Kills.CurrentValue}\n Deaths:{CurrentPlayerStats.Deaths.CurrentValue}\n KD:{CurrentPlayerStats.Kills.CurrentValue}.00"))
else:
CustomPlayer.PlayerStats.SetText(S2M(" Kills:{CurrentPlayerStats.Kills.CurrentValue}\n Deaths:{CurrentPlayerStats.Deaths.CurrentValue}\n KD:{FloorFloat2Decimals(RoundFloat((CurrentPlayerStats.Kills.CurrentValue *1.0) / (CurrentPlayerStats.Deaths.CurrentValue*1.0),2))}"))
if(PlayerUI := GetPlayerUI[EliminatedPlayer]):
PlayerUI.AddWidget(Canvas)
CustomPlayer.BackgroundWidget.SetVisibility(widget_visibility.Visible)
Sleep(Display_Stats.StatWidgetDisplayTime)
PlayerUI.RemoveWidget(Canvas)
CustomPlayer.BackgroundWidget.SetVisibility(widget_visibility.Hidden)
#Function for Debuging
OnEliminationButton(Agent:agent):void=
Print("Button Pressed")
if(Player := player[Agent]):
if(EliminatingCustomPlayer := Custom_Player_Rank_Map[Player]):
UpdateKillProgress(EliminatingCustomPlayer,Player)
UpdateLeaderboard()
OnEliminatedButton(Agent:agent):void=
Print("Button Pressed")
if(Player := player[Agent]):
if(EliminatedCustomPlayer := Custom_Player_Rank_Map[Player]):
UpdateDeathProgress(EliminatedCustomPlayer,Player)
UpdateLeaderboard()
# initialize the spawners and subscribe to the PlayerJoined event
InitSpawners():void=
for(Spawner:Spawners):
Spawner.SpawnedEvent.Subscribe(OnPlayerJoined)
UpdateKillProgress(CustomPlayer:Custom_Player_Rank,Player:player):void=
if:
Player.IsActive[]
CurrentPlayerStats := PlayerStatsManager.GetPlayerStats[Player]
CurrentElo := CurrentPlayerStats.Elo.CurrentValue
CurrentKills := CurrentPlayerStats.Kills.CurrentValue
CurrentGoal := EloDenominators[CustomPlayer.CurrentRank]
EloGain := Rank_Difficulty.EloGainPerKill
var NewElo : int = CurrentElo + EloGain
then:
if. Rank_Difficulty.ShowEloUpdates = true then. spawn. EloUpdatesAnimation(CustomPlayer, true)
if (NewElo >= CurrentGoal ):
Print("Player Promoted")
PlayerStatsManager.RecordPlayerStat(Player, DataType.Elo, ?Value := NewElo)
PlayerStatsManager.RecordPlayerStat(Player, DataType.Kills, ?Value := CurrentKills + 1)
set CustomPlayer.CurrentRank = DetermineRank(NewElo)
set CustomPlayer.Elo = NewElo
if(not CustomPlayer.CurrentRank + 1 = EloDenominators.Length ):
Print("Current Rank: {CustomPlayer.CurrentRank} = {EloDenominators.Length}")
spawn. RankUpOrDownAnimation(CustomPlayer)
Rank_Difficulty.RankUpXp.Award(Player)
Rank_Difficulty.PromotedSound.Play()
spawn. PopupAnimation(true,CustomPlayer)
InitUi(Player)
else:
PlayerStatsManager.RecordPlayerStat(Player, DataType.Elo, ?Value := NewElo)
PlayerStatsManager.RecordPlayerStat(Player, DataType.Kills, ?Value := CurrentKills + 1)
set CustomPlayer.Elo = NewElo
if( CustomPlayer.CurrentRank = EloDenominators.Length - 1 ):
UpdateMaxRank(CustomPlayer)
else:
UpdateProgressBar(CustomPlayer,CurrentGoal)
UpdateDeathProgress(CustomPlayer:Custom_Player_Rank,Player:player):void=
if:
Player.IsActive[]
CurrentPlayerStats := PlayerStatsManager.GetPlayerStats[Player]
CurrentElo := CurrentPlayerStats.Elo.CurrentValue
CurrentDeaths := CurrentPlayerStats.Deaths.CurrentValue
EloLoss := Rank_Difficulty.EloLossPerDeath
var NewElo : int = CurrentElo - EloLoss
var CurrentRank : int = CustomPlayer.CurrentRank - 1
then:
# Prevent ELO from going negative
if. NewElo < 0 then. set NewElo = 0
if. CurrentRank < 0 then. set CurrentRank = 0
#Print("Current Rank: {CurrentRank}")
spawn. EloUpdatesAnimation(CustomPlayer, false)
if(PreviousGoal := EloDenominators[CurrentRank], CurrentGoal := EloDenominators[CurrentRank + 1]):
if (NewElo < PreviousGoal):
Print("Player Demoted")
PlayerStatsManager.RecordPlayerStat(Player, DataType.Elo, ?Value := NewElo)
PlayerStatsManager.RecordPlayerStat(Player, DataType.Deaths, ?Value := CurrentDeaths + 1)
set CustomPlayer.CurrentRank = DetermineRank(NewElo)
set CustomPlayer.Elo = NewElo
Rank_Difficulty.DemotedSound.Play(Player)
spawn. PopupAnimation(false,CustomPlayer)
InitUi(Player)
else:
PlayerStatsManager.RecordPlayerStat(Player, DataType.Elo, ?Value := NewElo)
PlayerStatsManager.RecordPlayerStat(Player, DataType.Deaths, ?Value := CurrentDeaths + 1)
set CustomPlayer.Elo = NewElo
if( CustomPlayer.CurrentRank = EloDenominators.Length - 1):
UpdateMaxRank(CustomPlayer)
else:
UpdateProgressBar(CustomPlayer,CurrentGoal)
PopupAnimation(RankUp:logic,CustomPlayer:Custom_Player_Rank)<suspends>:void=
var opacityArray : []type{_X:float where 0.000000 <= _X, _X <= 1.000000} = array{0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 0.95, 1.0}
var backArray : []type{_X:float where 0.000000 <= _X, _X <= 1.000000} = array{1.0, 0.95, 0.90, 0.85, 0.80, 0.75, 0.70, 0.65, 0.60, 0.55, 0.50, 0.45, 0.40, 0.35, 0.30, 0.25, 0.20, 0.15, 0.10, 0.05, 0.0}
var minOpacitySize : type{_X:float where 0.000000 <= _X, _X <= 1.000000} = 0.0
var DesiredSize : float = 50.0
# Loop through the opacityArray and set the text opacity to the value in the array.
if(RankUp = true):
CustomPlayer.PromotedTextBlock.SetText(S2M("PROMOTED!"))
CustomPlayer.PromotedTextBlock.SetTextColor(color{R:=0.066211,G:=1.0,B:=0.200985})
else:
CustomPlayer.PromotedTextBlock.SetText(S2M("DEMOTED!"))
CustomPlayer.PromotedTextBlock.SetTextColor(color{R:=1.0,G:=0.020607,B:=0.0})
for(Value : opacityArray):
Sleep(0.0)
CustomPlayer.PromotedTextBlock.SetShadowOffset(option{vector2{X:=DesiredSize,Y:=1.0}})
CustomPlayer.PromotedTextBlock.SetTextOpacity(Value)
set DesiredSize -= 2.5
Sleep(0.5)
# Loop through the backArray and set the text opacity to the value in the array.
for(Value:backArray):
Sleep(0.0)
CustomPlayer.PromotedTextBlock.SetShadowOffset(option{vector2{X:=DesiredSize,Y:=1.0}})
CustomPlayer.PromotedTextBlock.SetTextOpacity(Value)
set DesiredSize += 2.5
EloUpdatesAnimation(CustomPlayer:Custom_Player_Rank, isKill:logic)<suspends>:void=
var opacityArray : []type{_X:float where 0.000000 <= _X, _X <= 1.000000} = array{0.3333333333333333,0.3333333333333333,0.5000000000000001,0.6666666666666668,0.8333333333333335,1.0}
if(isKill = true):
CustomPlayer.EloUpdatesTextBlock.SetText(S2M("+{Rank_Difficulty.EloGainPerKill}"))
CustomPlayer.EloUpdatesTextBlock.SetTextColor(color{R:=0.0,G:=1.0,B:=0.016063})
else:
CustomPlayer.EloUpdatesTextBlock.SetText(S2M("-{Rank_Difficulty.EloLossPerDeath}"))
CustomPlayer.EloUpdatesTextBlock.SetTextColor(color{R:=1.0,G:=0.0,B:=0.012482})
var DesiredSize : float = 0.0
for(Value : opacityArray):
Sleep(0.0)
CustomPlayer.EloUpdatesTextBlock.SetShadowOffset(option{vector2{X:=DesiredSize,Y:=2.257583}})
CustomPlayer.EloUpdatesTextBlock.SetTextOpacity(Value)
set DesiredSize -= 1.333333333333333
Sleep(0.2)
CustomPlayer.EloUpdatesTextBlock.SetTextOpacity(0.0)
CustomPlayer.EloUpdatesTextBlock.SetShadowOffset(option{vector2{X:=0.0,Y:=2.257583}})
RankUpOrDownAnimation(CustomPlayer:Custom_Player_Rank)<suspends>:void=
if( CurrentTexture := RankIconsArray[CustomPlayer.CurrentRank]):
MinDesiredSize := 0.0
MaxDesiredSize := 70.0
var CurrentDesiredSize : float = 70.0
var FirstLoopDone : logic = false
var SecondLoop : logic = false
var ReturnString : string = ""
if(CurrentRankNames := RankNamesArray[CustomPlayer.CurrentRank]):
loop:
if(FirstLoopDone = false):
set CurrentDesiredSize -= 20.0
CustomPlayer.RankImage.SetDesiredSize(vector2{X:=80.0,Y:=CurrentDesiredSize})
if(CurrentDesiredSize <= MinDesiredSize):
CustomPlayer.RankImage.SetImage(CurrentTexture)
set FirstLoopDone = true
else if(SecondLoop = false):
set CurrentDesiredSize += 20.0
CustomPlayer.RankImage.SetDesiredSize(vector2{X:=80.0,Y:=CurrentDesiredSize})
if(CurrentDesiredSize >= MaxDesiredSize):
set SecondLoop = true
else if(FirstLoopDone = true and SecondLoop = true):
set FirstLoopDone = false
set SecondLoop = false
break
Sleep(0.02)
for(Index := 0..CurrentRankNames.Length-1):
if(Char:=CurrentRankNames[Index]):
set ReturnString = ReturnString + ToString(Char)
Sleep(0.1)
CustomPlayer.RankTextBlock.SetText(S2M("{ReturnString}"))
initializeAllPowerUp():void=
for(Player:GetPlayspace().GetPlayers()):
if(PlayerObj:=player[Player]):
if(CustomPlayer:= Custom_Player_Rank_Map[PlayerObj]):
initializePowerUp(PlayerObj,CustomPlayer)
initializePowerUp(Player:player,CustomPlayer:Custom_Player_Rank):void=
if(CurrentPowerUp := BackBling_Settings.VfxPowerups[CustomPlayer.CurrentRank]):
if(CustomPlayer.VfxEnabled = true):
BackBling_Settings.VfxDetach.Pickup(Player)
CurrentPowerUp.Pickup(Player)
else:
BackBling_Settings.VfxDetach.Pickup(Player)
ToggleVfx(Agent:agent):void=
if(PlayerObj:=player[Agent]):
if(CustomPlayer:= Custom_Player_Rank_Map[PlayerObj]):
if(CustomPlayer.VfxEnabled = true):
set CustomPlayer.VfxEnabled = false
else:
set CustomPlayer.VfxEnabled = true
initializePowerUp(PlayerObj,CustomPlayer)
UpdateProgressBar(CustomPlayer:Custom_Player_Rank,EloDenominator:int):void=
CustomPlayer.MainColorBlock.SetDesiredSize(vector2{X:=CaculateProgressBarWidthForRank(CustomPlayer.CurrentRank, 335.0, CustomPlayer.Elo,EloDenominator),Y:=27.5})
if( Progress_Bar_Settings.Progress_Bar_Type = ProgressBarType.Percentage):
CustomPlayer.EloProgress.SetText(S2M(ConvertToPercentage(CustomPlayer.Elo, EloDenominator,CustomPlayer.CurrentRank)))
else:
CustomPlayer.EloProgress.SetText(S2M("{CustomPlayer.Elo}/{EloDenominator}"))
UpdateMaxRank(CustomPlayer:Custom_Player_Rank):void=
CustomPlayer.MainColorBlock.SetDesiredSize(vector2{X:=327.0,Y:=27.5})
CustomPlayer.EloProgress.SetText(S2M("ELO: {CustomPlayer.Elo}"))
UpdateLeaderboard():void=
Players:= GetPlayspace().GetPlayers()
var CustomPlayerArray : []Custom_Player_Rank = array{}
for(Player:Players):
if(CustomPlayer:= Custom_Player_Rank_Map[Player]):
set CustomPlayerArray += array{CustomPlayer}
Sorted := InsertionSort(CustomPlayerArray)
TopK := if. Top5 := Sorted.Slice[0,5] then. Top5 else. Sorted
for(Key -> Value : Custom_Player_Rank_Map):
Value.UpdateLeaderboard(TopK)
# Function to Initialize the UI of a Player
InitUi(Player:player):void=
Print("Init UI")
if(CustomPlayer := Custom_Player_Rank_Map[Player]):
if:
Texture := RankIconsArray[CustomPlayer.CurrentRank]
EloDenominator := EloDenominators[CustomPlayer.CurrentRank]
RankNameText :string= RankNamesArray[CustomPlayer.CurrentRank]
then:
CustomPlayer.RankImage.SetImage(Texture)
if. ColorToSet := RankColors[CustomPlayer.CurrentRank] then. CustomPlayer.MainColorBlock.SetColor(ColorToSet)
if( CustomPlayer.CurrentRank = EloDenominators.Length - 1 ):
UpdateMaxRank(CustomPlayer)
else:
UpdateProgressBar(CustomPlayer,EloDenominator)
CustomPlayer.RankTextBlock.SetText(S2M(RankNameText))
Print(RankNameText)
else:
Print("Current Rank { CustomPlayer.CurrentRank} is out of bounds")
Print("Failed to Initialize UI")
initializeAllPowerUp()
# Function to Create a Custom_Player_Rank_UI and assign to a player
OnPlayerJoined(PlayerJoining:agent):void=
# Cast Agent to Player
if(Player := player[PlayerJoining]):
# Check if Player already has a Custom_Player_Rank_UI
if(PlayerExists := Custom_Player_Rank_Map[Player]):
#Player already has a Custom_Player_Rank_UI so do nothing
Print("Player Already Exists")
else:
Print("Player Joined")
# Initialize the Player Stats
PlayerStatsManager.InitializePlayer(Player)
#Get the Current Player Stats
if(Player.IsActive[], CurrentPlayerStats := PlayerStatsManager.GetPlayerStats[Player]):
# Subscribe to the Eliminated Event
if. FC := Player.GetFortCharacter[] then. FC.EliminatedEvent().Subscribe(OnEliminated)
#Create a new Custom_Player_Rank_UI for the Player
CustomPlayer := Custom_Player_Rank{Player := Player}
# Assign the CustomPlayer to the Player
option. set Custom_Player_Rank_Map[Player] = CustomPlayer
# Set the Elo Value of the CustomPlayer to the Elo Value stored in previous games
set CustomPlayer.Elo = CurrentPlayerStats.Elo.CurrentValue
# Get the Current Rank of the Player
set CustomPlayer.CurrentRank = DetermineRank(CurrentPlayerStats.Elo.CurrentValue)
# Add the UI to the Player
CustomPlayer.AddUiToPlayer()
UpdateLeaderboard()
# Update the UI of the Player
InitUi(Player)
CustomPlayer.BackgroundWidget.SetVisibility(widget_visibility.Hidden)
initializeAllPowerUp()
#Clean up Data from leaving player to free up memory
OnPlayerLeft(PlayerLeaving : agent):void=
var NewMap : [player]Custom_Player_Rank = map{}
if(Player := player[PlayerLeaving]):
for(Key -> Value : Custom_Player_Rank_Map, Key <> Player):
set NewMap = ConcatenateMaps(NewMap, map{Key => Value})
set Custom_Player_Rank_Map = NewMap
Print("Player Removed")
UpdateLeaderboard()
# Function to Create a Custom_Player_Rank_UI for all players in the game
InitPlayers():void=
PlayerStatsManager.InitializeAllPlayers(GetPlayspace().GetPlayers())
for(Player: GetPlayspace().GetPlayers()):
OnPlayerJoined(Player)
# Initialize the Values from the external editables
InitValues():void=
if(RankGoals := Rank_Difficulty.Ranks?):
set EloDenominators = array{RankGoals.Value1.RankEloGoal, RankGoals.Value2.RankEloGoal, RankGoals.Value3.RankEloGoal, RankGoals.Value4.RankEloGoal, RankGoals.Value5.RankEloGoal, RankGoals.Value6.RankEloGoal, RankGoals.Value7.RankEloGoal, RankGoals.Value8.RankEloGoal, RankGoals.Value9.RankEloGoal, RankGoals.Value10.RankEloGoal, RankGoals.Value11.RankEloGoal, RankGoals.Value12.RankEloGoal, RankGoals.Value13.RankEloGoal, RankGoals.Value14.RankEloGoal, RankGoals.Value15.RankEloGoal, RankGoals.Value16.RankEloGoal, RankGoals.Value17.RankEloGoal, RankGoals.Value18.RankEloGoal, RankGoals.Value19.RankEloGoal}
set RankNamesArray = array{ RankGoals.Value1.RankName, RankGoals.Value2.RankName, RankGoals.Value3.RankName, RankGoals.Value4.RankName, RankGoals.Value5.RankName, RankGoals.Value6.RankName, RankGoals.Value7.RankName, RankGoals.Value8.RankName, RankGoals.Value9.RankName, RankGoals.Value10.RankName, RankGoals.Value11.RankName, RankGoals.Value12.RankName, RankGoals.Value13.RankName, RankGoals.Value14.RankName, RankGoals.Value15.RankName, RankGoals.Value16.RankName, RankGoals.Value17.RankName, RankGoals.Value18.RankName, RankGoals.Value19.RankName}
set RankColors = array{RankGoals.Value1.RankThemeColor, RankGoals.Value2.RankThemeColor, RankGoals.Value3.RankThemeColor, RankGoals.Value4.RankThemeColor, RankGoals.Value5.RankThemeColor, RankGoals.Value6.RankThemeColor, RankGoals.Value7.RankThemeColor, RankGoals.Value8.RankThemeColor, RankGoals.Value9.RankThemeColor, RankGoals.Value10.RankThemeColor, RankGoals.Value11.RankThemeColor, RankGoals.Value12.RankThemeColor, RankGoals.Value13.RankThemeColor, RankGoals.Value14.RankThemeColor, RankGoals.Value15.RankThemeColor, RankGoals.Value16.RankThemeColor, RankGoals.Value17.RankThemeColor, RankGoals.Value18.RankThemeColor, RankGoals.Value19.RankThemeColor}
############## HELPER FUNCTIONS ####################
# Helper Function to Determine Progress Bar Width
CaculateProgressBarWidthForRank(EloRank:int, total_width:float, numerator:int, denominator:int):float=
# Ensure the current rank is within the bounds of the array
if (EloRank < 0 or EloRank >= EloDenominators.Length):
return 0.0 # Return 0 width if the rank is invalid
# Calculate the progress within the current rank
previous_threshold : int = if. Temp := EloDenominators[EloRank - 1] then. Temp else. 0
RealNumerator := (numerator - previous_threshold) * 1.0
RealDenominator := (denominator - previous_threshold) * 1.0
progress_within_rank := ( RealNumerator / RealDenominator)
# Calculate the width of the progress bar
width_image1 :=total_width * progress_within_rank
# Print("Width: {width_image1}")
# Print("{numerator} / {denominator}")
return width_image1
#Helper function to perform binary search
DetermineRank(Elo:int):int=
RankIndex :=BinarySearch(EloDenominators, Elo, 0, EloDenominators.Length-1)
if(RankIndex = EloDenominators.Length ):
return EloDenominators.Length -1
else:
return RankIndex
BinarySearch(arr: []int, target: int, left: int, right: int):int=
if (left > right) {
return left
}
var Mid:int=0
if(mid : int = Floor((left + right) / 2)):
set Mid = mid
if (target < arr[Mid]):
return BinarySearch(arr, target, left, Mid - 1)
else:
return BinarySearch(arr, target, Mid + 1, right)
RoundFloat(Value:float, DecimalPlaces:int):float =
Multiplier := Pow(10.0, DecimalPlaces * 1.0)
var RoundedValues : float = 0.0
if(RoundedValuess := Round[Value * Multiplier] * 1.0):
set RoundedValues = RoundedValuess
return RoundedValues / Multiplier
FloorFloat2Decimals(Value:float):string=
floatString := ToString(Value)
var stringToReturn:string=""
for(Char:floatString):
if(stringToReturn.Length < 4):
set stringToReturn += "{Char}"
return stringToReturn
# Helper Function to Convert a Numerator and Denominator to a Percentage
ConvertToPercentage(numerator: int, denominator: int,EloRank:int): string =
previous_threshold : int = if. Temp := EloDenominators[EloRank - 1] then. Temp else. 0
RealNumerator := (numerator - previous_threshold) * 1.0
RealDenominator := (denominator - previous_threshold) * 1.0
decimal_value := (RealNumerator * 1.0) / (RealDenominator * 1.0)
percentage := decimal_value * 100.0
return "{RemoveExtraNumbers(percentage)}%"
# Helper Function to Get the First Five Characters of a String
RemoveExtraNumbers(input_float: float): string =
input_string := "{input_float}"
if(input_float < 10.0):
return if. First2 := input_string.Slice[0, 1] then. First2 else. input_string
else:
return if. First5 := input_string.Slice[0, 2] then. First5 else. input_string
UpdateStatsBillboard(Agent:agent):void=
if:
# Get the current stats of the given agent.
Player := player[Agent]
Player.IsActive[]
CurrentPlayerStats := PlayerStatsManager.GetPlayerStats[Player]
then:
Display_Stats.StatsBillboard.SetText(
StatsMessage(
Kills:=CurrentPlayerStats.Kills.CurrentValue,
Deaths:=CurrentPlayerStats.Deaths.CurrentValue,
Elo := CurrentPlayerStats.Elo.CurrentValue,
KD:= FloorFloat2Decimals((CurrentPlayerStats.Kills.CurrentValue *1.0) / (CurrentPlayerStats.Deaths.CurrentValue*1.0))
)
)
if(PlayerObj := player[Agent], CustomPlayer := Custom_Player_Rank_Map[PlayerObj]):
CurrentRank :=CustomPlayer.CurrentRank
if(CurrentMat:= MaterialsRank[CurrentRank]):
Display_Stats.DisplayRankProp.SetMaterial(CurrentMat)
Display_Stats.PlayerReference.Register(Agent)
UpdateStatsBillboard2(Agent:agent):void=
if:
# Get the current stats of the given agent.
Player := player[Agent]
Player.IsActive[]
CurrentPlayerStats := PlayerStatsManager.GetPlayerStats[Player]
then:
Display_Stats.StatsBillboard2.SetText(
StatsMessage(
Kills:=CurrentPlayerStats.Kills.CurrentValue,
Deaths:=CurrentPlayerStats.Deaths.CurrentValue,
Elo := CurrentPlayerStats.Elo.CurrentValue,
KD:= FloorFloat2Decimals((CurrentPlayerStats.Kills.CurrentValue *1.0) / (CurrentPlayerStats.Deaths.CurrentValue*1.0))
)
)
if(PlayerObj := player[Agent], CustomPlayer := Custom_Player_Rank_Map[PlayerObj]):
CurrentRank :=CustomPlayer.CurrentRank
if(CurrentMat:= MaterialsRank[CurrentRank]):
Display_Stats.DisplayRankProp.SetMaterial(CurrentMat)
Display_Stats.PlayerReference.Register(Agent)
InsertionSort(Array: []Custom_Player_Rank): []Custom_Player_Rank =
var Arr : []Custom_Player_Rank = Array
for (i := 1..Array.Length - 1):
if( key := Arr[i]):
var j :int= i - 1
loop:
if(j >= 0 and Arr[j].Elo < key.Elo):
if. Temp:= Arr[j] then. if. set Arr[j + 1] = Temp
set j -= 1
else:
break
if. set Arr[j + 1] = key
return Arr
################# CUSTOM PLAYER CLASS ####################
This class is used to store the player’s UI and data
Custom_Player_Rank:=class:
S2M(value:string) : message = “{value}”
ATM(value:agent) : message = “{value}”
StringToMessage(value:string) : message = "{value} "
Player:agent
barThickness : float = 27.5
ProgressBarSize : float = 325.0
# Player Data
var CurrentRank:int = 0
var Elo:int = 0
var Kills:int = 0
var Deaths:int = 0
var VfxEnabled : logic = true
#UI Elements for Stat Widget
var StatTextureBlock : texture_block = texture_block{DefaultImage := RankImages3.Bronze_Rank_1, DefaultDesiredSize := vector2{X:= 65.0,Y:=65.0}}
var PlayerNameRank : text_block = text_block{DefaultTextColor:=color{R:=1.0,G:=1.0,B:=1.0},DefaultShadowOffset:= option. vector2{X:= 3.697608,Y:= 2.513883}, DefaultShadowColor:= color{R:= 0.0,G:= 0.0,B:= 0.0},DefaultShadowOpacity:=1.0}
var PlayerStats : text_block = text_block{DefaultTextColor:=color{R:=1.0,G:=1.0,B:=1.0},DefaultShadowOffset:= option. vector2{X:= 3.697608,Y:= 2.513883}, DefaultShadowColor:= color{R:= 0.0,G:= 0.0,B:= 0.0},DefaultShadowOpacity:=1.0}
var PromotedTextBlock : text_block = text_block{}
var EloUpdatesTextBlock : text_block = text_block{}
var EloProgress : text_block = text_block{DefaultTextColor:=color{R:=1.0,G:=1.0,B:=1.0},DefaultShadowOffset:= option. vector2{X:= 1.697608,Y:= 1.513883},DefaultShadowColor:= color{R:= 0.0,G:= 0.0,B:= 0.0},DefaultShadowOpacity:=1.0}
#progress bar
var BackGradientTexture : texture_block = texture_block{ DefaultImage := RankImages3.reflectgradient ,DefaultDesiredSize:= vector2{X:= 335.0,Y:=34.0},DefaultTint:=color{R:=0.015625,G:=0.015625,B:=0.015625}}
var GradientProgressBar : texture_block = texture_block{ DefaultImage := RankImages3.gradientleftright ,DefaultDesiredSize:= vector2{Y:=27.5},DefaultTint:=color{R:=1.0,G:=1.0,B:=1.0}}
var MainColorBlock : color_block = color_block{ DefaultColor:= color{R:=0.254585,G:=0.260740,B:=0.893361},DefaultDesiredSize:= vector2{X:= 0.0,Y:=27.5},DefaultOpacity:=0.634026}
var RankImage :texture_block =texture_block{ DefaultImage := RankImages3.Bronze_Rank_1 ,DefaultDesiredSize:= vector2{X:= 80.0,Y:=80.0}}
var RankTextBlock : text_block = text_block{DefaultTextColor:=color{R:=1.0,G:=1.0,B:=1.0},DefaultShadowOffset:= option. vector2{X:= 3.697608,Y:= 2.513883}, DefaultShadowColor:= color{R:= 0.0,G:= 0.0,B:= 0.0},DefaultShadowOpacity:=1.0}
UI Elements for the Leaderboard
var Top5textureBlocks : texture_block = array{}
var Top5BackgroundBoxs: texture_block = array{}
var Top5Names : text_block = array{}
var Top5Elos : text_block = array{}
InitVars():void=
for(i := 0..4):
set Top5textureBlocks += array{texture_block{DefaultImage := RankImages3.Bronze_Rank_1, DefaultDesiredSize := vector2{X:= 40.0,Y:=40.0}}}
set Top5BackgroundBoxs += array{texture_block{DefaultImage := RankImages3.Box, DefaultDesiredSize := vector2{X:= 375.0,Y:=45.0}}}
set Top5Names += array{text_block{DefaultTextColor:=color{R:=1.0,G:=1.0,B:=1.0} }}
set Top5Elos += array{text_block{DefaultTextColor:=color{R:=1.0,G:=1.0,B:=1.0} }}
UpdateLeaderboard(Topk: []Custom_Player_Rank):void=
var PlayerInTop5 : logic = false
for(i := 0..4):
if(i < Topk.Length):
if(Widget := Top5textureBlocks[i],CurrentImage:=RankIconsArray[Topk[i].CurrentRank] )then. Widget.SetImage(CurrentImage)
if(Widget := Top5Names[i],CurrentName:=Topk[i].Player) then. Widget.SetText(ATM(CurrentName))
if(Widget := Top5Elos[i],CurrentElo:=Topk[i].Elo) then. Widget.SetText(S2M("{CurrentElo}"))
if(Widget := Top5BackgroundBoxs[i]):
if(PlayerObj:=Topk[i].Player):
if(not PlayerObj = Player):
Widget.SetImage(RankImages3.box2)
else:
set PlayerInTop5 = true
Widget.SetImage(RankImages3.Box)
else:
if(Widget := Top5textureBlocks[i]) then. Widget.SetImage(RankImages3.EmptyBox)
if(Widget := Top5Names[i]) then. Widget.SetText(S2M(""))
if(Widget := Top5Elos[i]) then. Widget.SetText(S2M(""))
if(Widget := Top5BackgroundBoxs[i]) then. Widget.SetImage(RankImages3.EmptyBox)
if(PlayerInTop5 = false):
if(Widget := Top5BackgroundBoxs[4]) then. (Widget.SetImage(RankImages3.Box))
if(Widget := Top5textureBlocks[4],CurrentImage:=RankIconsArray[CurrentRank]) then. Widget.SetImage(CurrentImage)
if(Widget := Top5Names[4]) then. Widget.SetText(ATM(Player))
if(Widget := Top5Elos[4]) then. Widget.SetText(S2M("{Elo}"))
# Adds the UI to the player
AddUiToPlayer():void=
if(PlayerUI := GetPlayerUI[player[Player]]):
Canvas := CreateCanvas()
InitVars()
PlayerUI.AddWidget(Canvas)
PlayerUI.AddWidget(LeaderboardCanvas())
CreateCanvas():canvas=
Overlay := overlay:
Slots:=array:
overlay_slot:
Widget:=GradientProgressBar
HorizontalAlignment:=horizontal_alignment.Fill
VerticalAlignment:=vertical_alignment.Fill
overlay_slot:
Widget:=MainColorBlock
HorizontalAlignment:=horizontal_alignment.Left
VerticalAlignment:=vertical_alignment.Center
ProgressBar := overlay:
Slots:=array:
overlay_slot:
Widget:=BackGradientTexture
HorizontalAlignment:=horizontal_alignment.Left
VerticalAlignment:=vertical_alignment.Center
overlay_slot:
Widget:=Overlay
HorizontalAlignment:=horizontal_alignment.Left
VerticalAlignment:=vertical_alignment.Center
Padding:=margin{Left:=4.0}
overlay_slot:
Widget:= EloProgress
HorizontalAlignment:=horizontal_alignment.Center
VerticalAlignment:=vertical_alignment.Center
RankUpOverlay := overlay:
Slots:=array:
overlay_slot:
Widget:=PromotedTextBlock
HorizontalAlignment:=horizontal_alignment.Right
VerticalAlignment:=vertical_alignment.Fill
overlay_slot:
Widget:= RankTextBlock
HorizontalAlignment:=horizontal_alignment.Left
VerticalAlignment:=vertical_alignment.Fill
GrandChildStackBox := stack_box:
Orientation := orientation.Horizontal
Slots := array:
stack_box_slot:
Widget:=RankUpOverlay
HorizontalAlignment:=horizontal_alignment.Fill
VerticalAlignment:=vertical_alignment.Fill
Distribution := option. 1.0
ChildStackBox := stack_box:
Orientation := orientation.Vertical
Slots := array:
stack_box_slot:
Widget:=GrandChildStackBox
HorizontalAlignment:=horizontal_alignment.Fill
VerticalAlignment:=vertical_alignment.Fill
stack_box_slot:
Widget:=ProgressBar
HorizontalAlignment:=horizontal_alignment.Fill
VerticalAlignment:=vertical_alignment.Fill
MainStackBox:=stack_box:
Orientation := orientation.Horizontal
Slots := array:
stack_box_slot:
Widget:=RankImage
HorizontalAlignment:=horizontal_alignment.Center
VerticalAlignment:=vertical_alignment.Bottom
stack_box_slot:
Widget:=ChildStackBox
HorizontalAlignment:=horizontal_alignment.Fill
VerticalAlignment:=vertical_alignment.Fill
Padding:=margin{Left:=10.0}
stack_box_slot:
Widget:=EloUpdatesTextBlock
HorizontalAlignment:=horizontal_alignment.Fill
VerticalAlignment:=vertical_alignment.Bottom
var MyCanvas : canvas = canvas:
Slots := array:
canvas_slot:
Widget := MainStackBox
Anchors:=anchors{Minimum:=vector2{X:=0.0,Y:=1.0},Maximum:=vector2{X:=0.0,Y:=1.0}}
Offsets := margin{Left := 31.0,Top:= -250.0}
SizeToContent:=true
canvas_slot:
Widget := BackgroundWidget
Anchors := anchors{Minimum := vector2{X := 0.5, Y := 0.5}, Maximum := vector2{X := 0.5, Y := 0.5}}
Offsets := margin{Left := -250.0,Top:= -250.0}
return MyCanvas
BackgroundWidget : texture_block = texture_block{DefaultImage := BackgroundTest, DefaultDesiredSize := vector2{X := 500.0, Y := 500.0}}
StatWidget():canvas=
ChildStackBox := stack_box:
Orientation := orientation.Horizontal
Slots:=array:
stack_box_slot:
Widget := StatTextureBlock
HorizontalAlignment:=horizontal_alignment.Center
VerticalAlignment:=vertical_alignment.Fill
stack_box_slot:
Widget := PlayerNameRank
HorizontalAlignment:=horizontal_alignment.Center
VerticalAlignment:=vertical_alignment.Center
Padding := margin{Left := 5.0}
MainStackBox : stack_box = stack_box:
Orientation := orientation.Vertical
Slots:=array:
stack_box_slot:
Widget := text_block{DefaultText := S2M(“ELIMINATED BY”),DefaultTextColor:=color{R:=1.0,G:=0.007021,B:=0.0}}
HorizontalAlignment:=horizontal_alignment.Center
VerticalAlignment:=vertical_alignment.Fill
stack_box_slot:
Widget := ChildStackBox
HorizontalAlignment:=horizontal_alignment.Left
VerticalAlignment:=vertical_alignment.Bottom
Padding := margin{Top := 10.0, Bottom := 10.0}
stack_box_slot:
Widget := PlayerStats
HorizontalAlignment:=horizontal_alignment.Center
VerticalAlignment:=vertical_alignment.Center
var Canvas : canvas = canvas:
Slots:=array:
canvas_slot:
Widget := MainStackBox
Anchors := anchors{Minimum := vector2{X := 0.5, Y := 0.5}, Maximum := vector2{X:= 0.5, Y := 0.5}}
Alignment := vector2{X := 0.5, Y := 0.5}
SizeToContent := true
Creates a canvas for a player to display the UI
LeaderboardSlot(Current:int):overlay=
if:
textureBlock := Top5textureBlocks[Current]
BackgroundBox := Top5BackgroundBoxs[Current]
Nametext := Top5Names[Current]
EloText := Top5Elos[Current]
then:
StackBox:= stack_box:
Orientation := orientation.Horizontal
Slots:=array:
stack_box_slot:
Widget := textureBlock
HorizontalAlignment:=horizontal_alignment.Left
VerticalAlignment:=vertical_alignment.Center
Padding:= margin{Left := 6.0, Top := 4.0, Right := 4.0, Bottom := 4.0}
stack_box_slot:
Widget := Nametext
HorizontalAlignment:=horizontal_alignment.Left
VerticalAlignment:=vertical_alignment.Center
Distribution := option. 1.0
Padding:= margin{Left := 20.0, Top := 3.0, Right := 20.0, Bottom := 3.0}
stack_box_slot:
Widget := EloText
HorizontalAlignment:=horizontal_alignment.Right
VerticalAlignment:=vertical_alignment.Center
Padding:= margin{Left := 3.0, Top := 3.0, Right := 3.0, Bottom := 3.0}
var Overlay : overlay = overlay:
Slots:=array:
overlay_slot:
Widget := BackgroundBox
VerticalAlignment:=vertical_alignment.Fill
HorizontalAlignment:=horizontal_alignment.Fill
overlay_slot:
Widget := StackBox
VerticalAlignment:=vertical_alignment.Fill
HorizontalAlignment:=horizontal_alignment.Fill
else:
return overlay{}
LeaderboardCanvas():canvas=
StackBox := stack_box:
Orientation := orientation.Vertical
Slots:=array:
stack_box_slot:
Widget := LeaderboardSlot(0)
HorizontalAlignment:=horizontal_alignment.Fill
VerticalAlignment:=vertical_alignment.Fill
stack_box_slot:
Widget := LeaderboardSlot(1)
HorizontalAlignment:=horizontal_alignment.Fill
VerticalAlignment:=vertical_alignment.Fill
stack_box_slot:
Widget := LeaderboardSlot(2)
HorizontalAlignment:=horizontal_alignment.Fill
VerticalAlignment:=vertical_alignment.Fill
stack_box_slot:
Widget := LeaderboardSlot(3)
HorizontalAlignment:=horizontal_alignment.Fill
VerticalAlignment:=vertical_alignment.Fill
stack_box_slot:
Widget := LeaderboardSlot(4)
HorizontalAlignment:=horizontal_alignment.Fill
VerticalAlignment:=vertical_alignment.Fill
var Canvas : canvas = canvas:
Slots:=array:
canvas_slot:
Widget := StackBox
Anchors := anchors{Minimum := vector2{X := 1.0, Y := 0.0}, Maximum := vector2{X:= 1.0, Y := 0.0}}
Alignment := vector2{X := 1.03, Y := -0.23}
Offsets := margin{Left := 0.0,Top:= 70.0}
SizeToContent := true
return Canvas
#-----------------Rank Images-----------------
Put your rank images here IN ORDER !!
RankIconsArray : texture = array:
RankImages3.Unranked_Rank
RankImages3.Bronze_Rank_1
RankImages3.Bronze_Rank_2
RankImages3.Bronze_Rank_3
RankImages3.Silver_Rank_1
RankImages3.Silver_Rank_2
RankImages3.Silver_Rank_3
RankImages3.Gold_Rank_1
RankImages3.Gold_Rank_2
RankImages3.Gold_Rank_3
RankImages3.Platinum_Rank_1
RankImages3.Platinum_Rank_2
RankImages3.Platinum_Rank_3
RankImages3.Diamond_Rank_1
RankImages3.Diamond_Rank_2
RankImages3.Diamond_Rank_3
RankImages3.Elite_Rank
RankImages3.Champion_Rank
RankImages3.Unreal_Rank
<# TexturePath #>
#-----------------------------------------
MaterialsRank : material = array:
RankImages3.Unranked_Rank_Mat
RankImages3.Bronze_Rank_1_Mat
RankImages3.Bronze_Rank_2_Mat
RankImages3.Bronze_Rank_3_Mat
RankImages3.Silver_Rank_1_Mat
RankImages3.Silver_Rank_2_Mat
RankImages3.Silver_Rank_3_Mat
RankImages3.Gold_Rank_1_Mat
RankImages3.Gold_Rank_2_Mat
RankImages3.Gold_Rank_3_Mat
RankImages3.Platinum_Rank_1_Mat
RankImages3.Platinum_Rank_2_Mat
RankImages3.Platinum_Rank_3_Mat
RankImages3.Diamond_Rank_1_Mat
RankImages3.Diamond_Rank_2_Mat
RankImages3.Diamond_Rank_3_Mat
RankImages3.Elite_Rank_Mat
RankImages3.Champion_Rank_Mat
RankImages3.Unreal_Rank_Mat
<# MaterialPath #>