I've got two plugins that introduce some logic to the canPass function for events. Because Game_Event doesn't have its own canPass function, each plugin creates the function, and does a Game_CharacterBase.prototype.canPass.call(). Unfortunately this means, because I don't have a Game_Event.canPass to alias, that only the plugin at the bottom of the list is working - the Game_Event.canPass() function on the earlier plugin never gets called.
Original function in rpg_objects.js:
Code from plugin 1 (to make the player move in sync with an event):
Code from plugin 2 (to make an event move only within a certain range):
I need a way for the plugins to call other versions of Game_Event.canPass, and if no other versions can be found, to THEN call Game_CharacterBase.canPass. Does anyone know how to do this?
Original function in rpg_objects.js:
Code:
Game_CharacterBase.prototype.canPass = function(x, y, d) {
var x2 = $gameMap.roundXWithDirection(x, d);
var y2 = $gameMap.roundYWithDirection(y, d);
if (!$gameMap.isValid(x2, y2)) {
return false;
}
if (this.isThrough() || this.isDebugThrough()) {
return true;
}
if (!this.isMapPassable(x, y, d)) {
return false;
}
if (this.isCollidedWithCharacters(x2, y2)) {
return false;
}
return true;
};
Code from plugin 1 (to make the player move in sync with an event):
Code:
Game_Event.prototype.canPass = function(x, y, d) {
return $gamePlayer.isSyncedWith(this._eventId) || this._playerSync ||
Game_CharacterBase.prototype.canPass.call(this, x, y, d);
};
Code from plugin 2 (to make an event move only within a certain range):
Code:
Game_Event.prototype.canPass = function(x, y, d) {
var x2 = $gameMap.roundXWithDirection(x, d);
var y2 = $gameMap.roundYWithDirection(y, d);
return Game_CharacterBase.prototype.canPass.call(this, x, y, d) &&
x2 >= this._tlx && x2 <= this._brx && y2 >= this._tly && y2 <= this._bry;
};
I need a way for the plugins to call other versions of Game_Event.canPass, and if no other versions can be found, to THEN call Game_CharacterBase.canPass. Does anyone know how to do this?