From: Zizazat Lazuras (
Date: 01/20/02

Background: I am trying to do away with the need for special procedures for
mobs to emulate class behaviors. So, for example, a thief mob will steal
gold, a wizard will cast spells etc. I am trying to work with thief/steal
first as I thought it was the least complicated :)

I guess I am having problems with my for loop and next_in_room. Code from
mobact.c follows:

/* Add new mobile actions here */
/* Class based, non-combat actions here */

  switch (GET_CLASS(ch)) {
    case CLASS_THIEF:
      found = FALSE;
      if (GET_POS(ch) == POS_STANDING && (!MOB_FLAGGED(ch, MOB_SPEC)) ) {
        for (vict = world[ch->in_room].people; vict && !found; vict =
          if (vict == ch) {
            act("$n thinks stealing from self is a good idea.", FALSE, ch,
0, 0, TO_ROOM);
          if (vict && GET_LEVEL(vict) < LVL_IMMORT && !number(0, 4) ) {
            npc_steal(ch, vict);
            found = TRUE;

(The ! MOB_SPEC check was so I didn't have to go and unassign all my thief
mobs in the game while I was working this out. Otherwise they would try to
steal twice.)

At first I found that the thief was trying to steal from himself, so I added
a debug message. So then I looked at some other for loops in mobact and saw
the 'found' logic and tried to work that in also, but all I end up with now
is a thief who thinks he should steal from himself.

Can someone please help me with my bad logic?

Eternal Empire MUD 4000

Send and receive Hotmail on your mobile device:

   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/25/03 PDT