Verse Library verse

01 Device

Restores island devices to initial states when a button interaction occurs.

verse-library/fortnite-build-reset-devices-collection/01-device.verse

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# This is our main script block.
# Think of it as the container for our game rules.
# In UEFN, we declare devices as editable properties so the
# editor can wire up the correct objects from the World Outliner.
reset_game_script := class(creative_device):

    # We need to tell Verse which tiles to reset.
    # Select this device in the editor and assign your
    # Color Changing Tiles in the Details panel.
    @editable
    Tile1 : color_changing_tiles_device = color_changing_tiles_device{}

    @editable
    Tile2 : color_changing_tiles_device = color_changing_tiles_device{}

    # We also need the button that triggers the reset.
    # Assign your Conditional Button in the Details panel.
    @editable
    Button : button_device = button_device{}

    # OnBegin runs once when the island starts.
    # It waits for the button to be pressed.
    OnBegin<override>()<suspends> : void =
        # We connect the button's "InteractedWithEvent" to our handler.
        # When the button is clicked, ResetGameScript runs.
        Button.InteractedWithEvent.Subscribe(ResetGameScript)

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