The Bouncer’s Blueprint: Building an AI Patrol Path in Verse
Tutorial beginner

The Bouncer’s Blueprint: Building an AI Patrol Path in Verse

Updated beginner

The Bouncer’s Blueprint: Building an AI Patrol Path in Verse

Imagine you’re hosting a party. You don’t want your bouncer standing frozen in the lobby like a statue, right? You want him walking back and forth, scanning the crowd, ready to kick out anyone who causes trouble. In Fortnite Creative, that’s what an AI Patrol Path does. It turns a static Guard Spawner into a roaming sentry.

In this tutorial, we’re going to build a "Do Not Enter" zone guarded by a patrolling AI. We’ll use Verse to link up the Guard Spawner and the Patrol Path Nodes, ensuring the guard actually knows where to walk. By the end, you’ll have a functional security system that’s smarter than most players’ building strategies.

What You'll Learn

  • The Scene Graph Hierarchy: How devices talk to each other using "Groups" (like team colors).
  • Patrol Paths: Connecting dots to create a walking route for AI.
  • Guard Spawners: Configuring the "bouncer" to follow specific rules.
  • Verse Basics: Writing a simple script to initialize the patrol logic.

How It Works

Think of your island as a stage. The Scene Graph is the list of actors and props on that stage. In Verse, we don’t just throw actors onto the stage randomly; we assign them roles and connections.

Here’s the game-mechanic analogy:

  • The Guard Spawner is the locker room. It holds the guard (the actor) until they are needed.
  • The AI Patrol Path Node is the chalk outline on the floor. It marks the spots where the guard must walk.
  • The Patrol Path Group is the team jersey color. If the Guard Spawner is wearing "Red Jersey" (Group 1) and the chalk outlines are also "Red Jersey" (Group 1), the guard knows those chalk lines are his route. If the chalk is "Blue Jersey," the guard ignores it and wanders off into the void (or gets stuck).

In older Creative tools, you had to manually link these. In Verse, we use a custom device to manage this connection cleanly, ensuring that when the game starts, the guard spawns and immediately knows his route.

Let's Build It

We will create a Verse script that acts as the "Manager." This script will hold references to your Guard Spawner and your Patrol Path Nodes. When the island loads, it tells the Guard: "Hey, use this path."

Step 1: Place Your Devices

  1. Open the Devices menu.
  2. Place a Guard Spawner.
  3. Place an AI Patrol Path Node device.
  4. (Optional) Add more AI Patrol Path Nodes to create a route.

Step 2: Configure the Devices

For the Guard Spawner:

  • Set Number of Guards to 1.
  • Set Total Spawn Limit to 1 (so it doesn’t spawn an army).
  • Crucial Step: Find the option Spawn On Patrol Path. Set this to Group 1.

For the AI Patrol Path Node(s):

  • Select all your AI Patrol Path Nodes.
  • Find the option Patrol Path Group. Set this to Group 1.
  • Note: Make sure the nodes are placed in the order you want the guard to walk. The device connects them visually with a line.

Step 3: Write the Verse Script

We need a Verse script to tie these together. Create a new Verse file in your project folder.

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).
            
            # For this tutorial, we simply confirm the setup is valid.
            # If the Group IDs match (both Group 1), the AI engine 
            # automatically links them. This script acts as the "glue" 
            # that validates the connection exists.
            
            print("Security system active. Guard is patrolling Group 1.")
            
        else:
            print("Error: Guard or Patrol Path not assigned!")

Walkthrough of the Code

  1. using { ... }: These are your imports. Think of them as picking up tools from the toolbox. We need AI tools, Device tools, and Simulation tools.
  2. PatrolManager := class(creative_device):: This defines our new device. It’s a blueprint for a device that will sit on your map.
  3. @editable: This tag is huge. It means "Hey UEFN, show this variable in the properties panel so I can drag my devices here." Without this, the script is blind.
  4. GuardSpawner: guard_spawner_device: This variable holds the reference to the actual Guard Spawner device you placed in the level.
  5. OnBegin: This is an event. In Fortnite, the game starts when the Battle Bus launches. OnBegin is the trigger that fires at that exact moment.
  6. if (GuardSpawner.IsSet()...): This is a conditional check. It’s like checking if your shield is up before you engage. If the devices are linked in the editor, IsSet() returns true.

Try It Yourself

Challenge: Create a "Revenge Trap" patrol.

  1. Place two Guard Spawners.
  2. Create a square patrol path using 4 AI Patrol Path Nodes.
  3. Assign Spawner A to Group 1 and Spawner B to Group 2.
  4. Make half the nodes Group 1 and the other half Group 2.
  5. Play the island.

Hint: Watch which guard goes where. If they cross over, check your Patrol Path Group settings. Did you accidentally set all nodes to Group 1?

Recap

  • Patrol Paths are routes defined by AI Patrol Path Nodes.
  • Group IDs are the link between the Guard Spawner and the Path. They must match.
  • Verse allows you to manage these connections programmatically, giving you control over when and how the patrol starts.
  • Always verify your Scene Graph connections by checking the device properties in UEFN.

References

  • https://dev.epicgames.com/community/snippets/xKa8/fortnite-ai-patrol-path-controller
  • https://dev.epicgames.com/documentation/en-us/fortnite/ai-patrol-path-node-device
  • https://dev.epicgames.com/documentation/en-us/uefn/verse-stronghold-template-2-add-leashes-in-unreal-editor-for-fortnite
  • https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-ai-patrol-path-node-devices-in-fortnite-creative
  • https://dev.epicgames.com/documentation/en-us/fortnite/using-ai-patrol-path-node-devices-in-fortnite-creative

Verse source files

Turn this into a guided course

Add fortnite-patrol-path-manager-v2 to your free study plan — we'll suggest related pages and stitch the lot into one compile-checked, self-guided lesson with worked examples and quizzes.

Original tutorial generated by Verse Island from the Verse/UEFN knowledge base, with references to the Epic Games sources above. Code is validated against the knowledge base.

Comments

    Sign in to vote, comment, or suggest an edit. Sign in