Verse Library verse

01 Device

Handles match start events to initialize creative devices, retrieve player data, and prepare gameplay logic.

verse-library/runs-when-the-device-is-started-in-a-running-game/01-device.verse

# RevengeTrap.verse
# This script makes a trap remember who killed you and target them on start.

using { /Fortnite.com/Devices }
using { /Fortnite.com/Game }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

revenge_trap := class(creative_device):

    # 1. Define the devices we need to interact with.
    # These are set via the Details panel in UEFN by dragging the devices in.
    @editable
    Trigger : trigger_device = trigger_device{}

    # The Prop Mover is the weapon we want to drop.
    # Wire this up in the UEFN Details panel by selecting your "Anvil" prop mover.
    @editable
    Anvil : prop_mover_device = prop_mover_device{}

    # 2. Create a Variable to store the killer's agent reference.
    # This is like a logbook entry. It starts empty (?agent holds an optional value).
    var KillerAgent : ?agent = false

    # 3. The "OnBegin" Event.
    # This function runs exactly once when the match starts.
    OnBegin<override>()<suspends> : void =
        # Get all players currently in the game via the fort_playspace.
        # GetPlayspace() returns the active playspace for this island.
        Playspace := GetPlayspace()

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