If you want them to become invisible after being a certain distance from the player you could do this:

Code:
action map_entity
{
while(1)
{
if vec_dist(my.pos,player.pos)>500//if the distance between me and the player is greater than 500
{
my.invisible=on;
}
else
{
my.invisible=off;
}
waitt(16);//only run once a second
}
}