Verse Library verse

26 Player Stats Example Verse

Defines the main creative device class, sets up editable properties, and binds button events.

extracted-snippets/documentation/en-us/uefn/persistent-player-statistics-in-unreal-editor-for-fortnite/26-player-stats-example-verse.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/uefn/persistent-player-statistics-in-unreal-editor-for-fortnite
# Local doc:  epic-docs/documentation/en-us/uefn/persistent-player-statistics-in-unreal-editor-for-fortnite.md
# Section:    player\_stats\_example.verse
using { /Fortnite.com/Devices }
using { /Fortnite.com/Game }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# A Verse-authored creative device that can be placed in a level
player_stats_example := class(creative_device):
# Adds to the activating player's score.
@editable
ScorePointsButton:button_device = button_device{}
# Displays the player's Score, High Score, Wins, and Losses
@editable
StatsBillboard:billboard_device = billboard_device{}
# Resets the player's score and award them a win or a loss
# depending if their current score is greater than WinScore.
@editable
CheckWinButton:button_device = button_device{}
# The score players need to reach to be awarded a win after
# the CheckWinButton is activated.
@editable
WinScore:int = 10
# The amount of score to award per button press.
@editable
AwardScore:int = 1
# Manages and updates stats for each player.
PlayerStatsManager:player_stats_manager = player_stats_manager{}
# Displays a player's stats on a billboard.
StatsMessage<localizes>(Player:agent, Score:int, Wins:int, Losses:int):message = "{Player}, Stats:\n  Score: {Score}\n Wins: {Wins}\n  Losses: {Losses}"

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.

Sign in with Discord

Comments

    Sign in to vote, comment, or suggest an edit. Sign in