An NPC can move anywhere within a map, but not outside of it -- you need duplicates for that.
// Generic 'movenpc' command.
movenpc strnpcinfo(0),x,y;
// Script command.
{ getmapxy(.@map$,.@x,.@y,0); if (.@map$ == "your_map") movenpc "NPC Name",.@x,.@y; }
// Store NPC location permanently.
getmapxy(.@map$,.@x,.@y,1);
set $move_npc_loc$, .@map$+"|"+.@x+"|"+.@y;
end;
// Load NPC location OnInit.
OnInit:
if ($move_npc_loc$ != "") {
explode(.@loc$,$move_npc_loc$,"|")
movenpc strnpcinfo(0),.@loc$[0],atoi(.@loc$[1]),atoi(.@loc$[2]);
}