First, about npc directions
Facing is a direction the NPC sprite will face in. Not all NPC sprites
have different images depending on the direction you look from, so for
some facing will be meaningless. Facings are counted counterclockwise in
increments of 45 degrees, where 0 means facing towards the top of the map.
(So to turn the sprite towards the bottom of the map, you use facing 4,
and to make it look southeast it's facing 5.)
*setnpcdir({<name>, }<direction>
Set npc direction. If npc name missing, will be used attached npc.
Example:
setnpcdir(DIR_WEST);
or
*movenpc("<NPC name>", <x>, <y>{, <dir>})
This command looks like the npcwalktoxy function, but is a little different.
While npcwalktoxy just makes the NPC 'walk' to the coordinates given
(which sometimes gives problems if the path isn't a straight line without
objects), this command just moves the NPC. It basically warps out and in
on the current and given spot. Direction can be used to change the NPC's
facing direction.
Example:
// This will move Bugga from to the coordinates 100,20 (if those
// coordinates are legit).
movenpc("Bugga", 100, 20);
One will probably need to decide what direction npc should be facing. If thats the last invoking npc direction, fetching the coordinates and deciding by math on coordinates or other way how to do it.