Verse Library verse

01 Standalone

Automatically activates a specified light device when the game session begins.

verse-library/using-retail-galleries-in-fortnite-creative/01-standalone.verse

# This is a simple script for a shop light.
# It turns the light on when the game starts.

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

# We create a new device for our shop.
# Think of this as a new box for our code.
ShopLightDevice := class(VerseDevice):

    # This is a variable for our light.
    # It will hold the light we place in the editor.
    # We set it to a default light_device so it can be edited in the editor panel.
    @editable
    MyLight : customizable_light_device = customizable_light_device{}

    # This runs once when the game starts.
    OnBegin<override>()<suspends> : void =
        # Turn the light on when the game begins.
        MyLight.TurnOn()
        # Let's say hello in the console.
        Print("The store is now open!")

Comments

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