I can´t really find any mistakes, except of the order. Try defining the event function before the function triggering the event, or place a function prototype over the move_projectile() function:

function remove_projectile();

function move_projectile()
{
var maximum_distance = 15;
var projectile_speed = 50;
var effect_speed = 0;

wait(1);
c_setminmax(me);
my.invisible = on;
my.enable_entity = on;
my.pan = player.pan;
my.tilt = player.tilt;
my.event = remove_projectile;
while (maximum_distance > 0) && (my)
{
maximum_distance -= 1 * time;
c_move (me, projectile_speed, nullvector, ignore_passable);
vec_set (temp.x, my.x);
effect (photon_effect, 1, temp, effect_speed);
wait (1);
}
remove_projectile(); //remove me once distance is met
}

function remove_projectile()
{
wait(1); //wait one frame
my.event = null;
my.passable = on;
my.invisible = on;
sleep (2);
ent_remove(me);
}


I´m not sure but at least, this could be the problem.


Slin