Verse Library verse

01 Device

Maps players to specific player references to control individual trap doors.

verse-library/player-reference-1-4/01-device.verse

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

# This is our main script. It lives on a Game Manager or a specific device.
# Think of this as the "Brain" of the operation.
revenge_trap_script := class(creative_device):

    # We need a list of Player Reference devices.
    # You will place these in the level editor. Let's say you have 4.
    # Tag each device in the editor and bind them here with @editable.
    @editable
    PlayerRefs : []player_reference_device = array{}

    # The Prop Mover device acting as our trap door.
    # Place this in the level editor and bind it here.
    @editable
    TrapDoor : prop_mover_device = prop_mover_device{}

    # OnBegin is the built-in Verse lifecycle function that runs when the
    # creative_device starts. It's like hitting "Start" on the console.
    OnBegin<override>()<suspends> : void =
        # 1. Get all current players in the game.
        # This is like the lobby populating with players.
        Players := GetPlayspace().GetPlayers()

        # 2. We need to match each player to a Player Reference.
        # Imagine you have 4 Player References bound via @editable above.
        # We'll loop through them and assign each player by index.

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