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 › NPCs & AI
Browse Verse Library

Library

Devices 634
  • Devices166
  • Triggers & Logic117
  • UI & HUD41
  • Audio39
  • Items & Inventory29
  • Events28
  • Scoring & Objectives24
  • Spawning19
  • Classes & Interfaces18
  • Game Modes16
  • Props & Meshes13
  • Variables & Mutability12
  • Modules & Structure11
  • Player Management11
  • Round Flow9
  • Tutorials7
  • Animation6
  • Functions6
  • Getting Started6
  • Teams & Classes6
  • Concurrency5
  • Debugging5
  • NPCs & AI5
  • VFX & Particles5
  • Cameras4
  • Arrays & Maps3
  • Control Flow3
  • Structs & Enums3
  • Syntax & Types3
  • Cinematics2
  • Persistence2
  • Scene Graph2
  • Building1
  • Other1
  • Physics1
  • Publishing & Islands1
  • Reference1
  • Templates1
  • Vehicles1
  • Weapons1
Verse Language 257
  • Control Flow35
  • Functions27
  • Arrays & Maps25
  • Classes & Interfaces22
  • Variables & Mutability22
  • Concurrency21
  • Syntax & Types18
  • Modules & Structure12
  • Debugging8
  • Devices8
  • Events7
  • Player Management6
  • Structs & Enums6
  • Triggers & Logic6
  • Failure & Options4
  • Game Modes4
  • UI & HUD4
  • Getting Started3
  • Round Flow3
  • Scene Graph3
  • Spawning3
  • Reference2
  • Templates2
  • VFX & Particles2
  • Animation1
  • Best Practices1
  • Cameras1
  • Props & Meshes1
Materials/VFX 154
  • Triggers & Logic27
  • UI & HUD17
  • Devices16
  • VFX & Particles16
  • Game Modes8
  • Props & Meshes8
  • Scoring & Objectives8
  • Items & Inventory7
  • Arrays & Maps5
  • Events4
  • Animation3
  • Cinematics3
  • Classes & Interfaces3
  • Control Flow3
  • Modules & Structure3
  • Round Flow3
  • Spawning3
  • Concurrency2
  • Functions2
  • Reference2
  • Scene Graph2
  • Syntax & Types2
  • Variables & Mutability2
  • Getting Started1
  • Persistence1
  • Player Management1
  • Structs & Enums1
  • Tutorials1
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 & Classes18
  • Classes & Interfaces12
  • Devices11
  • Triggers & Logic9
  • Events8
  • Persistence7
  • Arrays & Maps6
  • Game Modes5
  • Round Flow4
  • Functions3
  • Getting Started3
  • Items & Inventory3
  • Modules & Structure3
  • Concurrency2
  • Control Flow2
  • Debugging2
  • Props & Meshes2
  • Scoring & Objectives2
  • Spawning2
  • Structs & Enums2
  • Physics1
  • Reference1
  • UI & HUD1
  • Variables & Mutability1
  • Weapons1
Building & Props 131
  • Variables & Mutability15
  • Props & Meshes13
  • Triggers & Logic13
  • Classes & Interfaces10
  • Devices10
  • UI & HUD10
  • Events7
  • Teams & Classes7
  • Functions6
  • Animation5
  • Building5
  • VFX & Particles5
  • Structs & Enums4
  • Control Flow3
  • Game Modes3
  • Items & Inventory3
  • Round Flow3
  • Scene Graph3
  • Concurrency2
  • Reference2
  • Arrays & Maps1
  • Modules & Structure1
NPCs & AI 76
  • NPCs & AI34
  • Spawning7
  • Animation6
  • Variables & Mutability5
  • Classes & Interfaces3
  • Debugging3
  • Game Modes3
  • UI & HUD3
  • Audio2
  • Concurrency2
  • Props & Meshes2
  • Devices1
  • Functions1
  • Getting Started1
  • Reference1
  • Triggers & Logic1
  • VFX & Particles1
Spawning 73
  • Spawning31
  • Concurrency6
  • Events6
  • Vehicles5
  • Player Management4
  • Props & Meshes4
  • Items & Inventory3
  • Teams & Classes3
  • Devices2
  • Functions2
  • Round Flow2
  • Scene Graph2
  • Control Flow1
  • Scoring & Objectives1
  • Triggers & Logic1
Cinematics 71
  • Cameras17
  • Cinematics15
  • Devices11
  • Audio5
  • Animation4
  • Triggers & Logic4
  • Functions2
  • Game Modes2
  • Templates2
  • UI & HUD2
  • Classes & Interfaces1
  • Concurrency1
  • Control Flow1
  • Debugging1
  • Items & Inventory1
  • Modules & Structure1
  • Scene Graph1
UI 57
  • UI & HUD34
  • Devices5
  • Scoring & Objectives4
  • Classes & Interfaces3
  • Round Flow2
  • Scene Graph2
  • Arrays & Maps1
  • Functions1
  • Getting Started1
  • Reference1
  • Structs & Enums1
  • Triggers & Logic1
  • Variables & Mutability1
Scene Graph 40
  • Scene Graph9
  • Items & Inventory8
  • Classes & Interfaces3
  • Events3
  • Props & Meshes3
  • Reference2
  • Arrays & Maps1
  • Building1
  • Control Flow1
  • Debugging1
  • Functions1
  • Modules & Structure1
  • Player Management1
  • Structs & Enums1
  • Syntax & Types1
  • Triggers & Logic1
  • UI & HUD1
  • VFX & Particles1
Vehicles 38
  • Spawning12
  • Devices7
  • Vehicles7
  • Props & Meshes4
  • Game Modes2
  • Failure & Options1
  • Items & Inventory1
  • Reference1
  • Teams & Classes1
  • Tutorials1
  • VFX & Particles1
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
  • Devices6
  • Game Modes6
  • Weapons4
  • Items & Inventory3
  • Scoring & Objectives3
  • Spawning2
  • Teams & Classes2
  • Best Practices1
  • Classes & Interfaces1
  • 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
  • Animation9
  • Variables & Mutability4
  • Devices1
  • Props & Meshes1
  • Reference1
  • Scene Graph1
  • Syntax & Types1
  • Tutorials1
Release Notes 17
  • Classes & Interfaces5
  • Modules & Structure3
  • Concurrency2
  • Control Flow2
  • Variables & Mutability2
  • Debugging1
  • Devices1
  • Items & Inventory1
Input & Controls 16
  • Functions3
  • Control Flow2
  • Syntax & Types2
  • UI & HUD2
  • Animation1
  • Arrays & Maps1
  • Cinematics1
  • Debugging1
  • Devices1
  • Events1
  • Reference1
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
  • Syntax & Types3
  • Classes & Interfaces1
  • Devices1
Creator Economy 3
  • Modules & Structure1
  • Other1
  • Publishing & Islands1
Discovery 3
  • Devices1
  • NPCs & AI1
  • Structs & Enums1
Editor & Project 3
  • Other1
  • Props & Meshes1
  • Tutorials1

SpongeBob Roguelike Snippets

Module — 6 files
These files compile together (same module folder).
game_manager.verse
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# A simple game manager to initialize the other verse devices on begin

game_manager := class(creative_device):
    @editable PlayerAttackManager : player_attack_manager = player_attack_manager{}
    @editable EnemyManager : enemy_manager = enemy_manager{}

    OnBegin<override>()<suspends>:void=
        PlayerAttackManager.Init()
        EnemyManager.Init()
enemy_manager.verse
using { /Fortnite.com/Characters }
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }


# The AddEnemyAgentTagComponent function can be used to add the enemy_agent_tag_component to any agent that has an Entity. This example has  
# an npc_spawner_device and guard_spawner_device, but feel free to experiment with any device that sends an agent and adding the 
# enemy_agent_tag_component. This will allow the agent to be effected by the projectiles that check for this component.  

enemy_manager := class(creative_device):
    @editable NpcSpawnerDevice : npc_spawner_device = npc_spawner_device{}
    @editable GuardSpawnerDevice : guard_spawner_device = guard_spawner_device{}

    Init() : void =
        NpcSpawnerDevice.SpawnedEvent.Subscribe(AddEnemyAgentTagComponent)
        GuardSpawnerDevice.SpawnedEvent.Subscribe(AddEnemyAgentTagComponent)

  
    # Adds the enemy_agent_tag_component to the Entity of the passed in agent. When the "projectiles" collide via the EntityEnteredEvent we can
    # then verifiy if the entity that entered the projectile has an "enemy_agent_tag_component" added to it, and if so, damage the enemy. This
    # is necessary so that we do not run code on entities we did not intend to, such as: other projectiles, the player, friendly npc's or 
    # any other entity that may enter it during gameplay.
    AddEnemyAgentTagComponent(EnemyAgent:agent):void=
        if:
            EnemyFortCharacter := EnemyAgent.GetFortCharacter[]
            EnemyEntity := EnemyFortCharacter.GetEntity[]
        then:
            EnemyAgentTagComponent := enemy_agent_tag_component{Entity := EnemyEntity}
            EnemyEntity.AddComponents(array{EnemyAgentTagComponent})
player_attack_manager.verse
using { /Fortnite.com/Devices }
using { /Verse.org/SceneGraph }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
 
# This player attack manager is used to initiate the "spawning" of the projectiles into the simulation. In this example we are using the
# input trigger, but you can use any conditions you like in order to call "SpawnProjectile" that sends an agent. You could rewrite this 
# code to not require an agent, but in this case an agent is being used so we can count the elimination of enemies for the player who
# spawned the projectile. 

# We are directly setting "PlayerProjectileEntity" to an entity prefab definition we have created, but you could use something like an editable
# enum with a wrapper to assign specific entity prefab defintions as you see fit. An example would be "upgrading" a projectile and using 
# that entity prefab definition instead.

player_attack_manager := class(creative_device):
    @editable InputTriggerPlayerAttack : input_trigger_device = input_trigger_device{}

    Init(): void =
        InputTriggerPlayerAttack.PressedEvent.Subscribe(SpawnProjectile)


    SpawnProjectile(PlayerAgent:agent) : void =
        # This is our pre made entity prefab definition, the file path will be specific to where you have placed your entity prefab definiton
        # and should be replaced here.
        PlayerProjectileEntity := PlayerProjectileEntities.EPD_Player_Projectile_Container_Single_Sphere_Red{}

        # Attempts to add the Entity Prefab Definition to the simulation (Our pre made projectile)
        if(SimulationEntity := GetSimulationEntity[]):
            SimulationEntity.AddEntities(array{PlayerProjectileEntity})
        
        # Checks if the entity has the player_projectile_component, if it does call the function "SetProjectileGlobalTransform"
        # in order to set the projectiles "starting position" to be where the player is currently located
        if(Component := PlayerProjectileEntity.GetComponent[projectile_container_component]):
            Component.SetProjectileGlobalTransform(PlayerAgent)
file_4.verse
|  |  |
| --- | --- |
|  | using { /Verse.org } |
|  | using { /Verse.org/Native } |
|  | using { /Verse.org/SceneGraph } |
|  | using { /Verse.org/Simulation } |
|  |  |
|  | # This is a simple component we will add to any agent we want to classify as an "enemy" we can do this by getting the entity of an agent |
|  | # and adding this component. We can then check for this component as needed and then apply any code we want to the agent, such as |
|  | # damaging them. |
|  |  |
|  | enemy_agent_tag_component<public> := class<final_super>(component): |
projectile_container_component.verse
using { /Verse.org/Simulation }
using { /Verse.org/SceneGraph }
using { /Fortnite.com/Characters }
using { /UnrealEngine.com/Temporary/SpatialMath }


# This container component allows us to spawn a"container" entity wherever we want, in this case the players location. Once spawned
# it checks for children entities with the "projectile_component", which then handles the projectile logic on their own.
# This allows for rapid creation and iteration of projectiles, because you can simply place as many child entities within the container entity 
# as you want, and as long as the container has the "projectile_container_component" and the children have the
# "projectile_component" added, they will handle all gameplay logic  


projectile_container_component := class<final_super>(component):

    # Spawned in entities default to the origin of the simulation, this function sets the global transform of the container entity to that of
    # the players current location.
    SetProjectileGlobalTransform(PlayerAgent:agent): void =
        if(SpawningFortChar:= PlayerAgent.GetFortCharacter[]):
            PlayerTransform := SpawningFortChar.GetTransform()
            PlayerTranslation := PlayerTransform.Translation
            Entity.SetGlobalTransform(FromTransform(PlayerTransform))
            InitChildrenEntities(PlayerAgent)

    # Checks if any of the children entities attatched to this entity have the "projectile_component" component, and if so
    # runs the "InitProjectile" function.
    InitChildrenEntities(PlayerAgent:agent): void =
        ChildEntities := Entity.GetEntities()
        for(ChildEntity:ChildEntities):
            if(Component := ChildEntity.GetComponent[projectile_component]):
                Component.InitProjectile(PlayerAgent)
projectile_component.verse
using { /Fortnite.com/AI }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Game }
using { /Verse.org/Random }
using { /Verse.org/SceneGraph }
using { /Verse.org/SceneGraph/KeyframedMovement }
using { /Verse.org/Simulation }
using { /Verse.org/SpatialMath }


# This component will animate an entity forward from the parent or "container" entites location. In this case being the players current
# location. It then subscribes to the EntityEnteredEvent, and any time another entity enters this entity it checks for the 
# "enemy_agent_tag_component". If the entered entity has this component, it will then damage that entities fort character. It also
# subscribes to the FinishedEvent of the keyframed_movement_component, and removes the entire parent (cotnainer) entity upon the animation 
# completing (The projectile reaching it's maximum distance). This is a simple example, but you would likely want to add other realistic 
# cases where the entity may require being destroyed before the animation had finished, and instead want to race against those conditions. 
# Such as the projectiles hitting a boundry wall, the player being eliminated or removed from the game etc.

projectile_component := class<final_super>(component):
    var TravelDistance : float = 3500.0
    var ProjectileSpeed : float = 1500.0
    var MaybePlayerAgent : ?agent = false
    var MaybeParentEntity : ?entity = false
    
    
    InitProjectile(PlayerAgent:agent): void =
        set MaybePlayerAgent = option{PlayerAgent}
        if:
            ParentEntity := Entity.GetParent[]
            MeshComp := Entity.GetComponent[mesh_component]
            KeyComp := Entity.GetComponent[keyframed_movement_component]
        then:
            set MaybeParentEntity = option{ParentEntity}
            MeshComp.EntityEnteredEvent.Subscribe(OnEntityEntered)
            KeyComp.FinishedEvent.Subscribe(RemoveParentFromSimulation)
            CalculateDestination(PlayerAgent)



    # Note: This projectile component was designed for use in a "top down" view game, so there is no Z-axis accounted for in the calculations
    # for the projectiles travel destination, feel free to modify the code to add account for the Z-axis if desired.

    CalculateDestination(PlayerAgent:agent): void =
        CurrentTransform := Entity.GetGlobalTransform()
        ForwardVector := CurrentTransform.Rotation.GetForwardAxis() * TravelDistance
        DestinationTranslation := CurrentTransform.Translation + ForwardVector
        spawn{AnimateProjectile(ForwardVector)}

           
    AnimateProjectile(DestinationTranslation:vector3)<suspends>: void =
        TravelTime := TravelDistance/ProjectileSpeed

        NewTransform:transform = transform:
            Translation := DestinationTranslation
            Scale := vector3{Left := 0.0, Up := 0.0, Forward := 0.0}

        KeyDelta : keyframed_movement_delta = keyframed_movement_delta :
            Transform := NewTransform
            Duration := TravelTime
            Easing := linear_easing_function{}
            
        if(KeyComp := Entity.GetComponent[keyframed_movement_component]):
            KeyComp.SetKeyframes(array{KeyDelta}, oneshot_keyframed_movement_playback_mode{})
            Sleep(0.1)
            KeyComp.Play()       

    # Note: Your static mesh in your entity prefab that is being "entered" must have collision, and a compatible collision type set, such
    # as "OverlapAllDynamic" in order for the entity entered event to work, remember to check your static mesh settings in the mesh itself
    # and also make sure the static mesh component in the entity is set to "collidable". It does not need to be visible, therefore you could
    # if you wanted exclusively use a transparent mesh for collision checking, and use a Niagara Particle System Component for the "visible"
    # part of the projectile, or use a combination of both if desired.
    OnEntityEntered(EnteredEntity:entity):void =
        if(EnteredEntity.GetComponent[enemy_agent_tag_component]):
            for(Component:EnteredEntity.GetComponents()):
                if(EnteredFortCharacter := fort_character[Component]):
                    DamageEnteredFortCharacter(EnteredFortCharacter)
                    # This removes only this specific entity from the parent entity we attatched to, not the "parent" or "container" entity. 
                    # For example a "Spread shot" parent entity may have 3 child projectiles, but you would only want to remove this specific 
                    # entity that collided with an "enemy", but allow the other 2 projectiles to continue moving forward until they reach the 
                    # maximum travel distance.
                    Entity.RemoveFromParent()

    


    # This damage function specifically uses damage args is for the purpose of allowing the "player" to be counted as the instigator for the 
    # damage done to the "entered fort character" in this case, an enemy. Using damage args allows the player to be counted as the eliminator,
    # which is useful for game modes that require counting the players eliminations.  
    DamageEnteredFortCharacter(EnteredFortCharacter:fort_character) : void =
        if:
            PlayerAgent := MaybePlayerAgent?
            PlayerFortCharacter := PlayerAgent.GetFortCharacter[]
        then:
            DamageArgs := damage_args:
                Instigator := option{PlayerFortCharacter}
                Source := option{PlayerFortCharacter}
                Amount := 25.0
            EnteredFortCharacter.Damage(DamageArgs)


    # This removes the "top" level parent entity that this child entity is attatched to (The container). This is used to remove all entities 
    # attatched to the parent entity once they have "finished" their intended purpose, ie. Reaching their maximum distance.
    RemoveParentFromSimulation() : void =
        if(ParentEntity := MaybeParentEntity?):
            ParentEntity.RemoveFromParent()
Sign in to download module

Copy-paste each file above is always free.

Comments

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

    Created by a member of the Epic Games community. Rights remain with the original author, under Epic's community content terms. Terms ↗

    View original Sources & licensing
    Request removal
    Last updated Jun 23, 2026
    Verse module (6 files)
    Build failed · 1 error

    Download the full module (zip) from the code panel above.

    Keep exploring
    More in Verse Language · 27 of 106
    Prev
    fortnite map editable
    Next
    fortnite reverse array
    Related topics
    • Fortnite Spawn Creative Prop Collection Spawning
    • Fortnite Ai Music Manager Npcs & Ai
    • Fortnite Patrol Path Manager V2 Npcs & Ai
    • Fortnite Simple Class Loadouts Player
    • Input Action%28t%29 Assets

    Related

    Open in graph →

    Related topics

    • Fortnite Spawn Creative Prop Collection
    • Fortnite Ai Music Manager
    • Fortnite Patrol Path Manager V2
    • Fortnite Simple Class Loadouts
    • Input Action%28t%29
    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