Patrol

Patrol

Free
Version: V14
FVTT: V14
Any System
Download
Changelog

    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 Patrol in the Patrol section of the Appearance tab.
    • Click on the Patrol button 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 Region and open its Configuration.
    • Go to the Behaviors tab and add a new Patrol Area behavior.
    • 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 Type to Edge.
    • The Token will now only patrol along the Region's perimeter.

    Using multiple Regions

    • Add a second Region and configure it as a Patrol 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 name and exclude some of them by adding their ID or UUID to the Blacklist.
    • The Blacklist also 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 Patrolling with 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 Areas Regions are considered
      • Disabled Patrol Areas are discarded
      • If Scene Darkness is outside Patrol Areas Darkness 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 Weight are preferred
    • 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 Blacklisted from, 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 Cycles setting)
    • If at the end of the Suspicious stage the Token still sees the player character it will enter the Alerted, otherwise it will go back to Patrolling.
    • 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 Cycles setting) the player character will be Spotted and the game will pause.
    • If a Spotter sees an Alerted Token, it will be Alerted too.
    • If a Token reaches its destination while Alerted without Spotting the player character, it will go back to being Suspicious and eventually to Patrolling.

    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