Author Sticky: Post Working Scripts Here
darthx86 Posted: Tuesday, 02 July 03:25AM
Hmm... Since I can't go back and zorch my previous post in this thread, I'll just post the modified version of the _NPC_Flee script here.

NWScript:
// Script bases NPC's decision to flee on perception of "ENEMY".

// NPC flees to "WAYPOINT." Put this on OnPerceived!

void main()

{

object oCreature;

object oRunTo;

int iRunLikeHell = 0;

oRunTo = GetWaypointByTag("NPC_Flee1");

oCreature = GetLastPerceived();

if (GetObjectByTag("ENEMY", 1) == oCreature)

    {

    iRunLikeHell = 1;

    }

if (iRunLikeHell = 1)

    {

    ActionMoveToObject(oRunTo, TRUE);

    }

}



This version doesn't make the NPCs "stutter" when they're fleeing. Once they see an enemy, they're off to the races. 

Requirements: Waypoints and enemy tags (documented in the script).

_________________
Truly, you have a dizzying intellect.