Verse Library verse

01 Fragment

Links a customizable light device to a trigger script, changing light color when players enter the volume.

verse-library/using-customizable-light-devices-in-fortnite-creative/01-fragment.verse

// We are defining a script that runs on an object (like the Trigger)
script class LightTrapScript:

    // 1. VARIABLES: These are like your inventory slots.
    // We need to connect to the device named "MainLight" in the editor.
    // 'MainLight' must match the Name field in UEFN exactly.
    MainLight: CustomizableLightDevice = CustomizableLightDevice(MainLight)

    // 2. FUNCTIONS: This is our "Combo Move."
    // It takes a 'Color' as input and changes the light.
    // Think of 'Color' as the ammo you feed into the function.
    func SetLightTo(color: Color) -> void:
        // This line sends a signal to the device to change its color.
        // It's like pressing the 'Change Color' button on the remote.
        MainLight.SetColor(color)
        
        // Optional: Log a message to the debug console to prove it worked.
        #print(f"Light changed to {color}")

    #event OnBegin():
        #print("Trap armed! Waiting for players...")

    #event OnStart():
        #print("Script started.")

    // 3. EVENTS: These are triggered by game actions.
    // OnTriggered fires when someone walks into our Trigger Volume.
    #event OnTriggered(Other: Actor):
        // Check if the thing that triggered it is a Player.
        if (Other.IsPlayer()):

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