Verse Library verse

01 Device

Tracks player eliminations, updates a running score variable, and displays it via text device.

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

# This is a Verse Script. Think of it as the "Brain" of the device.
# It listens for events and changes things in the world.

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

# We define a "Device" that holds our Player Reference and Text Display.
# This is like creating a custom object in the game.
kill_counter_device := class(creative_device):

    # These are the "Components" or parts of our device.
    # Imagine these are the wires connecting things together.
    # Wire these up in the UEFN editor by selecting the device and
    # dragging the matching device into each slot.
    @editable
    MyTextDisplay : text_display_device = text_display_device{}

    # This is a "Variable".
    # In game terms: A variable is like a scoreboard that changes.
    # Here, we store the player's current elimination count.
    var CurrentScore : int = 0

    # This function runs when the island starts.
    OnBegin<override>()<suspends> : void =
    {
        # Get the playspace so we can access all players and their events.
        Playspace := GetPlayspace()

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