Verse Library verse

01 Device

Displays HUD messages when players trigger trap devices, tracking total triggers for gameplay feedback.

verse-library/using-hud-message-devices-in-fortnite-creative/01-device.verse

# This line tells Verse that our script is ready to run when the game starts.
# Think of it as the "Start Game" button.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# This is our main script. It's like the brain of the island.
# We call it "TrapController" because it controls the traps.
# In UEFN, a Verse device must extend creative_device to live on the island.
TrapController := class(creative_device):

    # VARIABLES: Think of these as backpacks holding items.
    # '@editable' means you can drag-and-drop the device onto this slot
    # directly in the UEFN editor — no GetDevice() lookup needed.
    @editable
    MessageDevice : hud_message_device = hud_message_device{}

    # '@editable' exposes the trigger device to the editor the same way.
    @editable
    TrapTrigger : trigger_device = trigger_device{}

    # 'TrapCount' is a variable integer (a whole number).
    # We start it at 0 because no one has been caught yet.
    # 'var' makes it mutable so we can change it later.
    var TrapCount : int = 0

    # This function is called automatically when the script starts.
    # It's like setting up your loadout before dropping from the bus.
    OnBegin<override>()<suspends> : void =
        # We bind an event. This is like wiring a tripwire to an explosion.

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