# Source URL: https://dev.epicgames.com/documentation/fortnite/verse-start-05-refactor-and-refine-in-fortnite
# Local doc: epic-docs/documentation/fortnite/verse-start-05-refactor-and-refine-in-fortnite.md
# Section: GetFirstPlayer()
# Adjusts the player's score by the provided value.
AdjustScore(Value:int):void=
# Start the timer if it hasn't started yet.
if (not IsTimerStarted?):
StartTimer()
# Sets the score award to the base value of the target multiplied by the current weapon level.
ScoreManager.SetScoreAward(Value * CurrentWeaponLevel)
<# --- New Code Start --- #>
# Gets the first player in the playspace.
if (Player:player = GetFirstPlayer[]):
<# --- New Code End --- #>
# Awards the points to the player.
ScoreManager.Activate(Player)
# If a positive scoring target (Good or Combo) was hit, then...
if (Value > 0):
# Increment the good hit chain counter.
set GoodHitsSinceLastBonus += 1
# Generate a random floating point number between 0 and 1.
RandomValue := GetRandomFloat(0.0, 1.0)
# Determine the percent chance for the bonus target to activate.
TargetNumber := (BonusTimeTargetBaseChance * GoodHitsSinceLastBonus)
# If the random value generated is less than our percent chance, then...
if (RandomValue <= TargetNumber):
# Reset the good hit chain counter.
set GoodHitsSinceLastBonus = 0
# Enable the BonusTimeTarget.
BonusTimeTarget.Enable()
Verse Library
verse
02 Getfirstplayer
Adjusts scores, manages combo chains, and randomly activates bonus targets.
extracted-snippets/documentation/fortnite/verse-start-05-refactor-and-refine-in-fortnite/02-getfirstplayer.verse