Mob Flag "Smart" Mobs [by Lars Juul]
Snippet Posted Wednesday, August 12th @ 11:31:31 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 "smart" mobs

MOB_IQ_FIGHT
============

Add the MOB_IQ_FIGHT flag in struch.h and constants.c -
in fight.c in perform_violence add a vict and tch var and
insert the following after the call for MOB_SPEC:

    if (MOB_FLAGGED(ch, MOB_IQ_FIGHT)) {  /* LJ IQ fight */
      vict = NULL;
      for (tch = world[ch->in_room].people; tch; tch = tch->next_in_room)
        if (FIGHTING(tch) == ch && !IS_NPC(tch))
          if (vict == NULL || GET_HIT(tch) < GET_HIT(vict))
            vict = tch;

      if (vict != NULL && FIGHTING(ch) != vict) {
        stop_fighting(ch);
        hit(ch, vict, TYPE_UNDEFINED);
      }
    }


<< Mob Flag Fast Aggression [by Lars Juul] | Reply | View as text | Flattened | Mob Memory Commands [by Demetrius Harris] >>

 


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.