mobact.c

From: Zizazat Lazuras (zizazat@hotmail.com)
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 =
vict->next_in_room)
          if (vict == ch) {
            act("$n thinks stealing from self is a good idea.", FALSE, ch,
0, 0, TO_ROOM);
            continue;
          }
          if (vict && GET_LEVEL(vict) < LVL_IMMORT && !number(0, 4) ) {
            npc_steal(ch, vict);
            found = TRUE;
          }
      }
    break;
  }

(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?

--Ziz
Eternal Empire MUD
lyra.digitech.org 4000

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



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