I've created a plugin, which is compatible with both MV and MZ, that enables you to create trigger zones using a single event rather than having to duplicate a bunch of events in order to achieve the same effect, this is useful for things like map transfers, interact-able counters, and cutscene triggers.
I've implemented it using the Event's note field to smuggle JSON into the plugin to be parsed with a very simple structure:
JSON:
{
"extentX": 2,
"extentY": 2,
"triggerOnce":true
}
复制代码
The extents are defined in tiles defining a rectangle that radiates out from the event's position (the event is the center), the way the trigger's area is calculated favors growing up-left first, so a 2x2 event will end with the event being in the bottom-right, while a 4x4 will have the event in the center, this allows you to create trigger volumes in a very predictable way that is easy to calculate, simply count the tiles to either side of the event you wish to use as the center.
I've released the code under the MIT license so you are free to use it how you wish, even commercially, just make sure to attribute me in some fashion
JavaScript:
/*:
* @target MZ
* @target MV
* @plugindesc Allows events to be defined as a rectangle with extents relative to the event's tile position
* @author Phillip "Antidote" Stephens
*
* @license MIT
* @help AntiTriggerRectEvent.js
*
* This plugin enables the ability to create an arbitrary rectangle from an event's position
* the extents are defined as the total number of tiles surrounding the event.
*
* To define a rectangle simply add this following JSON struct with the extentX/extentY values changed for the desired