Skip to content

Automatic Patrol Routes for NPCs

Notifications You must be signed in to change notification settings

Pantong51/Patrol

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Patrol

Before opening an issue read THIS

Automatic Patrol Routes for NPCs

Latest Release Download Count Forge Installs Foundry Core Compatible Version alt-text alt-text

Patrol Options:

  • Enable Random Patrol: If enabled the token will patrol randomly

THIS OPTION IS MUTUALLY EXCLUSIVE TO "Enable Path patrol"

  • Spot Player Characters: If enabled the token will spot player characters, pausing the game and panning on the token when spotting

WARNING Support for this feature outside dnd5e is not guaranteeed. If it's not working this is probably why.

  • Enable Path Patrol: If enabled the token will follow the given path/paths

THIS OPTION IS MUTUALLY EXCLUSIVE TO "Enable Random patrol"

  • Use Multiple paths: If enabled the token will use multiple paths

  • Patrol Path: The name of the path/s that the token will follow if patrolling paths

  • Path Node: The node of the path at which the token is currently on. This setting can be changed to start tokens mid-way through paths.

Alerting:

  • When a player is spotted a question mark will appear on top of the enemy token wich will then try to chase the intruder.
  • After a set time has passed the token will be spotted. You can configure sad time in the module settings. If the alert time is set to 0 the character will be immediately spotted

Custom Patrols

You can have a token patrol a specific area by drawing a Polygon or Rectangle (other shapes are not supported) and in it's text property call it "Patrol" (upper case P). Any token in that area will patrol only inside that area

You can also draw a Polygon or Rectangle, and in it's text property include the word "Path" (upper case P) to select the drawing as a path for patrolling tokens. You may add to the word, but it must include the word "Path" somewhere. (eg. GuardPathA, GuardPathB). A token set to patrol a path will reset back to the begginning of the path once it has finished unless "Use Multiple Paths" is checked.

The speed for tokens patrolling paths will be determined by the "Patrol speed for paths(ms)" module setting. This setting defines how long it will take every token patrolling a path to arrive at the next node. Thus, the actual animation speed will depend on the distance from the current node to the next one. This means that tokens can "speed up" mid path by drawing longer nodes or "slow down" by drawing shorter nodes.

Please ensure that only one of the patrol types is checked in the token config.

Single Path Use alt text

Using Multiple Paths

If the "Use Multiple Paths" checkbox is enabled in the token config, You can draw multiple paths with the same name. The token will randomly select one of the other paths with the same name when it has finished patrolling its current path. It will give preference to paths that are not currently being patrolled by any tokens.

It is often a good idea to hit the "Remap paths and Reset Nodes" button after making any changes to any paths or patrolling tokens. This will reset the token's path node to either 0, or to a random path and node within the group if the "Reset to Random Node" is checked.

Multiple Paths Use alt text

Auto Rotate

Patrol is compatible with the Auto Rotate module. Combine them for auto rotating patrols!

Patrol is not working!

If patrol is not working, check this steps before opening an issue:

  • If a token is selected it will stop patroling
  • If you create a combat encounter the patrol will stop
  • If you have the game paused, the patrol will stop
  • If you haven't toggled the patrol button the patrol will not start
  • If path patrol mode tokens will not spot players

Module\System\Macro Integration

You can use Patrol's hooks to enable additional features. Use the hooks:

  • "prePatrolSpotted", (spotter, spotted)
  • "patrolSpotted", (spotter, spotted)
  • "prePatrolAlerted", (spotter, spotted)
  • "patrolAlerted", (spotter, spotted)

Example:

Hooks.on("prePatrolSpotted", (spotter, spotted) => {
  // Only actually spotted if the Spotter has a higher passive perception than the target's DC
  return spotter.passivePerception >= spotted.passiveDC;
});
Hooks.on("patrolSpotted", (spotter, spotted) => {
  // Start a new combat if needed, then add the spotter to the spotted with a surprise round
});

Video Tutorial by Check the Rulebook

IMAGE ALT TEXT HERE

Patrol Toggle

alt text

Patrol Token Config

alt text

alt text

About

Automatic Patrol Routes for NPCs

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%