A downloadable asset pack

Download NowName your own price

Advanced NPC Stealth & Patrol System for RPG Maker MZ

HI EVERYONE!!!

I created this plugin while working on a personal project using RPG Maker MZ. I found that the default pathing and battle logic were quite cumbersome, and most of the available plugins that could help were just too expensive. So, with some spare time and a tight budget, I decided to build my own solution.

This is my first plugin, so I’d love to hear your feedback. All comments are welcome!

I’ll do my best to keep improving it over time.

Features

  • Path Patrolling: NPCs seamlessly patrol routes you define using Region IDs. They will loop through all tiles marked with the specified IDs, starting and ending at their initial position.
  • Line of Sight Vision: NPCs detect the player only if they are within their frontal vision cone and range, with no obstacles (marked by a specific Region ID) blocking their sight.
  • Automatic Chase: Upon spotting the player, NPCs will interrupt their patrol, adjust their speed (configurable), and pursue the player until they are caught or the player breaks line of sight and evades them.
  • Dynamic Battle Outcomes:
    • Ambush (Surprise Attack): If an NPC catches the player from behind, the enemy party gets the first turn.
    • Preemptive Strike: If the player successfully approaches an unaware NPC and initiates contact, the player's party gets the first turn.
    • Normal Battle: Standard encounter initiation.
  • Configurable NPC Behavior: Easily set up each NPC's parameters via a Plugin Command, including patrol regions, vision range, chase speed, chase memory duration, and more.
  • Battle Customization: Define the troop ID for battles, whether the player can escape, and if the player can lose the battle (triggering a common event on loss instead of a game over).
  • Post-Battle Self Switches: Automatically turn ON Self Switches (A, B, C, or D) based on whether the player wins, loses, or escapes the battle, allowing for easy event page progression.

How to Use

  1. Download the YourPluginFileName.js file.
  2. Place it in your RPG Maker MZ project's js/plugins/ folder.
  3. Open the Plugin Manager in RPG Maker MZ, add the plugin, and turn it ON.
  4. For any event you want to use this system with:
    • Set the event's Trigger to Parallel Process.
    • On the event's page, add the Plugin Command "Setup NPC Patrol/Stealth".
    • Configure the parameters within the Plugin Command to define the NPC's specific behavior.

Global Plugin Parameter:

  • Vision Blocking Region ID: Set this once in the Plugin Manager parameters. This Region ID will act as a wall, blocking NPC line of sight.

License

  • This plugin can be used in non-commercial projects. (But in future updates this may change)
  • Credit to https://mollock.itch.io/ is strictly required.
  • You are not allowed to redistribute this plugin file directly. Please link to this itch.io page.

Support & Feedback

If you have any questions, encounter issues, or have feedback, please leave a comment below or reach out via itch.io project page.


Changelog

All notable changes to the Aris NPC Stealth & Patrol System will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[1.1.0] - 2025-05-25

Added

  • Chase Mode Sprite System: NPCs can now change their appearance when entering chase mode
    • New parameter: Chase Mode Sprite - Specify a different character sprite for chase mode
    • New parameter: Chase Sprite Index - Select which character index to use in the sprite sheet
    • Sprites automatically revert to original when chase ends
  • Improved patrol return logic: NPCs now intelligently find the nearest patrol node when returning from a chase, preventing awkward pathfinding

Changed

  • Battle mechanics: Players can no longer initiate preemptive strikes against NPCs that are actively chasing them
    • This makes the stealth system more realistic and balanced
    • Ambush attacks by NPCs and normal battles still function as before

Fixed

  • NPCs now properly return to their patrol routes after losing the player
  • Improved state management when transitioning between chase and patrol modes

Technical

  • Refactored code structure for better maintainability
  • Optimized performance with better state management
  • Added proper sprite restoration handling

[1.0.1] - 2025-05-25

Fixed

  • Minor bug fixes and stability improvements
  • Improved error handling for edge cases

[1.0.0] - 2025-05-18

Added

  • Initial Release of Aris NPC Stealth & Patrol System
  • Patrol System: NPCs can follow predefined paths using Region IDs
    • Nearest-neighbor pathfinding algorithm
    • Automatic path looping
    • Smart path recovery when stuck
  • Vision System: NPCs detect players within their line of sight
    • Configurable vision range
    • Frontal vision cone (~90 degrees)
    • Line of sight blocking via Region IDs
  • Chase Mechanics: NPCs pursue players when spotted
    • Configurable chase speed
    • Chase memory (continues searching after losing sight)
    • Last known position tracking
  • Battle System Integration:
    • Preemptive Strikes: Player attacks first when approaching unaware NPCs
    • Ambush Attacks: NPCs attack first when approaching player from behind
    • Normal Battles: Standard encounters when both are aware
  • Battle Outcomes: Self-switches can be set based on battle results
    • Win, Lose, and Escape outcomes
    • Optional "Allow Player to Lose" mode with Common Event support
  • Flexible Configuration: All behaviors configurable per NPC via plugin commands
    • Enable/disable individual features
    • Customize speeds, ranges, and durations
    • Specify battle troops and escape options

Technical

  • Compatible with RPG Maker MZ
  • Optimized for parallel process events
  • Safe to call setup command multiple times
  • Automatic cleanup on page changes

Legend

  • Added: New features
  • Changed: Changes in existing functionality
  • Deprecated: Soon-to-be removed features
  • Removed: Removed features
  • Fixed: Bug fixes
  • Security: Vulnerability fixes
  • Technical: Internal improvements

Download

Download NowName your own price

Click download now to get access to the following files:

README.md 18 kB
Aris_StealthPatrol.js 32 kB