Verse Library verse

01 Fragment

Defines a UEFN device with editor-exposed properties for runtime adjustment of effect types and power.

verse-library/customize-device-properties-in-verse/01-fragment.verse

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

# This is the main class for our device.
# Think of this as the "Blueprint" for our button.
struct RandomEffectButtonDevice : CreativeDevice {

    # ---------------------------------------------------------
    # 1. DEFINE OUR EDITABLE PROPERTIES
    # These are the variables that will show up in the UEFN panel.
    # ---------------------------------------------------------

    # This variable controls WHICH effect happens.
    # We use @editable to make it visible in the editor.
    # We set a default value of 1 so it doesn't break on first place.
    @editable EffectType : int = 1

    # This variable controls HOW MUCH damage/healing happens.
    # This is like the "Storm Damage" slider.
    @editable PowerLevel : float = 50.0

    # ---------------------------------------------------------
    # 2. DEFINE THE LOGIC (The "Brain")
    # This function runs when the device is initialized.
    # ---------------------------------------------------------
    OnBegin<override>()<suspends>: void = {
        # We don't need to do much here, but we could log our settings.
        # This is great for debugging!
        Print("Device Started! Effect: {EffectType}, Power: {PowerLevel}")
    }

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