Hello everyone, I'm trying to check in a common event if any event of the current map is at the same coordinates of the player. The code should work for every event of the map, checking each one, and it should work in every map. It's on a common event.
Tried this, but doesn't work.
Then I check if switch [1] is true. Any help?
Tried this, but doesn't work.
Code:
for (let i = 1; i <= $gameMap.events().length; i++) {
if ($gameMap.event(i) {
let PlayerX = $game_player.x
let PlayerY = $game_player.y
let eventX = $gameMap.event($gameMap.event(i)).x;
let eventY = $gameMap.event($gameMap.event(i)).y;
if (Math.abs(PlayerX-eventX) = 0 && Math.abs(PlayerY-eventY) = 0) {
$gameSwitches.setValue[1] == true;
}
}
}
Then I check if switch [1] is true. Any help?