Verse Library verse

01 Device

Reveals a healing statue when players enter a designated trigger zone.

verse-library/configure-the-custom-health-powerup/01-device.verse

# This is a Verse Script snippet for educational purposes.
# It demonstrates how Verse interacts with devices via the Scene Graph.

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

# A Verse device that listens for a trigger and activates
# the Prop Manipulator to reveal the healing statue.
healing_statue_manager := class(creative_device):

    # Bind these in the UEFN Outliner / Customize panel
    @editable
    StatuePropManipulator : prop_manipulator_device = prop_manipulator_device{}

    @editable
    StatueTriggerVolume : trigger_device = trigger_device{}

    # Called once when the game session starts
    OnBegin<override>()<suspends> : void =
        # Subscribe to the trigger volume's ActivatedEvent.
        # When a player enters the volume, OnPlayerEntered fires.
        StatueTriggerVolume.TriggeredEvent.Subscribe(OnPlayerEntered)

    # Handler: receives the agent (player) who walked into the volume
    OnPlayerEntered(Agent : ?agent) : void =
        # Activate the Prop Manipulator to show the statue.
        # Because the Health Powerup is parented to the statue in the
        # Scene Graph, it becomes visible and pickable automatically.

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