Re: [CODE][NEWBIE] Intelligent Sentinel Mob

From: Stephen Wolfe (siv@CYBERENET.NET)
Date: 07/21/98

> > I'd like to create an intelligent (ish) Sentinel mob for example a pet
> > that follows you around (say a parrot) and steals things from other players or
> > NPC's (like gold) and speaks at the same time (say 'Pieces of eight....').
> >
> > Anyway, looking through the code in mobact.c I see that a sentinel mob cannot
> > move of it's own accord, and therefore the spec-proc is not called for
> > that mob, it is only called when someone else in the room moves.

actually, special procedures ARE called for sentinel mobs every pulse, maybe there's something wrong with your spec proc..what you
should really do is look into getting a scripting system (mob progs or DG
scripts)..this would be a piece of cake then:

>mprog_greet_all_prog 100
mpecho $I squaks 'Pieces of eight.'
mpsteal $r

mpsteal would be a mob only func that loops through the target's inventory
and steals a random item or below..might be useful to eight
mobprog or dg people (with a little tweaking)..

  struct char_data *vict;
  struct obj_data *obj;
  char vict_name[MAX_INPUT_LENGTH];
  int gold, eq_pos, ohoh = 0;

  if (!IS_NPC(ch) || IS_AFFECTED(ch, AFF_CHARM) || ch->desc) {
    send_to_char("Huh?\n\r", ch);

  argument = one_argument(argument, vict_name);

  if (!(vict = get_char_room_vis(ch, vict_name))) {
    log("(MP) No argument MpSteal - %d", GET_MOB_VNUM(ch));
  } else if (vict == ch)
  else if (vict == ch->master)

  if (FIGHTING(vict))

  if (number(0, 4))     /* steal eq 4/5, and gold 1/5   */
    for (obj = vict->carrying; obj; obj = obj->next_content)
      if (!number(0, NUM_WEARS))        /* random for any eq slot */
    if (!obj)
    else {                      /* obj found in inventory */
      if (number(0, 101) < GET_LEVEL(ch)) /* skill check vs lev */
        ohoh = TRUE;
        act("$n tried to steal something from you!", FALSE, ch, 0, vict, TO_VICT);
        act("$n tries to steal something from $N.", TRUE, ch, 0, vict, TO_NOTVICT);
      } else {                  /* Steal the item */
        if ((IS_CARRYING_N(ch) + 1 < CAN_CARRY_N(ch))) {
          if ((IS_CARRYING_W(ch) + GET_OBJ_WEIGHT(obj)) < CAN_CARRY_W(ch)) {
            obj_to_char(obj, ch);
            send_to_char("Got it!\r\n", ch);
            improve_skill(ch, SKILL_STEAL);
        } else
  } else {                      /* Steal some coins */
    if (number(0, 101) < GET_LEVEL(ch)) /* skill check vs lev */
      ohoh = TRUE;
      act("You discover that $n has $s hands in your wallet.", FALSE, ch, 0, vict, TO_VICT);
      act("$n tries to steal gold from $N.", TRUE, ch, 0, vict, TO_NOTVICT);
    } else {
      /* Steal some gold coins */
      gold = (int) ((GET_GOLD(vict) * number(1, 10)) / 100);
      gold = MIN(1782, gold);
      if (gold > 0) {
        GET_GOLD(ch) += gold;
        GET_GOLD(vict) -= gold;

  if (ohoh && IS_NPC(vict) && AWAKE(vict))
    hit(vict, ch, TYPE_UNDEFINED);

> your right you are being stupid so shut up and go masturbate

wtf? this is a very legitimate NEWBIE question..maybe it deserves a little
RTFC, but not such a rude and vulgar response..this reply is also grounds
for removal from the list..not only because of the lack of nettiquette,
but also the lack of an ObCircle..


     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

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