....Ok, solved all probs and script now works as expected.

Code:
action tree1()
{
	while(player == NULL){wait(1);}
   my.red = 200;//testing purposes
   my.green = 220;//testing purposes
   my.blue = 200;//testing purposes
   set(my, TRANSLUCENT);
   my.alpha = 0;
   set(my, PASSABLE);
   set(my, SHADOW); 
    while (1)
    {  
       while (vec_dist(my.x, player.x) > 800){wait(1);}
    	 if (vec_dist(my.x, player.x) < 800)
       {
       	while(my.alpha < 100)
            {
            	my.alpha += 5 * time_step;
            	if(my.alpha >= 100)
            	{
            		my.alpha = 100;
					}
					wait(1);
				}
		 	}
       	else
       	{
       		if((vec_dist(my.x, player.x) > 800)&&(my.alpha > 0))
       		{
          	my.alpha -= 5 * time_step;	
          	my.health -= 5 * time_step;
          	if(my.alpha <= 0)
            	{
            		my.alpha = 0;
					}
          }
          }
       remove_t1();
       return;
       
    }
}


function remove_t1()
{
	while(vec_dist(my.x, player.x) < 900){wait(1);}
	if ((vec_dist(my.x, player.x) > 900)&&(MKt1 ==0))
	{ 
      if(my.alpha)
       {
       	my.alpha = 0;
       	wait(-1);
       	ent_remove(me);
			MKt1 = 1;
       }
	}
}




Last edited by KiwiBoy; 05/13/09 11:01.