So I changed the event so now it's just (health being a skill I define at the top):
function delete()
{
if (event_type == EVENT_IMPACT || event_type == EVENT_ENTITY)
{
wait(1);
my.health -= 1;
}
}
and put the rest of the stuff into the action of the entity, so in the loop I have:
if (my.health <= 0)
{
if (you)
ent_remove(you);
ent_morph(me, "death_model.mdl");
destroy_percent += 10;
ent_animate(my,"deleting", destroy_percent, 0);
if (destroy_percent >= 100)
{
wait(1);
if (me)
ent_remove(me);
}
wait(1);
}
now it finishes the death animation and then exists the game.
Putting the remove(you) command into the event doesn't seem to change anything