Hello! It looks like there's conflict between those two plugins.
Indeed, rpgmv crashes when you try to use the hook onto a spawned event spawned through YEP plugin.
It looks like the hook plugin can't retrieve the full list of events of the map after you spawn an event.
It won't work to just refresh the map, how can I solve this error?
Here is the involved code
Indeed, rpgmv crashes when you try to use the hook onto a spawned event spawned through YEP plugin.
It looks like the hook plugin can't retrieve the full list of events of the map after you spawn an event.
It won't work to just refresh the map, how can I solve this error?
Here is the involved code
Code:
// ------------------------------------------------------------------------
// judgement functions whether there is the picket/event or not
//
Game_Event._PICKET = 1;
Game_Event._INVOKE = 2;
Game_Event._FETCH = 3;
var _isPicketTileThere = function (x, y) {
var picketOk = !$gameSystem.hookRopePicketInvalid;
return picketOk && $gameSystem._isPicketTileImage($gameMap.tileId(x,y,1));
};
var _isHookRopeEventThere = function (x, y) {
var events = $gameMap.eventsXy(x, y);
for (var i = 0; i < events.length; i++) {
var event = events[i];
var pageOk = event._pageIndex >= 0;
var picketOk = !$gameSystem.hookRopePicketInvalid;
var isPicketImage = $gameSystem.isPicketImage(event.page().image);
if (pageOk && picketOk && isPicketImage){
return Game_Event._PICKET;
} else if (event._canInvoke()) {
return Game_Event._INVOKE;
} else if (event._canFetch()) {
return Game_Event._FETCH;
}
}
return 0;
};
var _hookRopeIdThere = function (x, y) {
var x = $gameMap.roundX(x);
var y = $gameMap.roundY(y);
var eventThere = _isHookRopeEventThere(x, y);
if (_isPicketTileThere(x, y) || eventThere === Game_Event._PICKET) {
return Game_Event._PICKET;
} else {
return eventThere;
}
};
// ------------------------------------------------------------------------
// checks whether there's any picket/event on the player's direction
//
var _dxFromDirection = function (d) {
return d === 6 ? 1 : d === 4 ? -1 : 0;
};
var _dyFromDirection = function (d) {
return d === 2 ? 1 : d === 8 ? -1 : 0;
};
var _directionToCoord = function (direction, distance) {
var x = $gamePlayer.x + _dxFromDirection(direction) * distance;
var y = $gamePlayer.y + _dyFromDirection(direction) * distance;
return {x:x, y:y};
};
var _isTileA3There = function (x, y) { // building or house
var tileId = $gameMap.tileId(x, y, 0);
return tileId >= 0x1100 && tileId <= 0x13DF;
};
var _isTileA4There = function (x, y) { // wall
var tileId = $gameMap.tileId(x, y, 0);
return tileId >= 0x1400 && tileId <= 0x1FDF;
};
var isPassableLowerTileThere = function (x, y) {
return !_isTileA3There(x, y) && !_isTileA4There(x, y);
};
var _checkIfWallOnTheRoute = function (type, direction) {
var maxLength = $gameSystem.hookRopeMaxLength;
for (var i = 1; i <= maxLength; i++) {
var coord = _directionToCoord(direction, i);
if (!isPassableLowerTileThere(coord.x, coord.y)) {
return {id:0, len:i - 1};
}
}
return {id:type, len:maxLength};
};
var distanceFromPlayerAndId = function (direction) {
var type, coord;
var maxLength = $gameSystem.hookRopeMaxLength;
if (!isFlexibleLength) {
coord = directionToCoord(direction, maxLength);
type = _hookRopeIdThere(coord.x, coord.y);
return _checkIfWallOnTheRoute(type, direction);
}
var lenToWall = _checkIfWallOnTheRoute(type, direction).len;
var len = Math.min(lenToWall, maxLength);
for (var i = 1; i <= len; i++) {
coord = _directionToCoord(direction, i);
if (type = _hookRopeIdThere(coord.x, coord.y)) {
return {id:type, len:i};
}
}
return {id:0, len:len};
};