Verse Library verse

01 Device

Activates a customizable light device at match start to simulate changing arena block colors.

verse-library/2-build-the-level/01-device.verse

# This is a simple Verse script.
# It changes a block's visibility when the game starts.

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

# This is our device. It is like a magic box.
# We will attach this to a prop in the editor.
ChangeColorDevice := class(creative_device):

    # This is a variable. It points to a customizable_light_device
    # placed in the editor. We use light color as our "block color."
    # note: Verse has no generic SetMaterialColor on world props;
    # a customizable_light_device is the closest real device that
    # lets you change visible color at runtime via editor properties.
    @editable
    ColorLight : customizable_light_device = customizable_light_device{}

    # This function runs when the game starts.
    OnBegin<override>()<suspends>: void =
        # Turn the light on so its color becomes visible.
        # This is our stand-in for "painting" the block.
        ColorLight.TurnOn()

Comments

    Sign in to vote, comment, or suggest an edit. Sign in