Verse Library verse

01 Device

Waits for a specific stat counter value to be reached, then automatically opens a connected door.

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

# This is the main script for the Goal Checker
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

# We create a new device called GoalChecker
# It is a Verse device that lives in the level
goal_checker_device := class(creative_device):

    # This is the Stat Counter device we want to watch.
    # Drag it into this slot in the Details panel in UEFN.
    @editable
    StatCounter : stat_counter_device = stat_counter_device{}

    # This is the door we want to open.
    # Drag it into this slot in the Details panel in UEFN.
    @editable
    Door : door_device = door_device{}

    # This function runs when the game starts
    OnBegin<override>()<suspends> : void =
        # We wait for the Stat Counter to signal that its
        # target value has been reached by any player.
        # TargetValueReachedEvent fires when the watched
        # stat hits the goal set in the device's properties.
        StatCounter.TargetValueReachedEvent.Await()

        # When the stat is reached, open the door!
        Door.Open()

Comments

    Sign in to vote, comment, or suggest an edit. Sign in