NPC Stalker

What it does
Put this little script in the OnHeartbeat of an NPC character, and you have a really annoying NPC that will literally (try to) follow at your heels!

The Script
void main {  object oTarget = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC); ClearAllActions; object oArea = GetArea(oTarget); vector vPosition = GetPosition(oTarget); float fOrientation = CorrectDirection(GetFacing(oTarget)); vector vNewPos = AngleToVector(fOrientation); float vX = vPosition.x - vNewPos.x;  float vY = vPosition.y - vNewPos.y;   float vZ = vPosition.z;   vNewPos = Vector(vX, vY, vZ); ActionMoveToLocation( Location( oArea, vNewPos, fOrientation) ); // go stand right behind the PC (if he's still there) ActionDoCommand(SetFacing(fOrientation)); // turn towards PC } // to circumvent the current bug with GetFacing... float CorrectDirection( float fFacing ) {  if (fFacing >= 360.0) fFacing = 720.0 - fFacing; if (fFacing < 0.0) fFacing += 360.0; return fFacing; }