Mob Flag Fast Aggression [by Lars Juul]
Snippet Posted Wednesday, August 12th @ 11:31:26 PM, by George Greer in the Mobiles dept.
Added Dec 8, 1997. Click the link below to read it or download it.

From: Lars Juul 
Subject: Code for Fast agressive mobs

MOB_FAST_AGGR
=============

Add the MOB_FAST_AGGR flag in struch.h and constants.c -
in act.movement.c change do_move to:

ACMD(do_move)
{
  register struct char_data *vict, *tmob;
  int found;

  /*
   * This is basically a mapping of cmd numbers to perform_move indices.
   * It cannot be done in perform_move because perform_move is called
   * by other functions which do not require the remapping.
   */
  perform_move(ch, cmd - 1, 0);

  /* LJ Fast Aggressive */
  for (tmob = world[ch->in_room].people; tmob; tmob = tmob->next_in_room)
  {
    if (!IS_NPC(tmob) || !MOB_FLAGGED(tmob, MOB_FAST_AGGR))
      continue;

    found = FALSE;
    for (vict = world[tmob->in_room].people; vict && !found; vict = vict->next_
in_room)
        {
          if (IS_NPC(vict) || !CAN_SEE(tmob, vict) || PRF_FLAGGED(vict, PRF_NOH
ASSLE))
            continue;
          if (MOB_FLAGGED(tmob, MOB_WIMPY) && AWAKE(vict))
            continue;

          if (MOB_FLAGGED(tmob, MOB_AGGRESSIVE) ||
           (MOB_FLAGGED(tmob, MOB_AGGR_EVIL) && IS_EVIL(vict)) ||
           (MOB_FLAGGED(tmob, MOB_AGGR_NEUTRAL) && IS_NEUTRAL(vict)) ||
           (MOB_FLAGGED(tmob, MOB_AGGR_GOOD) && IS_GOOD(vict))) {
            hit(tmob, vict, TYPE_UNDEFINED);
            found = TRUE;
          }
    }
  }

}


<< Meterbar for attributes (Another) [by Professor Hoopster] | Reply | View as text | Flattened | Mob Flag "Smart" Mobs [by Lars Juul] >>

 


Related Links
  download
Related Articles
More by greerga
 
 

CircleMUD Snippets
 
Note: Not all of these snippets will work perfectly with your version of code, so be prepared to fix one or two bugs that may arise, and please let me know what you needed to do to fix it. Sending a corrected version is always welcome.
Finally, if you wish to use any of the snippets from this page, you are more than welcome, just mention the authors in your credits. If you wish to release any of these snippets to the public on another site, contact me FIRST.