Patrol
Patrol allows for the automatic movement of NPCs along predefined or random routes, with customization options for path settings and spotting behaviors.
Overview
Patrol enables NPCs to follow either random or fixed paths, with various settings for path routing, player spotting, and patrol speed.
Patrol Settings
Random Patrol
"Enable Random Patrol" is mutually exclusive with "Enable Path Patrol" and does not support hex grids.
When enabled, the token patrols randomly. It will not follow a predefined path but rather move unpredictably within its assigned area. Polygons or rectangles used as random patrol areas must have the word "Patrol" in the text property exactly.
Player Spotting (Random Patrol Only)
Enabling this option allows the NPC to spot player characters, pausing the game and focusing on the NPC when it spots a player. This option only works with Random Patrol.
Spotting works only with Random Patrol. It is not supported in Path Patrol mode.
Path Patrol
If enabled, the token will follow a designated path or set of paths. This option is incompatible with Random Patrol. Polygons used as paths, must contain the word "Path" in the text property.
- Use Multiple Paths: Enables the token to switch between multiple predefined paths.
- Patrol Path: Specify the name(s) of the paths the token will follow.
- Path Node: Sets the current node in the path. Adjusting this allows the token to start mid-path if desired.
Alerting
When a player character is spotted, an alert will trigger, displaying a question mark on the enemy token. The NPC will attempt to chase the intruder. The alert duration can be adjusted in the module settings, where an alert time of 0 will result in immediate spotting.
Custom Patrols
Tokens can be set to patrol within a specific area by drawing a polygon or rectangle and naming it "Patrol" in the text property. The NPC will then only patrol within this area.
For path-based patrols, draw a polygon or rectangle and include the word "Path" (e.g., "GuardPathA") in the text property. The NPC will return to the start of the path once completed unless "Use Multiple Paths" is enabled.
Patrol speed depends on the "Patrol speed for paths (ms)" setting, which determines how long it takes to reach each node in the path.
Note: Only one patrol type should be enabled in the token configuration.
Using Multiple Paths
With "Use Multiple Paths" enabled, tokens can alternate between multiple paths with the same name. The token will prioritize paths that are not currently being patrolled.
After modifying paths or patrolling tokens, it is recommended to use the "Remap paths and Reset Nodes" button to reset the path node.
Auto Rotate Compatibility
Patrol integrates with the Auto Rotate module, allowing for auto-rotating patrols.
Troubleshooting
If patrol is not working as expected, check the following:
- Ensure no token is selected, as this stops patrolling.
- Combat encounters will pause patrols.
- The game must be unpaused for patrols to run.
- Confirm the patrol button is toggled on.
- Player spotting does not work with Path Patrol.
Integrations
You can leverage Patrol's hooks to customize behavior. Available hooks include:
"prePatrolSpotted", (spotter, spotted)
"patrolSpotted", (spotter, spotted)
"prePatrolAlerted", (spotter, spotted)
"patrolAlerted", (spotter, spotted)
Example Usage:
Hooks.on('prePatrolSpotted', (spotter, spotted) => {
return spotter.passivePerception >= spotted.passiveDC;
});
Hooks.on('patrolSpotted', (spotter, spotted) => {
// Start combat or add the spotter to the spotted with a surprise round
});