Hi
I mean that only enemy perfom ok in the function, the others got freeze, they scale down as expected but do nothing. frown
To get the right behavior as C-script i need to:
Code:
[/code]
Do not call the 'act_enemy' as before
function main()
{
   entity3d* enemy = LoadEntity("gangst1.mdl", vector(300,-300, 25));
   //act_enemy(enemy);

   entity3d* enemy2 = LoadEntity("gangst1.mdl", vector(200,-300, 25));
   //act_enemy(enemy);

}

Modify the loading function: included an action function 'act_enemy2' that all enemies will share:
entity3d* LoadEntity(STRING* modelname, VECTOR* position)
{
   entity3d* ptr = malloc(sizeof(entity3d));
   zero(*ptr);
   ptr->model = ent_create (modelname, position, act_enemy2);
   return (ptr);
}

The new function C-script style:

function act_enemy2()
{
  var percent;
  var d1;
  var d2;
  var anim_speed = 2;
  VECTOR temp;
  
  my.scale_x = .4;
  my.scale_y = .4;
  my.scale_z = .4;      
  my.event = all_events;
  my.skill1 = MODE_ATTACK; // entity state
  my.skill2 = 100; //health
  my.skill3 = 200; // range 
  while(!player){wait(1);}
  
  while(my.skill2 > 30)  // in good health
  {
     d1 = vec_dist(my.x, player.x);

    if (my.skill1 == MODE_WALK)
    {    	
       percent += anim_speed * time_step;
       ent_animate(my,"walk", percent, ANM_CYCLE);
       percent %= 100;
       
       // obstacle in front...change direction
       if ( ent_move (vector(4 * time_step,0,0), nullvector) < (anim_speed * time_step))
          my.pan += 1.5;
    }
    
    // traced something in range AND is the player
    if((c_trace (my.x, player.x, IGNORE_ME | IGNORE_PASSABLE) < my.skill3) && (you == player))
    {  
       d2 = vec_dist(my.x,player.x);
       // i'm moving toward the player
       if((d2 <= d1) && ( my.skill2 > 30))
       {         	
          my.skill1 = MODE_ATTACK;
       }
    }
    else
    {
 	my.skill1 = MODE_WALK;
    }    
    
    if (my.skill1 == MODE_ATTACK)
    {
       vec_set(temp,my.x);
       if(vec_dist(me.x, player.x)<1000 && vec_to_screen(temp,camera)!=NULL)
       {
  	  str_for_num(buff, my.skill2);
  	  draw_text(buff, temp.x, temp.y-20, vector(200,200,200));
       }

       percent += anim_speed * time_step;
       ent_animate(my,"attack", percent, ANM_CYCLE);
       percent %= 100;
     
    }   
    wait(1);
 }
}

[code]

Now i can get many enemies moving and targeting player OK
I know...i know... my mind is really a c-script, c-lite, c, mix
crazy
I won't try to how, where and when each interact, better stick to c-script... I'm already know the rules.