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(): 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!")