So I'm trying to really wrap my mind around how to make Galv's Action Indicator script detect the player regardless of what direction they're facing. This is an issue I've seen multiple people face (because they want to put this plugin in their game) but nobody's gotten an answer yet, so I've been trying to break the ice.
The closest I've gotten was this $gamePlayer.reverseDir code that makes it so the button pops up when the player is facing away from the event, but not to the left or right. I'd also like to extend the range of the detection to be 2 tiles instead of directly in front of the event.
(I'm also aware of Moghunter's Event Indicators, which for various reasons - primarily the fact it doesn't use icons - doesn't work for me.)
JavaScript:
var x2 = $gameMap.roundXWithDirection($gamePlayer._x, $gamePlayer._direction);
var y2 = $gameMap.roundYWithDirection($gamePlayer._y, $gamePlayer._direction);
var x4 = $gameMap.roundXWithDirection($gamePlayer._x, $gamePlayer.reverseDir($gamePlayer.direction()));
var y4 = $gameMap.roundYWithDirection($gamePlayer._y, $gamePlayer.reverseDir($gamePlayer.direction()));
var action = null;
// CHECK EVENT IN FRONT
if (!action) {
$gameMap.eventsXy(x2, y2).forEach(function(event) {
if (event.isNormalPriority()) {
action = Galv.AI.checkEventForIcon(event);
};
});
$gameMap.eventsXy(x4, y4).forEach(function(event) {
if (event.isNormalPriority()) {
action = Galv.AI.checkEventForIcon(event);
};
});
};
The closest I've gotten was this $gamePlayer.reverseDir code that makes it so the button pops up when the player is facing away from the event, but not to the left or right. I'd also like to extend the range of the detection to be 2 tiles instead of directly in front of the event.
(I'm also aware of Moghunter's Event Indicators, which for various reasons - primarily the fact it doesn't use icons - doesn't work for me.)