Patrol paths let Citizens walk a fixed route through the world, visiting a sequence of waypoints in order. Patrols are defined independently of any Citizen — you create a named path with the Patrol Stick tool, then assign that name to one or more Citizens. Citizens can loop the path continuously or reverse direction at the end, and each waypoint can include a configurable pause.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ElectroGamesDev/HyCitizens/llms.txt
Use this file to discover all available pages before exploring further.
How Patrols Work
APatrolPath consists of a name, a loop mode, and an ordered list of PatrolWaypoint objects. A Citizen begins patrolling when:
- Its
movementBehavior.typeis set toPATROL, and pathConfig.pluginPatrolPathcontains the name of a saved patrol path.
If the patrol path name set on a Citizen does not match any saved path, the Citizen will stand idle. Double-check that the name in
pathConfig.pluginPatrolPath matches the path name exactly, including capitalization.PathConfig Fields
ThepathConfig block on a Citizen controls how it interacts with the patrol system:
The name of the patrol path this Citizen should follow. Must match the name of a saved
PatrolPath exactly.Movement speed used while walking the patrol route. Minimum value is
0.1. This is a relative speed multiplier applied to the Citizen’s walk speed.How the Citizen behaves when it reaches the last waypoint. See Loop Modes below.
Internal field used by the NPC role system. HyCitizens manages this automatically when
movementBehavior.type is PATROL.Internal field used by the NPC role system. Managed automatically by HyCitizens.
How far the Citizen may wander from the patrol path during break phases (used by the underlying Hytale patrol state machine).
Loop Modes
LOOP — Continuous forward loop
LOOP — Continuous forward loop
The Citizen walks from the first waypoint to the last. After reaching the last waypoint, it returns to the first waypoint and repeats the route indefinitely.
PING_PONG — Forward then reverse
PING_PONG — Forward then reverse
The Citizen walks from the first waypoint to the last, then reverses direction and walks back to the first waypoint. This back-and-forth cycle repeats indefinitely. Useful for guard patrols that cover a linear stretch.
PatrolWaypoint Fields
Each waypoint in a patrol path has the following properties:| Field | Type | Description |
|---|---|---|
x | double | World X coordinate of the waypoint. |
y | double | World Y coordinate of the waypoint. |
z | double | World Z coordinate of the waypoint. |
pauseSeconds | float | How long the Citizen pauses at this waypoint before continuing. Set to 0 for no pause. |
Creating a Patrol Path with the Patrol Stick
The recommended way to create patrol paths in-game is with the Patrol Stick tool provided by HyCitizens.Obtain the Patrol Stick
Use the HyCitizens admin command to receive the Patrol Stick item. Once held, it enters patrol path editing mode.
Place waypoints
Walk to each location where you want a waypoint and right-click to place a marker. Waypoints are recorded in the order you place them. Repeat for every stop on the route.
Name and save the path
Enter a unique name for the patrol path when prompted. The path is saved to disk and immediately available to all Citizens.
Starting and Stopping Patrols via the API
Patrols can also be controlled programmatically through the HyCitizens API. ThePatrolManager exposes methods to start, stop, and query patrol state for any Citizen at runtime. For full details, see the Patrol Manager API reference.