Verse Library verse

01 Device

Spawns concurrent listeners per player to detect secondary inputs and trigger dodge impulses.

verse-library/secondary-action-dodge/01-device.verse

# Import the necessary systems. Think of these as your "Loadout" of tools.
using { /Fortnite.com/Characters }
using { /Fortnite.com/Devices }
using { /Fortnite.com/Game }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }

# This is our device. It's the brain attached to an Entity placed on your island.
# In UEFN, add a "Verse Device" to your scene and assign this class to it.
dodge_device := class(creative_device):

    # OnBegin is called automatically when the game session starts.
    # Think of it as the "Match Start" trigger — the engine fires it for you.
    OnBegin<override>()<suspends> : void =
        # Get every player currently in the session.
        AllPlayers := GetPlayspace().GetPlayers()

        # Loop over each player and set up their dodge listener.
        for (Player : AllPlayers):
            # spawn lets us run the dodge listener concurrently for each player
            # without blocking the rest of the setup. Each player gets their own
            # independent listener running at the same time.
            spawn { ListenForDodge(Player) }

    # ListenForDodge runs persistently for a single player.
    # It waits for that player's FortCharacter to perform a secondary action,
    # then fires the dodge impulse.
    ListenForDodge(Player : player)<suspends> : void =
        # Attempt to get the player's FortCharacter (their in-world body).

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.

Sign in with Discord

Comments

    Sign in to vote, comment, or suggest an edit. Sign in