Verse Library verse

12 Wait For Some Amount Of Time Then Award Each Playe

Spawns player tasks that update scores and signal a completion event for synchronization.

extracted-snippets/documentation/en-us/fortnite/debugging-and-troubleshooting-in-verse/12-wait-for-some-amount-of-time-then-award-each-playe.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/debugging-and-troubleshooting-in-verse
# Local doc:  epic-docs/documentation/en-us/fortnite/debugging-and-troubleshooting-in-verse.md
# Section:    Wait for some amount of time, then award each player whose HP is above the threshold some score.
# Custom event to signal when the countdown finishes.
CountdownCompleteEvent:event() = event(){}
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
AllPlayers := GetPlayspace().GetPlayers()
# Spawn a CountdownScore function for each player
for:
Player:AllPlayers
do:
spawn{CountdownScore(Player)}
# Wait for the CountdownCompletedEvent to be signaled.
CountdownCompleteEvent.Await()
# If the player has any score, print it to the log.
for:
Player:AllPlayers
CurrentScore := ScoreManager.GetCurrentScore(Player)
CurrentScore > 0
do:
Print("This Player has score!")
CountdownScore(Player:agent)<suspends>:void=
# Wait for some amount of time, then award each player whose HP is above the threshold some score.
Sleep(CountdownTime)
if:
Character := Player.GetFortCharacter[]
PlayerHP := Character.GetHealth()
PlayerHP >= HPThreshold
then:

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