# Source URL: https://dev.epicgames.com/community/snippets/Oxo/fortnite-gun-game-script
# Local doc: epic-docs/community/snippets/Oxo/fortnite-gun-game-script.md
using { /Fortnite.com/Characters }
using { /Fortnite.com/Devices }
using { /Fortnite.com/Game }
using { /Fortnite.com/Playspaces }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
basic_gun_game_device := class(creative_device):
@editable
IGD_WeaponList:item_granter_device = item_granter_device{}
@editable
EGD_Win:end_game_device = end_game_device{}
var PlayerElims:[player]int = map{}
var ElimsToWin:int = 0
OnBegin<override>()<suspends>:void=
Setup()
Setup()<suspends>:void=
set ElimsToWin = GetWeaponListLength()
GetPlayspace().PlayerAddedEvent().Subscribe(TrackElims)
for (Player : GetPlayspace().GetPlayers()) do TrackElims(Player)
TrackElims(Player:player):void=
IGD_WeaponList.GrantItemIndex(Player, 0)
if (FortCharacter:fort_character = Player.GetFortCharacter[]):
FortCharacter.EliminatedEvent().Subscribe(OnCharacterEliminated)
OnCharacterEliminated(Result:elimination_result):void=
EliminatedCharacter:fort_character = Result.EliminatedCharacter
MaybeEliminatingCharacter:?fort_character = Result.EliminatingCharacter
if:
EliminatingCharacter:fort_character = MaybeEliminatingCharacter?
Verse Library
verse
01 Snippet
Tracks player eliminations to progress weapons in a Gun Game mode, ending the match when wins are reached.
extracted-snippets/community/snippets/Oxo/fortnite-gun-game-script/01-snippet.verse
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.