Well, this is what I'll do, most likely
Code:
ENTITY* target;

action enemy()
{
   my.skill80=1;//or set to anything you like
   ...
}

action detect_nearest_enemy()
{
   you=ent_next(NULL);
   target=you;
   while(you!=NULL)
   {
      if(your.skill==80)
      {
         if(vec_dist(you.x,my.x)<vec_dist(target.x,my.x))
         {
            target=you;
         }
      }
      you=ent_next(you);
   }
   ...
}


Careful, though, it's not tested yet...

Last edited by bart_the_13th; 06/10/09 09:08. Reason: those bloody indetation