Verse Library verse

01 Device

Grants a healing item to any player who enters a designated trigger zone.

verse-library/fortnite-minecraft-styled-building-mechanic/01-device.verse

# This is our main script file. It tells the game engine what to do.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# We create a "creative_device" class. Think of this as the brain of our island.
# It holds all the logic. In UEFN, this class is placed directly on your island.
healing_zone_script := class(creative_device):

    # This is a VARIABLE.
    # It's a box that will hold a reference to our Trigger Volume.
    # We call it "Trigger" because it's the thing that detects players.
    # The @editable tag makes it visible and assignable in the UEFN details panel.
    @editable
    Trigger : trigger_device = trigger_device{}

    # This is another VARIABLE.
    # It will hold a reference to our Item Granter.
    # We call it "ItemGranter" because it gives stuff to players.
    @editable
    ItemGranter : item_granter_device = item_granter_device{}

    # This is a FUNCTION.
    # A function is a set of instructions that runs when called.
    # Here, we define what happens when the trigger is activated.
    # It receives the agent (player) who stepped into the trigger zone.
    # The agent parameter is optional (?agent) because the trigger event
    # passes an optional agent value.
    OnTriggerActivated(Agent : ?agent) : void =
        # Unwrap the optional agent before using it.

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