[NEWBIE][CODE]Autosac

From: Jimmie Tryon (zereth@EARTHLINK.NET)
Date: 12/23/02


Thanks for all your help.  I've been tackling this for awhile now.  The
problem I have now is it will not sacrifice the corpse, after the mob is
dead.  I get the message 'What do you want to sacrifice'?

-fight.c-

IS_NPC(victim)) {
      mudlog(BRF, LVL_IMMORT, TRUE, "%s killed by %s at %s", GET_NAME
(victim), GET_NAME(ch), wor$
      if (MOB_FLAGGED(ch, MOB_MEMORY))
        forget(ch, victim);
    }
    die(victim, ch);

 /* If autosac enabled, get all corpse */
    if (IS_NPC(victim) && !IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOSAC)) {
      do_sac(ch, "corpse", 0, 0);
    }
    return (-1);
  }
  return (dam);
}

- act.item.c-
ACMD(do_sac)
{
   struct obj_data *obj;
   char arg[MAX_INPUT_LENGTH];
   // note, I like to take care of no arg and wrong args up front, not
   // at the end of a function, let's get the wrongness out of the way

   if (!*arg)
   {
     send_to_char(ch, "What do you wish to sacrifice?\n\r");
     return;
   }
   // if it's not in the room, we're not going to sac it
   if (!(obj = get_obj_in_list_vis(ch, arg, NULL, world[ch-
>in_room].contents)))   {
     send_to_char(ch, "You don't see that h return;
   }
   // cool, got the object in the room, now check its flags
   if (!CAN_WEAR(obj, ITEM_WEAR_TAKE))
   {
     send_to_char(ch, "You can't sacrifice THAT!\n\r");
     return;
   }
   // seems as if everything checks out ok
   act("$n sacrifices $p.", FALSE, ch, obj, 0, TO_ROOM);
   act("You sacrifice $p.", FALSE, ch, obj, 0, TO_CHAR);
   extract_obj(obj);
}

Any ideas?

--
   +---------------------------------------------------------------+
   | 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