Verse Library verse

01 Device

Randomly selects a color from a palette and applies it to a connected VFX device on game start.

verse-library/color-palette/01-device.verse

using /Fortnite.com/Devices
using /UnrealEngine.com/Temporary/Diagnostics

# This is our "Mood Ring" script!

mood_ring_device := class(creative_device):

    # Wire your VFX Creator Device to this property in the UEFN editor.
    @editable
    VFX_Device : vfx_creator_device = vfx_creator_device{}

    # 1. Define the colors we want to use.
    # We call these "constants" because they don't change.
    # Think of them as fixed crayons in a box.
    Red_Crayon : color = color{R:=1.0, G:=0.0, B:=0.0, A:=1.0}
    Blue_Crayon : color = color{R:=0.0, G:=0.0, B:=1.0, A:=1.0}
    Green_Crayon : color = color{R:=0.0, G:=1.0, B:=0.0, A:=1.0}

    # 2. Create a list of our colors.
    # This is like a tray holding all our crayons.
    Our_Palette<internal> : []color = array{}

    # 3. This function runs when the game starts.
    OnBegin<override>()<suspends> : void =
        # Build our palette list from the crayon constants.
        Palette := array{Red_Crayon, Blue_Crayon, Green_Crayon}

        # Pick a random crayon from the tray.
        # We use a random index to choose one.
        Random_Index := GetRandomInt(0, Palette.Length - 1)

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