This code for copy animation from bone to another bone with blend

Code:
STRING* animation_act = "walk";
#define speed_animation skill30
#define id_animation skill31
#define id_per skill32

function c_animate(ENTITY* ent,ENTITY* ent2,STRING* animation ,var percentage_speed ,var animation_speed)
{
	if(ent2)
	{
		if(my.id_animation == 2){me.id_animation=0;}
		
		if(str_cmpi(animation_act, animation) == 1)
		{
			ent_animatefrom(ent,ent2,animation_act,ent.speed_animation,ANM_CYCLE);
			ent.speed_animation += animation_speed * time_step;
		}
		else
		{
			if((ent.id_animation == 0)&&(str_cmpi(animation_act, animation) == 0))
			{
				ent.id_per = 0;
				ent.id_animation = 1;
			}
			if(ent.id_animation == 1)
			{
				ent_animatefrom(ent,ent2,animation_act,ent.speed_animation,ANM_CYCLE);
				ent_blendframe(ent,ent2,animation,0,ent.id_per);
				ent.id_per += percentage_speed;
				if(ent.id_per >= 100)
				{
					str_cpy(animation_act, animation);
					ent.id_animation = 2;
					ent.speed_animation=0;
				}		
			}
		}
	}

	
}



hope this help everyone smile

Last edited by Dico; 05/07/13 21:01.