Verse Library verse

01 Fragment

Tracks button presses on linked lights and grants a reward when solved.

verse-library/lights-and-bridges-05-create-a-puzzle-with-prefabs-in-fortnite/01-fragment.verse

# This is our main script. It defines the behavior of our puzzle.
# Think of this as the "Game Rules" document for this specific puzzle.

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

# This is our Prefab type. It represents one light/switch unit.
# We use this to tell Verse: "Hey, these lights belong together."
type LightUnit is data {
    # A reference to the light device in the scene graph.
    # This is like pointing to a specific folder in your inventory.
    LightDevice: light_device
    
    # A reference to the button that controls it.
    ButtonDevice: button_device
    
    # The current state: true = ON, false = OFF.
    # This is our variable! It changes every time someone clicks.
    IsOn: bool = false
}

# This is the main controller. It holds a list of all our LightUnits.
# Imagine this is the "Master Control Panel" for your vault.
type PuzzleController is data {
    # A list of all the light switches in this puzzle.
    # We use a list because we might have 3 lights, or 10.
    Lights: list<LightUnit> = list{}
    
    # This is the reward! An item granter that gives the loot.
    RewardItem: item_granter_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