It could be that ogre_active is not always -1 when in range of the player. do a DEBUG_VAR() test on it an place right above the while()'s wait(1);

Code:
test_var = ogre_active; 
DEBUG_VAR(test_var,10);
wait(1);
}



If this value is not -1 every frame then the animation will not play every frame.

Here is what I'm thinking

Code:
if (vec_dist(my.x,player1.x) < 500 && (my.health > 0)) 
   {
   	c_scan(my.x,my.pan,vector(360,60,1700),IGNORE_ME | SCAN_ENTS | SCAN_LIMIT);
   	
   	   	if (vec_dist(my.x,player1.x) <= 100+25)
 
                {
                        if(vec_dist(my.x,player.x)<= 100)
                        ogre_active = -1;
                }
   		else
   		{ 
   		 ogre_active = 1;
   		}
   	else
   	{
   		ogre_active = 0;
   	}
   }
   
   else 
   {
   	ogre_active = 0;
   }