I've found a problem with this script. It works amazingly in most cases, however if you have a tile that is passable in at least one direction, but not all four, sometimes when pathfinding it's possible for events to get stuck trying to move into a tile that is not passable in a certain direction.
I've got a lot of these types of tiles, mainly for decoration (bar stools you can move behind but but not through them, for example) and a lot of my NPCs get stuck.
There even seems to be a check in place for this, as the script DOES account for direction. (See lines 395 and 407.)
passable = char.passable?(key[0], key[1], dir[0]*2)
I don't really understand how this script works, so I have no idea how to fix this...