VerseIsland
Feed Learn Leaderboard Guides Reference Explore Search Docs Verse Library
Sign in
Feed Learn 📖 Codex Leaderboard Guides Reference Explore Search Docs Verse Library
Fortnite › Player · Up to Fortnite · Player · 25 of 142 in Player
Browse Fortnite

Team Elimination Final Script

Complete Script

The following code is the complete script for an elimination game that advances players through a series of weapons as a team.

|  |  |
| --- | --- |
|  | using { /Fortnite.com/Characters } |
|  | using { /Fortnite.com/Devices } |
|  | using { /Fortnite.com/Game } |
|  | using { /Fortnite.com/Teams } |
|  | using { /Verse.org/Simulation } |
|  |  |
|  |  |
|  | player_map := [player]int # This is a type alias! |
|  |  |
|  | team_elimination_game := class(creative_device): |
|  |  |
|  | @editable |
|  | EndGameDevice : end_game_device = end_game_device{} |
|  |  |
|  | @editable |
|  | var WeaponGranters : []item_granter_device = array{} |
|  |  |
|  | @editable |
|  | var PlayerSpawners : []player_spawner_device = array{} |
|  |  |
|  | @editable |
|  | var Sentries : []sentry_device = array{} |
|  |  |
|  | var EliminationsToEndGame : int = 0 |
|  |  |
|  | var Teams : []team = array{} |
|  |  |
|  | # Map of Team Maps, where the key is the team and the value is a map of |
|  | # player->int key-value pairs |
|  | var TeamMap : [team]player_map = map{} |
|  |  |
|  | OnBegin<override>()<suspends> : void = |
|  | set Teams = GetPlayspace().GetTeamCollection().GetTeams() |
|  | set EliminationsToEndGame = WeaponGranters.Length |
|  | Print("Beginning to assign players") |
|  |  |
|  | PopulateTeamsAndPlayers() |
|  |  |
|  | for (Spawner : PlayerSpawners): |
|  | Spawner.SpawnedEvent.Subscribe(OnPlayerSpawn) # Subscribe to each player spawn pad |
|  |  |
|  | for (Sentry : Sentries): |
|  | Sentry.EliminatedEvent.Subscribe(TestPlayerEliminated) # Subscribe to each Sentry |
|  |  |
|  | # Subscribe to new players joining the game |
|  |  |
|  | GetPlayspace().PlayerAddedEvent().Subscribe(OnPlayerAdded) |
|  |  |
|  | PopulateTeamsAndPlayers() : void = |
|  | Print("Beginning to populate players") |
|  | for (Team : Teams, TeamPlayers := GetPlayspace().GetTeamCollection().GetAgents[Team]): |
|  | var PlayerMap : player_map = map {} |
|  | for (Agent : TeamPlayers, TeamPlayer := player[Agent], FortCharacter := Agent.GetFortCharacter[]): |
|  | if(set PlayerMap[TeamPlayer] = 0, WeaponTier := PlayerMap[TeamPlayer]): |
|  | Print("Assigned Player to PlayerMap with Tier {WeaponTier}") |
|  | FortCharacter.EliminatedEvent().Subscribe(OnPlayerEliminated) |
|  | if(set TeamMap[Team] = PlayerMap): |
|  | Print("Successfully set this team in the TeamMap") |
|  |  |
|  | # Handles a new player joining the game |
|  |  |
|  | OnPlayerAdded(InPlayer : player) : void = |
|  | Print("A New Player Joined!") |
|  | if: |
|  | Team := GetPlayspace().GetTeamCollection().GetTeam[InPlayer] |
|  | FortCharacter := InPlayer.GetFortCharacter[] |
|  | var PlayerMap : player_map = TeamMap[Team] |
|  | set PlayerMap[InPlayer] = 0 |
|  | set TeamMap[Team] = PlayerMap |
|  | then: |
|  | GrantWeapon(option{InPlayer}, 0) |
|  | Print("Set new player weapon tier to 0 in the TeamMap") |
|  | FortCharacter.EliminatedEvent().Subscribe(OnPlayerEliminated) # subscribe to this player's elimination event |
|  |  |
|  | # Grants players weapons based on their WeaponTier when they spawn |
|  |  |
|  | OnPlayerSpawn(InPlayer : agent) : void = |
|  | Print("A player just spawned!") |
|  | if: |
|  | PlayerTeam := GetPlayspace().GetTeamCollection().GetTeam[InPlayer] |
|  | WeaponTier:int := TeamMap[PlayerTeam][InPlayer] |
|  | then: |
|  | GrantWeapon(option{InPlayer}, WeaponTier) |
|  | Print("Spawned Player was granted a gun of tier {WeaponTier}") |
|  |  |
|  | OnPlayerEliminated(Result : elimination_result) : void = |
|  | Print("A Player was eliminated!") |
|  | Eliminator := Result.EliminatingCharacter |
|  | if (FortCharacter := Eliminator?, EliminatorAgent := FortCharacter.GetAgent[]): |
|  | GiveNextWeapon(EliminatorAgent) |
|  |  |
|  | # Allows testing of GiveNextWeapon by spoofing Sentries as Players |
|  |  |
|  | TestPlayerEliminated(Agent: ?agent) : void = |
|  | Print("Sentry Down!") |
|  | if(TeamPlayer := Agent?): |
|  | GiveNextWeapon(TeamPlayer) |
|  |  |
|  | GiveNextWeapon(EliminatingPlayer : agent) : void = |
|  | Print("Finding a player to promote") |
|  | var WeaponTier : int = 0 |
|  | var MaybePlayerToGrant : ?agent = option{EliminatingPlayer} # The player to grant a gun to |
|  | var MaybePlayerTeam : ?team = option{GetPlayspace().GetTeamCollection().GetTeam[EliminatingPlayer]} # The team this player is on |
|  |  |
|  | if(PlayerTeam := MaybePlayerTeam?, set WeaponTier = TeamMap[PlayerTeam][EliminatingPlayer]): |
|  | for(Teammate -> TeammateTier : TeamMap[PlayerTeam], TeammateTier < WeaponTier): |
|  | Print("Found a Teammate with a lower Tier at Tier {TeammateTier}") |
|  | if(set WeaponTier = TeamMap[PlayerTeam][Teammate]): |
|  | set MaybePlayerToGrant = option{Teammate} |
|  |  |
|  | set WeaponTier = WeaponTier + 1 |
|  | if(PlayerTeam := MaybePlayerTeam?, PlayerToGrant := player[MaybePlayerToGrant?], set TeamMap[PlayerTeam][PlayerToGrant] = WeaponTier): |
|  | Print("Eliminating Player Tier is now {WeaponTier}") |
|  |  |
|  | if(WeaponTier >= EliminationsToEndGame): |
|  | EndGame(EliminatingPlayer) |
|  |  |
|  | GrantWeapon(MaybePlayerToGrant, WeaponTier) |
|  |  |
|  | GrantWeapon(InPlayer : ?agent, WeaponTier : int) : void = |
|  | Print("Promoting Player to Tier {WeaponTier}") |
|  | if(ItemGranter := WeaponGranters[WeaponTier], GrantedPlayer := InPlayer?): |
|  | ItemGranter.GrantItem(GrantedPlayer) |
|  |  |
|  | EndGame(InPlayer : agent) : void = |
|  | Print("Player reached final Weapon Tier, activating EndGameDevice") |
|  | EndGameDevice.Activate(InPlayer) |

You're reading a preview

The full reference is free for BrainDeadGuild Discord members — sign in to read it all, or open the original at the source.

Sign in with Discord — free for members Read the original at Epic Games

Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.

Comments

    Sign in to vote, comment, or suggest an edit. Sign in
    📄
    Source
    Epic Games

    © Epic Games. Official Epic developer documentation, shown here as a reference with a link to the original. All rights remain with Epic Games. Terms ↗

    View original Sources & licensing
    Request removal
    Last updated May 12, 2026
    Keep exploring
    More in Player · 25 of 142
    Prev
    subclass in verse
    Next
    team elimination 1 setting up the level in verse
    Browse all files in this folder (A–Z)
    Related topics
    • Team Elimination Game In Verse Player
    • Team Elimination Game 8 Final Result In Verse Player
    • Team Elimination 2 Finding Devices At Runtime In Verse Devices
    • Team Elimination Game 2 Finding Devices At Runtime In Verse Devices
    • Elimination Result Verse Language

    Related

    Open in graph →

    Related topics

    • Team Elimination Game In Verse
    • Team Elimination Game 8 Final Result In Verse
    • Team Elimination 2 Finding Devices At Runtime In Verse
    • Team Elimination Game 2 Finding Devices At Runtime In Verse
    • Elimination Result
    VerseIsland · an archipelago of Verse & UEFN knowledge
    🗺️ Island atlas Learn Guides History About & Press Sources & Licensing Status

    Not affiliated with Epic Games. Fortnite, UEFN, Unreal Engine, and Verse are trademarks of Epic Games, Inc. Content is attributed to its source — see Sources & Licensing.

    🦜

    Scout · your island guide

    The Isle of Verse