Verse Library verse

01 Device

Toggles between different sky dome atmospheric modes when players interact with a linked button device.

verse-library/using-skydome-devices-in-fortnite-creative/01-device.verse

# This is a comment. Verse ignores lines starting with #.
# We're making a simple Day/Night switch.

# 1. Define our Script. In UEFN, Verse logic lives inside a creative_device class.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# mood_sky_script is the container for our logic.
# It inherits from creative_device so UEFN recognises it as a placeable script device.
mood_sky_script := class(creative_device):

    # 2. Variables: These are our "state trackers."
    # CurrentMood is a boolean (true/false).
    # Think of it like a light switch: On or Off.
    # 'var' makes it mutable so we can toggle it later.
    var CurrentMood : logic = true

    # Reference to the skydome device placed on the island.
    # Wire this up in the UEFN Details panel after placing the script device.
    # skydome_device exposes EnableDayPhase / DisableDayPhase and
    # fog controls we call below.
    MoodSwitch : button_device = button_device{}
    SkyDome    : sky_dome_device = sky_dome_device{}

    # OnBegin runs automatically when the game session starts.
    # We use it to subscribe to the button's InteractedWithEvent.
    OnBegin<override>()<suspends> : void =
        # Connect the button's event to our handler function.
        # Every time a player presses MoodSwitch, ChangeSkyMood fires.

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