I'd like to write a script that checks if the region id of the tile directly in front of an event is higher than the region id of the tile 2 tiles in front of that event.
This is what I came up with (inside a conditional branch script, not pure script):
var d = $gameMap.event(this.eventId()).direction();
var x1 = $gameMap.roundXWithDirection($gameMap.event(this.eventId()).x, d);
var y1 = $gameMap.roundYWithDirection($gameMap.event(this.eventId()).y, d);
var x2 = $gameMap.roundXWithDirection(x1, d);
var y2 = $gameMap.roundYWithDirection(y1, d);
$gameMap.regionId(x1, y1) > $gameMap.regionId(x2, y2)
It doesn't seem to work however, so I'm wondering if I'm doing something wrong? the same script did work when I only checked the tile in front so I was hoping this is possible too.
This is what I came up with (inside a conditional branch script, not pure script):
var d = $gameMap.event(this.eventId()).direction();
var x1 = $gameMap.roundXWithDirection($gameMap.event(this.eventId()).x, d);
var y1 = $gameMap.roundYWithDirection($gameMap.event(this.eventId()).y, d);
var x2 = $gameMap.roundXWithDirection(x1, d);
var y2 = $gameMap.roundYWithDirection(y1, d);
$gameMap.regionId(x1, y1) > $gameMap.regionId(x2, y2)
It doesn't seem to work however, so I'm wondering if I'm doing something wrong? the same script did work when I only checked the tile in front so I was hoping this is possible too.