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

	while(1)
	{
		// get the direction from the entity MY to the entity YOU
	vec_to_angle(vec_bend.pan,vec_diff(NULL,player.x,my.x));
		//    now MY looks at YOU
		ang_diff(ang_bpdiff,vec_bend.pan,my.pan);
		if(abs(ang_bpdiff.pan) >90)
		{
			ent_bonereset(my,"bip01 Spine1");
			vec_to_angle(my.pan,vec_diff(NULL,player.x,my.x));
			ent_bonereset(my,"bip01 Spine1"); // may be overkill
			my.tilt=0;
			my.roll=0;
		} 
		else
		{
			ent_bonereset(my,"bip01 Spine1");
			limit=clamp(ang_bpdiff.tilt,-53,53); //min max
			limit2=clamp(ang_bpdiff.pan,-90,90); //min max
			limit3=clamp(ang_bpdiff.roll,-25,25); //min max
			ent_bonerotate(my, "bip01 Spine1", vector(limit2,limit,limit3));
		}
		wait(1);
	}
}



Code 100% tested and working with Tusker.mdl

I got bored and felt like doing this. Think it's cool. BTW in the bottom left of MED - select the bone - you'll see two name blocks - the bone name bip01 Spine1 and the word"bone". the name is not bone.

No need for a "thank you"- I thought playing with vec_to_ang and Ang_diff would be a fun reminder. Now I played with bones makes me want to build a bone animation system. Lol to much work...

Have fun ,game dev on bill and ted
Mal

Last edited by Malice; 10/26/15 05:11.