Verse Library verse

01 Device

Tracks coin collection, manages player respawn points, and exposes editor fields for drag-and-drop linking.

verse-library/build-your-own-lego-obstacle-course-in-fortnite-creative/01-device.verse

# This is the main script for our Obby Manager
# Think of this as the "Game Rules" document

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

# A Verse device must be declared as a class that extends creative_device.
# Think of creative_device as the "base" that every Verse script in UEFN inherits from.
obby_manager := class(creative_device):

    # 1. DEFINE VARIABLES (The Loot Pool)
    # We need a counter to track coins.
    # 'int' means Integer (a whole number, no decimals).
    # 'CoinCount' is the name of our variable.
    # It starts at 0.
    # 'var' makes it mutable so we can change it later.
    var CoinCount : int = 0

    # We need to know how many coins are in the level total.
    # This is a CONSTANT. It never changes.
    # Think of it like the number of rings in Mario Kart: it's always 3.
    TotalCoins : int = 5

    # 2. DEFINE THE PLAYER START (The Respawn Point)
    # We need to tell the code where to send players if they fall.
    # We'll link this to a specific Player Start device in the editor later.
    # '@editable' exposes the field so you can drag a device into it in UEFN.
    @editable
    PlayerStartDevice : player_spawner_device = player_spawner_device{}

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