Verse Library verse

16 Adding Logic Based On Current Round

Starts race logic, tracks player finish order, updates rounds, and logs activity on begin.

extracted-snippets/documentation/en-us/uefn/custom-round-logic-using-verse/16-adding-logic-based-on-current-round.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:    Adding Logic Based on Current Round
# A Verse-authored creative device that can be placed in a level
test_round_info_device := class(creative_device):
# The total number of rounds in the race.
@editable
TotalRounds:type {Rounds:int where 1 <= Rounds} = 3
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
GetPlayspace().PlayerRemovedEvent().Subscribe(OnPlayerRemoved)
Players := GetPlayspace().GetPlayers()
RecordCurrentRound(Players, TotalRounds)
for:
Index -> Player : Players
CurrentRound := GetRound[]
RecordPlayerFinishOrder(Player, Index)
UpdateRound(Player, CurrentRound)
do:
Print("Recorded finish order {Index} and current round {CurrentRound} for player")

Comments

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