Verse Library verse

01 Device

Uses a button press to despawn a weak sentry and spawn a stronger replacement unit.

verse-library/upgradeable-sentry/01-device.verse

# This is the main script for our upgrade system.
# We call this script "SentryUpgrader".

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

# This is our main class. It holds all our devices.
SentryUpgrader := class(creative_device):

    # These are our "slots" for devices.
    # We will drag devices from the editor into these slots.
    @editable
    weak_sentry: sentry_device = sentry_device{}
    @editable
    strong_sentry: sentry_device = sentry_device{}
    @editable
    upgrade_button: button_device = button_device{}

    # This function runs when the game starts.
    OnBegin<override>()<suspends>: void =
        # We wait for the button to be pressed.
        # This is like waiting for a drumbeat.
        upgrade_button.InteractedWithEvent.Await()

        # When the button is pressed, we do this:

        # 1. Hide the weak sentry.
        # We send a "Despawn" signal to it.
        weak_sentry.DestroySentry()

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