Patrol
Patrol enables NPCs to follow either random or fixed paths, with various settings for path routing and player spotting.
Getting Started
- Open a Token Configuration and check
Enable Patrolin thePatrolsection of theAppearancetab. - Click on the
Patrolbutton in the Token Scene Controls to toggle Patrolling. - Your Token should now patrol randomly around the scene. If you want you can stop here.
Add Regions into the mix
- Draw a
Regionand open its Configuration. - Go to the
Behaviorstab and add a newPatrol Areabehavior. - The Token you previously configured will now try to reach this Region and Patrol inside its area, as it's the only area it's allowed to patrol.
Patrolling along Region Edges
Patrol areas defined as Edges will limit the Tokens' patrolling to their perimeter.
- Open the Region Behavior Configuration and set
TypetoEdge. - The Token will now only patrol along the Region's perimeter.
Using multiple Regions
- Add a second
Regionand configure it as aPatrol Area. - The Token previously configured will now pick one of the two regions every time it has to choose a new path.
Using Whitelist/Blacklist
If you want your Token to patrol only inside a specific region, you can use Patrol Area Whitelist/Blacklist settings.
- Open one of your Regions' Behavior configuration
- Add a Token's name, ID or UUID to the the
Whitelist - If he can reach it, the Token will now only patrol inside this Region.
- You can add multiple similar Tokens using their
nameand exclude some of them by adding theirIDorUUIDto theBlacklist. - The
Blacklistalso prevents free-range Tokens (Tokens that did not find a target Region) to enter the Region.
Patrol Panel
You can open the Patrol Panel by Alt + Left Click on the Patrol button in the Token Scene Controls, or with the Patrol Panel button in the Actor Sidebar and in the module settings.
- Choose if you want to step a single Token or all Patrol Tokens with the buttons in the first group
- Manually step backward, forward or toggle
Auto Patrollingwith the buttons in the second group - Manual step buttons will also work during combat
Advanced
Next Destination Logic
Each time a Token reaches its destination or is manually moved, it chooses a new destination and builds a path towards it. Token will follow this logic:
- The Token will select a destination Region as follows:
- Only
Patrol AreasRegions are considered - Disabled
Patrol Areasare discarded - If Scene Darkness is outside
Patrol AreasDarkness limits, Region is discarded - If a Region has a
Whitelist, the Token must be in it - If a Region has a
Blacklist, the Token must not be in it - If the Token is part of at least one
Whitelist, only Regions that whitelist it are considered - The Token will then select a Region from the remaining ones:
- Closer Regions are preferred
- Regions with a higher
Weightare preferred
- Only
- The Token will choose a random destination point inside the selected Region (or along the Region's edge)
- If no Region is found, the Token will choose a random reachable point on the map
- Once a destination is chosen, the Token will build a path towards it following the shortest route
- Note: while Tokens will not choose a destination inside a Region they are
Blacklistedfrom, they can still route through it to reach their destination
Doors
Patrol Tokens can be allowed to open doors on their path. This can be configured in the Token Configuration or in the Region Behavior Configuration.
Leave Door Open setting is the chance that a door will be left open after the Token traverses it.
Spot
Tokens can be configured to spot player characters, pausing the game and focusing on the NPC when it spots a player. You can designate a Token as a Spotter in its Token Configuration. A Spotter will do the following:
- If a player character enters the Token's vision, the Token will stop and look around for a set amount of cycles (
Max Suspicious Cyclessetting) - If at the end of the
Suspiciousstage the Token still sees the player character it will enter theAlerted, otherwise it will go back toPatrolling. - When a Token is
Alerted, it will start following the player character. If the player character stays visible for a set amount of cycles (Max Alerted Cyclessetting) the player character will beSpottedand the game will pause. - If a
Spottersees anAlertedToken, it will beAlertedtoo. - If a Token reaches its destination while
AlertedwithoutSpottingthe player character, it will go back to beingSuspiciousand eventually toPatrolling.
Note: you can add the status Patrol - Undetectable to a Token to prevent it from being spotted.
Troubleshooting
If patrol is not working as expected, check the following:
- Ensure the Token is not selected, as selected Tokens will not patrol.
- If there's an Active Combat Auto Patrol will not run.
- If the game is paused patrols wil not run.
- Confirm the patrol button is toggled on.
- Remember that only player owned Tokens can be spotted.
Integrations
You can leverage Patrol's hooks to customize behavior.
For pre-hooks, returning false will cancel the state transition. This is useful if you want to prevent a token from becoming suspicious, alerted or spot a player character.
Available hooks include:
"prePatrolSuspicious", (spotter, spotted) => boolean"patrolSuspicious", (spotter, spotted)"prePatrolAlerted", (spotter, spotted) => boolean"patrolAlerted", (spotter, spotted)"prePatrolSpotted", (spotter, spotted) => boolean"patrolSpotted", (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
});Legacy Documentation
If your Patrol Version is less than 5.0.0 you can find the legacy documentation here: Legacy Patrol