BioWare Forums: View Post For Code Display


You are viewing a single post. Please do not take this post out of context.
Read the full topic: Post Working Scripts Here

Author Sticky: Post Working Scripts Here
darthx86 Posted: Tuesday, 02 July 05:25AM
ATTENTION MODERATOR
Please delete my other post in this thread (just two or three above this one). The script has been updated/fixed. Thanks!

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.


Add this instead to make the NPCs flee on factionsetting lower than 10

void main()
{
object oCreature;
oCreature = GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, OBJECT_SELF, 1);
{
ActionMoveAwayFromObject(oCreature, TRUE, 40.0);
}
}

This post taken from the BioWare Forums
Powered by BioBoards Version 2.05.006
Please read our Copyright and Trademark Information