Ok why not use this:
Code:

define distance,skill1;
define max_dist,skill2;
define kill_skill,skill3;

action dist_object
{
my.max_dist = 300;

// wait until the player was created:
while(!player) { wait(1); }

//while my.kill_skill == 0 ..
while(!my.kill_skill)
{
//store the distance in a skill
my.distance = vec_dist(my.x,player.x);

//compare
if(my.distance > my.max_dist)
{ my.kill_skill = 1; } //its bigger so kill the while
}
//wait a frame
wait(1);
//remove me:
ent_remove(me);
}

undef distance;
undef max_dist;
undef kill_skill;



Edit:
my code will work, caus it uses a boolean var (the kill_skill) as condition for the while loop.
So if you set the kill_skill to non-zero the while loop will be "killed" and the entity proceeds with the code which comes after the while loop.
So it waits one frame (safety reasons), and then removes itself.

Last edited by Thunder; 10/08/06 14:25.