I have a simple hit box system in the works. An head hitbox entity (passable for now) is created by the enemy entity and aligned to the head every frame - this is done successfully when the enemy entity moves. However, when the entity plays its death animation, the head entity does not move according to the animation. here is code:

Code:
 

function me_die()
{
var die_percentage = 0;
while (die_percentage >= 0) // death_percentage will range from 0 to 100 here
{
ent_animate(my, "DeathA", die_percentage, 0); // "death" one-shot animation
die_percentage += 5 * time; // 3 = animation speed for "death"
wait (1);
}
}

function handle_hit_me()
{
if (you.skill1 == 4)
{
effect(blood_cloud1,cloud_number,target.x,nullvector);
my.skill20 -= 10;
effect(blood_dropsspezial,blood_dropsAnzahlPartikel,target.x,nullvector);
if (my.skill20 <= 0)
{
me_die();
my.passable = on;
}
}
}

function hit_head()
{
var target_look;
var target_ver;
my.passable = on;
while(you)
{
vec_for_vertex (target_ver, you, 240);
vec_for_vertex (my.x, you, 239);
vec_sub(target_ver,my.x);
vec_to_angle(my.pan,target_ver); // now MY looks at YOU
wait(1);
}
}

action dummy
{
my.enable_impact = on;
my.event = handle_hit_me;
my.skill96 = 1;
my.skill20 = 100;
ent_create(headhitbox,my.x,hit_head);
main_ai();
}




The code is very experimental at the moment and is not meant to be tidy. What I want to know, how do I make it align to animation? I know this is possible, it is mentioned in the vattach file which I downloaded when I first found that it didn't work, only to find it used the same concept.