Verse Library verse

01 Device

Activates a campfire light and logs a debug message when players enter a trigger zone.

verse-library/build-steps/01-device.verse

# This is our main script file.
# It connects the Trigger to the Light.

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

# This is our "CampfireScript".
# It is a container for our code.
CampfireScript := class(creative_device):

    # This is the "Trigger" device.
    # We link it in the editor later.
    @editable
    MyTrigger: trigger_device = trigger_device{}

    # This is the "Light" device on the campfire.
    # We link it in the editor later.
    # note: customizable_light_device is the real UEFN light device type.
    @editable
    CampfireLight: customizable_light_device = customizable_light_device{}

    # This function runs when the game starts.
    OnBegin<override>()<suspends>:void=
        # We tell the trigger to listen for players.
        # "TriggeredEvent" fires when someone walks in.
        MyTrigger.TriggeredEvent.Subscribe(OnPlayerEntered)

    # This function runs when the event happens.
    # "Agent" is the person who walked in.
    OnPlayerEntered(Agent: ?agent):void=

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