Verse Library verse

01 Device

Defines a custom creative device class, exposes scene graph props for editor linking, and starts initialization.

verse-library/place-a-volume-device/01-device.verse

# This script makes a Volume device react to players
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# 1. Define the device class. Think of this as declaring "I am a Trap Master."
# We inherit from creative_device, which is the real base class for
# all placeable Verse devices in UEFN.
sky_trap_device := class(creative_device):

    # 2. This is the "Scene Graph" connection.
    # 'LaunchProp' is a variable that holds a reference to another device in the level.
    # We will link this in the editor later.
    # @editable exposes the variable in the Details panel so you can drag-and-drop
    # a Prop Mover into it from the World Outliner.
    @editable
    LaunchProp : prop_mover_device = prop_mover_device{}

    # 3. The "OnBegin" function runs once when the game starts.
    # This is like the "Start" button on the Battle Bus.
    OnBegin<override>()<suspends> : void =
        # Subscribe to the Volume's AgentEntersEvent on the mutator_zone_device.
        # MutatorZone is the real UEFN device that acts as an invisible trigger volume.
        # We wait for any agent (player) to enter, then call our handler.
        # Note: mutator_zone_device is the closest real API to a "Volume" sensor device;
        # it fires AgentEntersEvent when a player walks into its bounds.
        Print("Sky Trap is armed and waiting...")

        # 4. Bind the PlayerEntered event.
        # AgentEntersEvent fires whenever an agent enters the mutator zone.

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