NEWBIE: Making mobs react quicker?

From: Fionn Colvin (fcolvin@metz.une.edu.au)
Date: 06/05/96


Hi all,
       Below is a special procedure I have added which makes the mob:
(1) Assist any good aligned mob.
(2) Assist any good aligned player against an evil aligned mob.
(3) Attack any evil player, declared in struct.h as a couple of different 
types of races.

The trouble is any mob with this proc assigned to him/hew takes about 3 
or 4 seconds before they react. Easily enough time for someone to run 
past. Is there any way to make them react a hell of a lot quicker? I am 
using version 3 pl11.

Thanks in advance

Fionn


SPECIAL(goodguard)
{
  struct char_data *tch, *assist, *attack;

  if (cmd || !AWAKE(ch) || FIGHTING(ch))
    return FALSE;

  for (tch = world[ch->in_room].people; tch; tch = tch->next_in_room) {
    if (CAN_SEE(ch, tch)) {
      if (IS_EVILRACE(tch)) {
        attack = tch;
        act("$n screams, 'WE ARE UNDER ATTACK!  CHARGE!!'", FALSE, ch, 0, 0, TO_ROOM);
        hit(ch, attack, TYPE_UNDEFINED);
        return (TRUE);
        break;
      }
      if (FIGHTING(tch)) {
        if ((GET_ALIGNMENT(tch) > 0) && (IS_NPC(tch))) {
          assist = tch;
          attack = FIGHTING(assist);
          act("$n screams 'PROTECT THE INNOCENT!  CHARGE!'", FALSE, ch, 0, 0, TO_ROOM);
          hit(ch, attack, TYPE_UNDEFINED);
          return (TRUE);
          break;
        }
        if ((GET_ALIGNMENT(tch) < 0) && (IS_NPC(tch))) {
          attack = tch;
          if (GET_ALIGNMENT(FIGHTING(attack)) > 0) {
            assist = FIGHTING(attack);
            act("$n screams 'PROTECT THE INNOCENT!  CHARGE!'", FALSE, ch, 0, 0, TO_ROOM);
            hit(ch, attack, TYPE_UNDEFINED);
            return (TRUE);
            break;
          } 
        }
      }
    }
  }
  return (FALSE);
}



This archive was generated by hypermail 2b30 : 12/18/00 PST