VerseIsland
Feed Learn Leaderboard Guides Reference Explore Search Docs Verse Library
Sign in
Feed Learn 📖 Codex Leaderboard Guides Reference Explore Search Docs Verse Library
Verse Library › Devices
Browse Verse Library

Library

Devices 634
  • Devices171
  • Triggers & Logic118
  • UI & HUD40
  • Audio39
  • Items & Inventory29
  • Events27
  • Scoring & Objectives25
  • Spawning19
  • Classes & Interfaces18
  • Game Modes17
  • Props & Meshes14
  • Variables & Mutability12
  • Player Management11
  • Modules & Structure10
  • Round Flow8
  • Animation6
  • Concurrency6
  • Functions6
  • Getting Started6
  • Teams & Classes6
  • NPCs & AI5
  • Tutorials5
  • VFX & Particles5
  • Arrays & Maps4
  • Cameras4
  • Debugging4
  • Control Flow3
  • Cinematics2
  • Other2
  • Persistence2
  • Scene Graph2
  • Structs & Enums2
  • Building1
  • Physics1
  • Publishing & Islands1
  • Syntax & Types1
  • Vehicles1
  • Weapons1
Verse Language 257
  • Control Flow35
  • Functions26
  • Arrays & Maps25
  • Classes & Interfaces22
  • Variables & Mutability22
  • Concurrency21
  • Syntax & Types18
  • Modules & Structure12
  • Debugging8
  • Devices8
  • Events7
  • Player Management6
  • Structs & Enums6
  • Triggers & Logic6
  • Game Modes5
  • Failure & Options4
  • Scene Graph4
  • UI & HUD4
  • Getting Started3
  • Round Flow3
  • Spawning3
  • VFX & Particles3
  • Reference2
  • Animation1
  • Best Practices1
  • Other1
  • Props & Meshes1
Materials/VFX 154
  • Triggers & Logic27
  • UI & HUD17
  • Devices16
  • VFX & Particles14
  • Props & Meshes11
  • Scoring & Objectives9
  • Game Modes7
  • Items & Inventory7
  • Functions6
  • Arrays & Maps5
  • Animation3
  • Cinematics3
  • Classes & Interfaces3
  • Control Flow3
  • Events3
  • Modules & Structure3
  • Round Flow3
  • Spawning3
  • Getting Started2
  • Scene Graph2
  • Variables & Mutability2
  • Concurrency1
  • Persistence1
  • Player Management1
  • Structs & Enums1
  • Syntax & Types1
General 153
  • Devices22
  • Events20
  • Triggers & Logic20
  • Classes & Interfaces10
  • Variables & Mutability8
  • Round Flow6
  • Scoring & Objectives6
  • UI & HUD6
  • Functions5
  • Player Management5
  • Game Modes4
  • Getting Started4
  • Props & Meshes4
  • Control Flow3
  • Syntax & Types3
  • VFX & Particles3
  • Arrays & Maps2
  • Best Practices2
  • NPCs & AI2
  • Other2
  • Physics2
  • Scene Graph2
  • Spawning2
  • Structs & Enums2
  • Tutorials2
  • Building1
  • Cameras1
  • Cinematics1
  • Failure & Options1
  • Items & Inventory1
  • Teams & Classes1
Player 133
  • Player Management22
  • Teams & Classes19
  • Classes & Interfaces12
  • Devices11
  • Events9
  • Persistence7
  • Triggers & Logic7
  • Arrays & Maps6
  • Functions4
  • Game Modes4
  • Items & Inventory4
  • Round Flow4
  • Debugging3
  • Getting Started3
  • Modules & Structure3
  • Concurrency2
  • Control Flow2
  • Scoring & Objectives2
  • Spawning2
  • Structs & Enums2
  • Physics1
  • Props & Meshes1
  • UI & HUD1
  • Variables & Mutability1
  • Weapons1
Building & Props 131
  • Variables & Mutability15
  • Props & Meshes14
  • Triggers & Logic12
  • Classes & Interfaces10
  • Devices10
  • UI & HUD10
  • Events7
  • Teams & Classes7
  • Animation5
  • Building5
  • Functions5
  • VFX & Particles5
  • Structs & Enums4
  • Control Flow3
  • Game Modes3
  • Items & Inventory3
  • Round Flow3
  • Scene Graph3
  • Arrays & Maps2
  • Concurrency2
  • Reference2
  • Modules & Structure1
NPCs & AI 76
  • NPCs & AI35
  • Spawning7
  • Animation5
  • Variables & Mutability5
  • Classes & Interfaces3
  • Debugging3
  • UI & HUD3
  • Audio2
  • Concurrency2
  • Game Modes2
  • Props & Meshes2
  • Triggers & Logic2
  • Devices1
  • Functions1
  • Getting Started1
  • Reference1
  • VFX & Particles1
Spawning 73
  • Spawning31
  • Events7
  • Concurrency6
  • Player Management6
  • Vehicles5
  • Props & Meshes4
  • Devices3
  • Scene Graph3
  • Items & Inventory2
  • Teams & Classes2
  • Control Flow1
  • Publishing & Islands1
  • Reference1
  • Scoring & Objectives1
Cinematics 71
  • Cameras19
  • Cinematics15
  • Devices11
  • Audio5
  • Animation4
  • Triggers & Logic4
  • Functions2
  • Game Modes2
  • UI & HUD2
  • Classes & Interfaces1
  • Concurrency1
  • Control Flow1
  • Items & Inventory1
  • Modules & Structure1
  • Scene Graph1
  • Templates1
UI 57
  • UI & HUD35
  • Devices5
  • Scoring & Objectives4
  • Classes & Interfaces3
  • Round Flow2
  • Scene Graph2
  • Arrays & Maps1
  • Props & Meshes1
  • Structs & Enums1
  • Templates1
  • Triggers & Logic1
  • Variables & Mutability1
Scene Graph 40
  • Scene Graph9
  • Items & Inventory8
  • Classes & Interfaces3
  • Events3
  • Props & Meshes3
  • Functions2
  • Arrays & Maps1
  • Building1
  • Control Flow1
  • Debugging1
  • Modules & Structure1
  • Player Management1
  • Reference1
  • Structs & Enums1
  • Syntax & Types1
  • Triggers & Logic1
  • UI & HUD1
  • VFX & Particles1
Vehicles 38
  • Spawning11
  • Devices7
  • Vehicles7
  • Props & Meshes4
  • Functions2
  • Game Modes2
  • Failure & Options1
  • Items & Inventory1
  • Reference1
  • Teams & Classes1
  • Tutorials1
Tutorials 37
  • Game Modes6
  • Triggers & Logic5
  • Classes & Interfaces4
  • Events4
  • Props & Meshes3
  • Building2
  • Devices2
  • Items & Inventory2
  • Scoring & Objectives2
  • Animation1
  • Arrays & Maps1
  • Cameras1
  • Concurrency1
  • Physics1
  • Player Management1
  • Structs & Enums1
Weapons 30
  • Game Modes6
  • Weapons6
  • Devices5
  • Items & Inventory3
  • Scoring & Objectives3
  • Spawning2
  • Teams & Classes2
  • Best Practices1
  • Functions1
  • Triggers & Logic1
Items 28
  • Items & Inventory23
  • Devices2
  • Triggers & Logic2
  • Spawning1
Assets 20
  • Modules & Structure6
  • Arrays & Maps3
  • Functions3
  • Scene Graph2
  • Best Practices1
  • Devices1
  • Events1
  • Failure & Options1
  • Physics1
  • Variables & Mutability1
Animation 19
  • Animation10
  • Variables & Mutability4
  • Devices1
  • Player Management1
  • Props & Meshes1
  • Scene Graph1
  • Syntax & Types1
Release Notes 17
  • Classes & Interfaces5
  • Modules & Structure3
  • Concurrency2
  • Control Flow2
  • Variables & Mutability2
  • Debugging1
  • Devices1
  • Items & Inventory1
Input & Controls 16
  • Functions4
  • UI & HUD3
  • Control Flow2
  • Animation1
  • Arrays & Maps1
  • Cinematics1
  • Debugging1
  • Devices1
  • Events1
  • Items & Inventory1
Publishing 8
  • Control Flow5
  • Arrays & Maps1
  • Devices1
  • Syntax & Types1
Audio 7
  • Audio5
  • UI & HUD2
Landscape 7
  • Other4
  • VFX & Particles2
  • Scene Graph1
Persistence 6
  • Structs & Enums2
  • Items & Inventory1
  • Persistence1
  • Publishing & Islands1
  • Variables & Mutability1
Physics 5
  • Functions2
  • Classes & Interfaces1
  • Devices1
  • Syntax & Types1
Creator Economy 3
  • Publishing & Islands2
  • Modules & Structure1
Discovery 3
  • Devices1
  • NPCs & AI1
  • Structs & Enums1
Editor & Project 3
  • Other1
  • Props & Meshes1
  • Tutorials1

VerseMaxxing Utility Functions

Utils

Verse from mandeep/VerseMaxxing (Snippets/Utils.verse), by mandeep, under the Apache-2.0 license. Pinned at commit 21832764c. Compile-checked and ready to adapt for UEFN.

using { /Fortnite.com/Characters }
using { /Fortnite.com/Devices }
using { /Fortnite.com/Teams }
using { /Verse.org/Simulation }
using { /Verse.org/Concurrency }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /UnrealEngine.com/Temporary }



Utils<public> := module:
    # Check if all elements in an array are equal
    AllElementsEqual<public>(Array: []int)<transacts>:logic=
        if (Array.Length <= 1):
            return true

        for (i := 1..Array.Length-1):
            if (Array[i] <> Array[0]):
                return false

        true

    # Find any elements in an array that are not unique
    #
    # Returns a new array of elements that were found to be duplicates
    # Example: [0, 1, 1, 2, 2, 2] will return [1, 2]
    FindDuplicates<public>(Array: []int)<transacts>:[]int=
        if (Array.Length <= 1):
            return Array

        var DuplicatesMap: [int]int = map{}
        var DuplicatesArray: []int = array{}

        for (Index->Element : Array):
            if (DuplicatesMap[Element]):
                set DuplicatesArray += array{Element}
            else if (set DuplicatesMap[Element] = 1) {}

        DuplicatesArray

    # Find elements in an array that are equal in number
    #
    # Returns a new array of all indices of elements that were found to be equal
    # Example: [1, 1, 2] returns [0, 1]
    FindDuplicateIndices<public>(Array: []int)<transacts>:[]int=
        if (Array.Length <= 1):
            return array{0}

        var Duplicates: [int][]int = map{}

        for (Index->Element : Array):
            if (Duplicates[Element]):
                if (set Duplicates[Element] += array{Index}) {}
            else:
                if (set Duplicates[Element] = array{Index}) {}

        var Indices: []int = array{0}

        if (var MaxElement: int = Array[0]):
            for (Key->Value : Duplicates):
                if (Key > MaxElement):
                    set MaxElement = Key

            if (ElementIndices := Duplicates[MaxElement]):
                set Indices = ElementIndices

        Indices

    # Find the maximum element in an array
    FindMax<public>(Array: []int)<transacts>:int=
        if (var MaxElement: int = Array[0]):
            for (Element : Array):
                if (Element > MaxElement):
                    set MaxElement = Element

            return MaxElement

        -1

    # Convert a string to a message
    StringToMessage<public><localizes>(str: string):message=
        "{str}"

    # Convert an agent to a message
    PlayerToMessage<public><localizes>(Agent: agent):message=
        "{Agent}"

    # Given an agent and team collection, return the team number the player is on
    GetPlayerTeam<public>(Agent: agent, TeamCollection: fort_team_collection):int=
        if (AgentsTeam := TeamCollection.GetTeam[Agent]):
            TeamArray := TeamCollection.GetTeams()
            for (TeamNumber->Team : TeamArray):
                if (AgentsTeam = Team):
                    return TeamNumber + 1

        -1

    # Convert an array of players to an int array
    # This is useful when needing to sort an array of players
    ConvertPlayerArrayToIntArray<public>(Array: []player):[]int=
        var IntArray: []int = array{}

        for (Index->Player : Array):
            set IntArray += array{Index}

        IntArray

    # A comparator for sorting in ascending order
    LessThan<public>(Left: int, Right: int)<computes><decides>:void=
        Left < Right

    # A comparator for sorting in descending order
    GreaterThan<public>(Left: int, Right: int)<computes><decides>:void=
        Left > Right

    # Calculate the distance between two players
    CalculatePlayerDistance<public>(Player1: player, Player2: player):float=
        var PlayerDistance: float = 0.0

        if (FortChararacter1 := Player1.GetFortCharacter[], FortChararacter2 := Player2.GetFortCharacter[]):
            set PlayerDistance = Distance(FortChararacter1.GetTransform().Translation, FortChararacter2.GetTransform().Translation)

        PlayerDistance

    # Given a player and an array of other players, find the nearest player to the given player
    #
    # Returns the nearest player to the given player and the distance between them
    FindNearestPlayer<public>(Player: player, PlayersToCheck: []player):tuple(?player, float)=
        var NearestPlayer: ?player = false
        var NearestDistance: float = 1000000000000000000.0

        for (PlayerToCheck : PlayersToCheck):
            CalculatedDistance := CalculatePlayerDistance(Player, PlayerToCheck)

            if (CalculatedDistance < NearestDistance):
                set NearestDistance = CalculatedDistance
                set NearestPlayer = option{PlayerToCheck}


        (NearestPlayer, NearestDistance)

    # Sort a map of players based on the value and return a new array of the sorted players
    InsertionSort<public>(MapToSort: [player]float):[]player=
        var Keys: []player = array{}

        for (Key->Value : MapToSort):
            set Keys += array{Key}

        N: int = Keys.Length

        for (I := 1..N-1):
            if (CurrentKey := Keys[I]):
                var J: int = I - 1

                loop:
                    if (J < 0 or MapToSort[Keys[J]] <= MapToSort[CurrentKey]):
                        break

                    if (KeyToSwap  := Keys[J], set Keys[J + 1] = KeyToSwap) {}

                    set J -= 1

                if (set Keys[J+1] = CurrentKey) {}

        Keys

    # Sort a map of players based on the value in the map and return a new map of the players in sorted order
    SortedMap<public>(MapToSort: [player]float):[player]float=
        SortedKeys: []player = InsertionSort(MapToSort)

        var SortedMapOutput: [player]float = map{}

        for (Key : SortedKeys):
            if (KeyToSwap := MapToSort[Key], set SortedMapOutput[Key] = KeyToSwap) {}


        SortedMapOutput

Comments

    Sign in to vote, comment, or suggest an edit. Sign in
    📄
    Source
    mandeep
    mandeep/VerseMaxxing
    mandeep
    Apache-2.0

    From a public GitHub repository under its own permissive license. Rights remain with the original author; the license link below governs reuse. Shown here with attribution and a link to the source.

    View original Sources & licensing
    Request removal
    Tags
    github harvested apache-2.0
    Verse code
    Compiles · verified Jun 25, 2026
    Sign in to download .verse

    Copy-paste the code above is always free.

    Keep exploring
    More in Verse Language · 76 of 106
    Prev
    mandeep versemaxxing cancelabletask
    Next
    sprintermax uefnversesnippets modulesconfig
    Related topics
    • Lawfulexplosivemammothpistol Br Ch7s2 Exotic Weapons
    • Lawlessexplosivemammothpistol Br Ch6s2 Exotic Weapons
    • Semiautosuppressedpistol Br Ch1s2 Rare Weapons
    • Semiautosuppressedpistol Br Ch3s1 Uncommon Weapons
    • Vehiclemodoffroadtires Br Ch2s6 Common Vehicles

    Related

    Open in graph →

    Related topics

    • Lawfulexplosivemammothpistol Br Ch7s2 Exotic
    • Lawlessexplosivemammothpistol Br Ch6s2 Exotic
    • Semiautosuppressedpistol Br Ch1s2 Rare
    • Semiautosuppressedpistol Br Ch3s1 Uncommon
    • Vehiclemodoffroadtires Br Ch2s6 Common
    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