Verse Library verse

01 Device

Tracks and increments a score variable each time an automated turret eliminates a target.

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

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

# This is our main script block.
# It manages the turret device and tracks score.
turret_score_manager := class(creative_device):

    # We reference our Automated Turret device here.
    # Drag your placed device onto this property in the editor.
    @editable
    Turret : automated_turret_device = automated_turret_device{}

    # This is a Variable.
    # It holds the current score.
    # It starts at zero.
    var Score : int = 0

    # OnBegin runs automatically when the game starts.
    OnBegin<override>()<suspends> : void =
        # We wait for an Event.
        # DestroyedEvent fires when the turret is destroyed, or we can use TargetFoundEvent.
        # This means an enemy was hit by this turret.
        loop:
            # Block here until the turret finds a target (eliminates someone).
            Turret.TargetFoundEvent.Await()

            # When the event happens...
            # Add one to our score.
            set Score = Score + 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