Yanfly Event Click Trigger Plugin - Bug (and fix)

Per this thread it said to post bugs for Yanfly plugins here: https://forums.rpgmakerweb.com/inde...eport-bugs-relative-to-yanfly-plugins.100282/.

I found small bug in the click trigger plugin: http://www.yanfly.moe/wiki/Event_Click_Trigger_(YEP)

To reproduce:

Create a <Click Trigger> note in an event and then add a switch condition to the event page. I wanted this feature because I want some of my event to only become clickable after some game progress happens.

When you do this and click the event it crashes due detection of the x,y being good (which it is) and executing this code, which fails because up in rpg_objects.js it needs a valid _pageIndex but that is actually -1 (because switch condition wasn't met to select proper event page id, returning undefined list and throwing exception).

Game_Event.prototype.onMouseClickTrigger = function() {
if (this.isClickTriggered()) {
$gameTemp.clearDestination();
this.start();
}
};

Fix:

To fix for my game for now so I can move on, I updated plugin like so:

Game_Event.prototype.onMouseClickTrigger = function() {
if (this.isClickTriggered() && this._pageIndex !== -1) {
$gameTemp.clearDestination();
this.start();
}
};

This may not be the "right" fix but it does work, so feel free to fix it properly and I can update my plugin when you do.

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-event-click-trigger-plugin-bug-and-fix.114413/