# Source URL: https://dev.epicgames.com/documentation/en-us/uefn/stronghold-04-set-up-leash-devices-in-unreal-editor-for-fortnite
# Local doc: epic-docs/documentation/en-us/uefn/stronghold-04-set-up-leash-devices-in-unreal-editor-for-fortnite.md
using { /Fortnite.com/AI }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Devices }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Verse.org/Random }
using { /Verse.org/Simulation }
# Defines a leash volume that can be assigned to guards
stronghold_leash_position := class(creative_device):
# Leash is applied by default to all guards spawned by those devices
@editable
GuardsSpawners:[]guard_spawner_device := array{}
# Guards on those patrol paths can go outside the leash (only one device per path)
@editable
PatrolPaths:[]ai_patrol_path_device := array{}
# Set the leash inner radius. This value must be in centimeters.
# This defines the volume that must be reached when this leash is assigned to guards
@editable
LeashInnerRadius<private>:float = 2300.0
# Set the leash outer radius. This value must be in centimeters
# This defines the volume in which guards must stay in when this leash is assigned
@editable
LeashOuterRadius<private>:float = 2400.0
# List of guards currently assigned to this leash
var<private> Guards : []agent = array{}
OnBegin<override>()<suspends>:void=
for (GuardSpawner : GuardsSpawners):
GuardSpawner.SpawnedEvent.Subscribe(ApplyLeashOnGuard)
for (PatrolPath : PatrolPaths):
Verse Library
verse
01 Snippet
Implements a custom Creative device to define patrol leash volumes for AI guards.
extracted-snippets/documentation/en-us/uefn/stronghold-04-set-up-leash-devices-in-unreal-editor-for-fortnite/01-snippet.verse
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.