# 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("MyGuard") # 2. Get the Leash Position device. # We assume you placed a device named "GuardLeashPoint". LeashPosition := World.GetDevice("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[] # 4. Apply the Leash! # We tell the Leashable interface to tie the Guard to the LeashPosition. # The second argument (15.0) is the radius in meters. # The guard will stay within 15 meters of the LeashPosition. Leashable.SetLeash(LeashPosition, 15.0)