Verse Library verse

11 Reset Round Info On Game End

Finds the highest completed round across active players to synchronize race progression.

extracted-snippets/documentation/en-us/uefn/custom-round-logic-using-verse/11-reset-round-info-on-game-end.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/uefn/custom-round-logic-using-verse
# Local doc:  epic-docs/documentation/en-us/uefn/custom-round-logic-using-verse.md
# Section:    Reset Round Info on Game End
# Returns the highest last completed round among all players.
GetLastCompletedRound<public>(Players:[]player, TotalRounds:int)<transacts>:int=
var LastCompletedRound:int = -1
for:
Player : Players
Player.IsActive[]
PlayerCircuitInfo := CircuitInfo[Player]
do:
# If player's recorded info is greater than the total rounds for whatever reason,
# then need to reset the player's circuit info because they shouldn't have more than what's allowed.
if:
# Total rounds should not be set to 0.
PlayerCircuitInfo.LastCompletedRound >= TotalRounds - 1
then:
# Try to reset the player's circuit info so it's fresh.
if:
ResetCircuitInfo[Player]
else:
Print("Unable to reset circuit info for player")
# Update LastCompletedRound if this player has the highest last completed round.
else if:
PlayerCircuitInfo.LastCompletedRound > LastCompletedRound
then:
set LastCompletedRound = PlayerCircuitInfo.LastCompletedRound
LastCompletedRound

Comments

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