[Snippet] Exploding monkeys

doobie@ibm.net
Date: 02/18/97


I worked on this awhile back and asked for/got assistance on it.   Got it
working and have been running it since.  It works real well;  to the point
that I scream in terror whenever I see one of the  monkeys (I have them
with hidden/invis/sneak flags on for added  fun. :)  Code is rather
simplistic, but I'm still learning..  

It's a pure-fun kinda thing, and I made the mob a monkey as it  struck me
as funny at the time... He randomly steals something  from you, sacrifices
it (or donate/junk - just change the code),   then "explodes", leaving the
poor player with no course of 
action for revenge.. 

Use an existing mob, or create a new one, and ASSIGNMOB() it  in
spec_assign.c, and slap the code below into spec_procs.c

Thanks to Daniel and a few others for code assistance when I was working
on this, and to whoever wrote the do_sac code.  See the  snippet page for
the modified do_sac code that JTRHone submitted. 


SPECIAL(monkey)
{
  struct char_data *vict;
  struct obj_data *obj, *list;
  int to_take, obj_count = 0, found = 0;

  ACMD(do_sac);

  if ((cmd) || (GET_POS(ch) != POS_STANDING))
    return FALSE;

  /* Pick a victim */
  for (vict = world[ch->in_room].people; vict; vict = vict->next_in_room)
    if (!IS_NPC(vict) && (GET_LEVEL(vict) < LVL_IMMORT) && (!number(0,
4)))
    {
      if (AWAKE(vict) && (number(0, GET_LEVEL(ch)) == 0))
      {
        act("You gasp as you realize $n is attempting to take something
from you!", FALSE, ch, 0, vict, TO_VICT);
        act("$n just tried to take something from $N!", TRUE, ch, 0, vict,
TO_NOTVICT);
        return TRUE;
      } else
      {
        /* Decide whether to take armor or object */
        switch(number(0,3)) {
        case 0:
        case 2:
          break;
        case 1:  
          log ("in monkey - case 1");
          to_take = number(0, 25);
          if (GET_EQ(vict, to_take) && CAN_SEE_OBJ(ch, GET_EQ(vict,
to_take)))
          {
            obj = GET_EQ(vict, to_take);
            act("$n has just stolen $p from $N!!", 
                FALSE, ch, obj, vict, TO_NOTVICT);
            act("$n has just stolen $p from you!!",
                FALSE, ch, obj, vict, TO_VICT);

            obj_to_char(unequip_char(vict, to_take), vict);
            obj_from_char(obj);
            obj_to_room(obj, ch->in_room);
            do_sac(ch, obj->name, 0, 0);
            act("$n has just exploded into little bitty bits!",
                FALSE, ch, 0, 0, TO_ROOM);
            extract_char(ch);            
            return TRUE;
          }
          break;
        case 3: /* object */
          list = vict->carrying;
          for (obj = list; obj; obj = obj->next_content) {
            if (CAN_SEE_OBJ(vict, obj)) {
              obj_count += 1;
              found = 1;
            }
          }
          if (found == 1) /* Ok, they're carrying something, so pick one
*/
          {
            to_take = number(0, obj_count);
            obj_count = 0;
            for (obj = list; obj; obj = obj->next_content)
            {
              obj_count += 1;
              if (obj_count == to_take)
              {
                act("$n has just stolen $p from $N!!", 
                    FALSE, ch, obj, vict, TO_NOTVICT);
                act("$n has just stolen $p from you!!",
                    FALSE, ch, obj, vict, TO_VICT);
                obj_from_char(obj);
                obj_to_room(obj, ch->in_room);
                do_sac(ch, obj->name, 0, 0);
                act("$n has just exploded into little bitty bits!", 
                    FALSE, ch, 0, 0, TO_ROOM);
                extract_char(ch);
                return TRUE;
              }
            }         
            break;
          }
        } /* end case 2 */
      }
    }
  return FALSE;
}


Dazzit. 
Buck
--
Jason Buckler
doobie@ibm.net
buckfloyd@aol.com

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
|    Or send 'info circle' to majordomo@cspo.queensu.ca     |
+-----------------------------------------------------------+



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