Verse Library verse

01 Device

Links a guard spawner to an AI patrol path node on game start to manage NPC patrol routes.

verse-library/fortnite-patrol-path-manager-v2/01-device.verse

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

# This is our "Manager" device. It lives in the scene graph.
# Think of it as the stage manager holding the clipboard.
PatrolManager := class(creative_device):
    
    # These are "editables." They appear in the device properties panel.
    # You drag-and-drop your placed devices into these slots in UEFN.
    @editable
    GuardSpawner: guard_spawner_device = guard_spawner_device{}
    
    @editable
    PatrolPath: ai_patrol_path_node_device = ai_patrol_path_node_device{}
    
    # This function runs when the game starts (the "Bus" lands).
    OnBegin<override>()<suspends>: void = 
        # Check if we actually have devices assigned (not empty)
        if (GuardSpawner.IsSet() && PatrolPath.IsSet()):
            
            # This is the magic line.
            # We are telling the Guard Spawner to use the specific Path Node.
            # In the editor, you just set "Spawn On Patrol Path" to Group 1,
            # but this script ensures the link is active and ready.
            
            # Note: In modern UEFN, often just setting the Group IDs in the 
            # editor is enough for basic paths. However, this script structure 
            # allows for advanced logic later (like changing paths dynamically).

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