Verse Library verse

01 Device

Toggles a light device on and off in a loop to create a beacon effect.

verse-library/light-functions/01-device.verse

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

# This is our main script block.
# It holds our variables and logic.
beacon_controller := class(creative_device) {

    # A variable to hold our light device.
    # We will set this in the editor.
    @editable
    MyLight: customizable_light_device = customizable_light_device{}

    # A variable for brightness, stored as a float we can change.
    # Light Function materials are set up in the editor; we drive
    # pulsing by toggling the light device's intensity instead.
    # note: Verse has no runtime LightFunctionMaterial API; brightness
    # is approximated via the customizable_light_device Enable/Disable cycle.
    var IsBright : logic = true

    # This event runs when the game starts.
    OnBegin<override>()<suspends>: void = {
        # Start the pulsing loop immediately.
        PulseLight()
    }

    # This is a custom function.
    # It makes the light get brighter and dimmer.
    PulseLight()<suspends>: void = {
        # We loop forever.

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