Verse Library verse

01 Device

Grants shield potions to players who step on a specific trigger device.

verse-library/player-options/01-device.verse

# This is our Team Door script
# It runs when a player steps on the trigger

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

# We attach this class to a trigger_device placed in the editor
team_door_device := class(creative_device):

    # Reference to the trigger device placed in the editor
    @editable
    Trigger : trigger_device = trigger_device{}

    # Reference to an item_granter_device placed in the editor.
    # Set its item to Shield Potion Small in the UEFN editor properties.
    # note: Verse has no direct GrantItem() API; item_granter_device is the real mechanism.
    @editable
    ItemGranter : item_granter_device = item_granter_device{}

    # OnBegin runs once when the island starts
    OnBegin<override>()<suspends> : void =
        # Subscribe to the trigger's TriggeredEvent
        Trigger.TriggeredEvent.Subscribe(OnTriggerEnter)

    # This function runs when a player steps on the trigger
    OnTriggerEnter(Agent : ?agent) : void =
        # Check if the agent is actually a player

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