Nice try logitek, but that wont work UNLESS you set it up to...
Lets stick with the 'enemy' pointer for simplicity.
When the engine does an 'ent_remove(enemy)', the entity DOES get removed...
BUT the enemy pointer still holds the OLD ADDRESS of where the entity was,
so the
if(enemy != NULL) (which is the same as
if(!enemy)) will still
show as enemy being 'not zero', and therefore APPARENTLY in existence. FAIL!
So what you need to do is STRAIGHT AFTER the ent_remove, you will also need to
change the enemy pointer to NULL, so any later if's will work as expected.
action enemy_action()
{
enemy = me;
me.health = 100;
while(me.health>0)
{
## do whatever ##
wait(1);
}
## run dying animations ##
ent_remove(me);
enemy = NULL;
}
BUT REMEMBER, if there any OTHER pointers ANYWHERE in your code that were pointing
to this entity, they will STILL be pointing at the old address...
Catching them and NULLing them is where it gets tricky, and application dependant...