Quote:
Thanks, Redeemer. I only use vec_dist to detect the player distance and activate the Attack or run mode of the enemy, ignoring walls . I have to fix it using c_trace to activate the enemy only when the player is visible for him. Or mix some options using distance and visibility, etcetera.

I use c_scan() to check if the player can be detected. If the enemy detects the player, I then use c_trace(). If nothing is in the way, then the enemy starts attacking the player. Like this:

Code:
function enemy_event
{
  if( event_type == event_detect ) // I detected an entity with c_scan
  {
    if( your == player ) // the entity I detected is "player"
    {
      wait(1);
      c_trace( my.x, player.x, ignore_passable+ignore_me ); // trace a line to "player"
      if( your == player ) // the object hit by c_trace is the player (not a wall, other entity, etc.)
      {
        beep; // signify that I have seen the player
        my.flag1 = on; // so I don't "beep" again
      }
    }
  }
}

action enemy
{
  my.enable_detect = on; // so I can see the player
  my.event = enemy_event;

  while(my) // while I exist
  {
    if( my.flag1 == off ) // I haven't seen the player yet
    {
      c_scan( my.x, my.pan, vector( 160, 0, 2000 ), ignore_me+scan_ents ); // scan for the player
    }

    wait(1);
  }
}


This example uses C-Script, so you would have to convert it to lite-C to use it; but I think you understand wink

Quote:
About the second questions , for now , it is shooting only one pellet.
The answer is that i dont know, for now, how to shoot more than one pellet at a time

Use a "for" loop to fire more than one pellet at a time. Your weapons also shouldn't always be perfectly accurate; use random() to mess up the aiming trajectory a little bit.

Keep up the good work, this is getting pretty good laugh


Eats commas for breakfast.

Play Barony: Cursed Edition!