///////////////////////////////////////////////////////////////////////////
// Real Time Strategy - NWN - OnPerception modified event for units
//========================================================================
// By Deva Bryson Winblood.  03/10/2003
///////////////////////////////////////////////////////////////////////////

void main()
{
   object oMe=OBJECT_SELF;
   object oEnemy=GetNearestCreature(CREATURE_TYPE_PERCEPTION,PERCEPTION_SEEN,oMe,1,CREATURE_TYPE_REPUTATION,REPUTATION_TYPE_ENEMY,CREATURE_TYPE_IS_ALIVE,TRUE);
   if (oEnemy!=OBJECT_INVALID)
   { // run
     AssignCommand(oMe,ClearAllActions(TRUE));
     AssignCommand(oMe,ActionMoveAwayFromObject(oEnemy,TRUE));
   } // run
}