Verse Library verse

01 Standalone

Ties a guard NPC to a specific position using leash devices for controlled patrol or guarding.

verse-library/fortnite-20-guards-following-player-using-leash/01-standalone.verse

# Import the necessary Verse modules for devices and NPCs
using /Fortnite.com/Devices
using /Verse.org/Simulation
using /Fortnite.com

# This is our main script class. It's like the "Game Mode" for this specific interaction.
script GuardLeashScript() implements IInitializable:

    # VARIABLES: These are our "inventory slots" for references.
    # We don't know the values yet, just that we need slots for them.
    Guard := struct{}
    LeashPosition := struct{}

    # INITIALIZE: This function runs ONCE when the game starts.
    # Think of this as the "Loadout Screen" before the match begins.
    Initialize(): void = block:
        # 1. Get the Guard NPC from the editor.
        # We assume you placed a device named "MyGuard" in the level.
        # If you didn't name it that, change "MyGuard" to your device's name.
        Guard := World.GetDevice<GuardDevice>("MyGuard")

        # 2. Get the Leash Position device.
        # We assume you placed a device named "GuardLeashPoint".
        LeashPosition := World.GetDevice<LeashPositionDevice>("GuardLeashPoint")

        # 3. Get the Leash Interface from the Guard.
        # This is like checking if the Guard has the "Leashable" trait.
        # If the Guard isn't a Guard-type NPC, this might fail or return empty.
        Leashable := Guard.GetFortLeashable[]

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