Originally Posted By: Malice
http://www.conitec.net/beta/avec_to_angle.htm

vec_to_angle (ANGLE* ang, VECTOR* dir);
Computes the pan and tilt angles of a direction vector, and places them into the pan and tilt parameters of an Euler angle. Very useful for trading an angle for a direction, thus computing the angles to a target.

Code:
function turn_towards_target()
{
  // get the direction from the entity MY to the entity YOU
  vec_set(temp,your.x); 
  vec_sub(temp,my.x);
  vec_to_angle(my.pan,temp); // now MY looks at YOU
}



Code:
action monster_code()
{
   ...
   VECTOR vec_temp;
   VECTOR vec_bend;
   var limit2=0;
   var limit3=0;  

   ...

   while(1)
   {
      ...
       // get the direction from the entity MY to the entity YOU
  vec_set(vec_temp,player.x); 
  vec_sub(vec_temp,my.x);
  if(abs(vec_bend.pan) >90)
  vec_to_angle(vector(my.pan,0,0),vec_temp); // now MY
else
{
vec_to_angle(vec_bend,vec_temp); // now MY looks at YOU
       ent_bonereset(my,"waist");
      limit=clamp(vec_bend.tilt,-53,53); //min max
      limit2=clamp(vec_bend.pan,-90,90); //min max
      limit3=clamp(vec_bend.roll,-25,25); //min max
      ent_bonerotate(my, "waist", vector(limit2,limit,limit3));
}
      wait(1);
   }
}



When do we start getting paid for this?

Lol , have fun
Mal

EDITED- Code correction


Error in ''monsterCode.c'
'pan': is not a member of 'VECTOR'
< if(abs(vec_bend.pan) >90)
>