# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/verse-elimination-template-in-unreal-editor-for-fortnite
# Local doc: epic-docs/documentation/en-us/fortnite/verse-elimination-template-in-unreal-editor-for-fortnite.md
# Section: Grant the first weapon to each player
# Check if there is a winner for the game, if not then grant the next weapon
GrantNextWeapon(Agent:agent):void=
if (var CurrentItemNumber:int = AgentMap[Agent]):
if (IsVictoryConditionMet(CurrentItemNumber) = true):
EndGame(Agent) # Game has been won
else: # Game is not over yet
set CurrentItemNumber = CurrentItemNumber + 1
if (ItemGranter := WeaponItemGranters[CurrentItemNumber - 1]):
ItemGranter.GrantItem(Agent)
if (set AgentMap[Agent] = CurrentItemNumber) {}
Verse Library
verse
04 Grant The First Weapon To Each Player
Manages sequential weapon granting and victory conditions for an elimination-style game mode loop.
extracted-snippets/documentation/en-us/fortnite/verse-elimination-template-in-unreal-editor-for-fortnite/04-grant-the-first-weapon-to-each-player.verse