# Source URL: https://dev.epicgames.com/documentation/en-us/uefn/make-your-own-in-game-leaderboard-in-verse
# Local doc: epic-docs/documentation/en-us/uefn/make-your-own-in-game-leaderboard-in-verse.md
# Section: Managing Stats
# This file handles the code for initializing, updating, and returning player_stats_tables
# for each player. It also defines an abstract stat_type class to use for updating stats, and the
# StatType module to use when displaying stats.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# Return the player_stats_table for the provided Agent.
GetPlayerStats<public>(Agent:agent)<decides><transacts>:player_stats_table=
var PlayerStats:player_stats_table = player_stats_table{}
if:
Player := player[Agent]
PlayerStatsTable := PlayerStatsMap[Player]
set PlayerStats = MakePlayerStatsTable(PlayerStatsTable)
PlayerStats
# Initialize stats for all current players.
InitializeAllPlayerStats<public>(Players:[]player):void =
for (Player : Players):
InitializePlayerStat(Player)
# Initialize stats for the given player.
InitializePlayerStat<public>(Player:player):void=
if:
not PlayerStatsMap[Player]
set PlayerStatsMap[Player] = player_stats_table{}
else:
Print("Unable to initialize player stats")
# Adds to the given Agent's Points and updates both their stats table
# in PlayerStatsManager and the billboard in the level.
Verse Library
verse
05 Managing Stats
Manages and updates persistent player statistics, points, and wins for a competitive leaderboard.
extracted-snippets/documentation/en-us/uefn/make-your-own-in-game-leaderboard-in-verse/05-managing-stats.verse
Sign in free to read the full source 🌴
This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.