- Joined
- Aug 15, 2017
- Messages
- 17
- Reaction score
- 2
- First Language
- English
- Primarily Uses
- RMMV
Hi guys,
I'm using the QABS suite of plugins: https://forums.rpgmakerweb.com/index.php?threads/qplugins-latest-qabs.73023/
Trying to figure out how to make it so that when an event with the <enemy:X> notetag returns to its original x and y when it can't find the player, that it then ignores other event colliders with a sprite that would be in the way of the path. By default it works when the door event doesn't have a sprite attached. But then when I put the door sprite on it blocks the path.
Not sure if anyone has much experience/knowledge with these plugins but the developer said I would need to edit somewhere in the below code.
I'm using the QABS suite of plugins: https://forums.rpgmakerweb.com/index.php?threads/qplugins-latest-qabs.73023/
Trying to figure out how to make it so that when an event with the <enemy:X> notetag returns to its original x and y when it can't find the player, that it then ignores other event colliders with a sprite that would be in the way of the path. By default it works when the door event doesn't have a sprite attached. But then when I put the door sprite on it blocks the path.
Not sure if anyone has much experience/knowledge with these plugins but the developer said I would need to edit somewhere in the below code.
Code:
Game_Event.prototype.findRespawnLocation = function() {
var x = this.event().x * QMovement.tileSize;
var y = this.event().y * QMovement.tileSize;
if (this.canPixelPass(x, y, 5)) {
this.setPixelPosition(x, y);
this.straighten();
this.refreshBushDepth();
return;
}
var dist = Math.min(this.collider('collision').width, this.collider('collision').height);
dist = Math.max(dist / 2, this.moveTiles());
var open = [x + ',' + y];
var closed = [];
var current;
var x2;
var y2;
while (open.length) {
current = open.shift();
closed.push(current);
current = current.split(',').map(Number);
var passed;
for (var i = 1; i < 5; i++) {
var dir = i * 2;
x2 = Math.round($gameMap.roundPXWithDirection(current[0], dir, dist));
y2 = Math.round($gameMap.roundPYWithDirection(current[1], dir, dist));
if (this.canPixelPass(x2, y2, 5)) {
passed = true;
break;
}
var key = x2 + ',' + y2;
if (!closed.contains(key) && !open.contains(key)) {
open.push(key);
}
}
if (passed) break;
}
this.setPixelPosition(x2, y2);
this.straighten();
this.refreshBushDepth();
};
