# Source URL: https://dev.epicgames.com/documentation/en-us/uefn/verse-elimination-template-in-unreal-editor-for-fortnite
# Local doc: epic-docs/documentation/en-us/uefn/verse-elimination-template-in-unreal-editor-for-fortnite.md
# Section: Adding the Verse Scripts
OnBegin<override>()<suspends>:void=
# Can use this variable to scale the number of eliminations needed based on how many item granters there are in the experience
set NumberOfEliminationsToWin = WeaponItemGranters.Length
Print("Number of Weapon Item Granters: {WeaponItemGranters.Length}")
# Randomize the order in which the weapons are granted
set WeaponItemGranters = Shuffle(WeaponItemGranters)
# Get all the players in the experience
AllPlayers := GetPlayspace().GetPlayers()
for (EliminationGamePlayer : AllPlayers):
if (FortCharacter := EliminationGamePlayer.GetFortCharacter[]):
FortCharacter.EliminatedEvent().Subscribe(OnPlayerEliminated) # subscribe to eliminated event
# Add Players to a Map to track progress
if (set AgentMap[EliminationGamePlayer] = 1) {}
# Grant the first weapon to each player
if (FirstItemGranter:item_granter_device = WeaponItemGranters[0]):
FirstItemGranter.GrantItem(EliminationGamePlayer)
Copy full snippet
Verse Library
verse
02 Adding The Verse Scripts
Starts the game by subscribing to elimination events, tracking players, and granting starting weapons.
extracted-snippets/documentation/en-us/uefn/verse-elimination-template-in-unreal-editor-for-fortnite/02-adding-the-verse-scripts.verse