Firstly, "my = me;" is a a pointless piece of code, they are always the set the same in the guts of the engine.
So, on to your problem.
You havent checked anywhere to see IF 'player' has a valid value(entity).
Try this instead.
action friend_move()
{
my.HEALTH = 100;
while(my.HEALTH > 0)
{
if(player) //means the same as "if(player != NULL)"
{
if(vec_dist(my.x, player.x) < 900 && player.HEALTH > 0)
{
//do something
}
}
wait(1);
}
}
//Advanced programming version
action friend_move()
{
my.HEALTH = 100;
while(my.HEALTH > 0)
{
if(player) if(vec_dist(my.x, player.x) < 900 && player.HEALTH > 0)
{
//do something
}
wait(1);
}
}