Body Parts [by Patrick Dughi]
Snippet Posted Wednesday, August 12th @ 11:24:44 PM, by George Greer in the Utils dept.
Added Apr 27, 1998. Click the link below to read it or download it.

From: "Patrick J. Dughi" <dughi@IMAXX.NET>
Subject: Make fun body pieces!

Very simple actually.  Insert this into the file 'fight.c' anywhere you'd
like, but preferably before any calls to 'make_corpse()'.  Then, put a
call to 'make_fun_body_pieces' right before the afforementioned
'make_corpse()'.I believe that this code is actually well commented, so
you shouldn't have any problems with any alterations you're sure to make.
If you want to add more body parts, just add to the array
'fun_body_piece_parts' below, and add to the 'NUM_OF_FUN_PARTS' define
which you can see right below this text.  Just a note - I did not check
for grammar, or proper usage of he/she/it, and alothough I got the
majority right, you may want to check it.

#define NUM_OF_FUN_PARTS 21
struct fun_body_piece {
   int number;          /* this parts number */
   char name[40];       /* names of this part */
   int  nname;          /* some parts you couldn't trace to an owner*/
   char sdesc[128];     /* short desc: that of inventory  */
   char rdesc[128];     /* room desc: when on ground */
   int  take;           /* some body parts don't transfer well */
   char actout[128];    /* what people in room see upon death, using
act()*/
   char actkil[128];    /* what the killer sees upon dismemberment, using
act() */
};

struct fun_body_piece parts[NUM_OF_FUN_PARTS] = {
{0,"eyeball eye",1,"the eye of %s","The eyeball of %s is lying here.",
 1,"$n's attack knocks an eye out of $N!",
   "Your attack knocks an eye out of $N!"},
{1,"liver",1,"the liver of %s","%s's liver is lying here.",
 1,"$n's cruel attack blows $N's liver out!",
   "Your cruel attack blows $N's liver out!"},
{2,"arm",1,"one of %s's arms","%s'arm is lying here on the ground.",
 1,"$n's removes $N's arm!",
   "You remove $N's arm!"},
{3,"bowels",1,"%s's bowels","Ick. %s's bowels are lying here.",
 1,"$n debowels $N!",
   "You debowl $N!"},
{4,"tush butt rear ass",1,"%s's rear end",
   "Some one cut of %s's butt and left it here.",
 1,"$n laughs as he severs $N's rear end!",
   "You laugh as you sever $N's rear end!"},
{5,"right leg",1,"%s's right leg","%s's right leg is here.",
 1,"$N gracefully cuts his leg off! $n chortles merrily!",
   "You watch in awe as $N cuts his leg off!"},
{6,"left leg",1,"the left leg of %s","The left leg of %s is lying here.",
 1,"$n's screams and strikes $N leg off at the hip!",
   "With a scream of rage, you strike $N's leg off!"},
{7,"head",1,"%s's ugly head","%s's head is lying here, staring at you.",
 1,"$n severs $N's in a move composed of speed and grace!",
   "With speed and grace, you sever $N's head!"},
{8,"thumb",1,"%s's thumb","One of %s's thumbs is lying here.",
 1,"$n's attack severs a thumb from $N!",
   "Your attack severs a thumb from $N!"},
{9,"finger",1,"%s's finger","One of %s fingers is lying here.",
 1,"$n's attack severs a finger from $N!",
   "Your attack severs a finger from $N!"},
{10,"stomach",1,"%s's stomach","%s lost his stomach here.",
 1,"With animal force, $n tears $N's stomach out!",
   "With animal force, you tear $N's stomach out!"},
{11,"heart",1,"the once beating heart of %s",
"%s's once beating heart lies here.",
 1,"$n's uses pure strength to eviscirate $N!",
   "Your depend on your fierce strength, and eviscerate $N!"},
{12,"spine",1,"the spine of %s","The spine of %s is lying here.",
 1,"$n's attack shatters $N's spine!",
   "Your attack shatters $N's spine!"},
{13,"intestine",0,"An icky pile of intestines",
"An icky pile of intestines is here - colon and all.",
 0,"$n hits so hard, that $N pukes up his intestines !",
   "You hit $N so hard that he pukes up his intestines!"},
{14,"puke vomit",0,"chunky vomit","Some one upchucked on the floor here.",
 0,"$N throws up all over!",
   "$N throws up all over you!"},
{15,"pool blood",0,"A pool of blood","Blood has formed a pool on the
ground.",
 0,"$N bleeds horrendously!",
   "$N bleeds horrendously!"},
{16,"riblet",1,"a meaty %s riblet","A meaty riblet from %s is lying
here.",
 1,"$n's explodes $N's chest with a barrage of attacks!",
   "Your cause $N's chest to explode from a barrage of attacks!"},
{17,"nose",1,"%s's nose","%s lost his nose here.",
 1,"$n cackles gleefuly as he removes $N's nose!",
   "You cackle as you sever $N's nose!"},
{18,"ear",1,"%s's ear","%'s bloody severed ear is here.",
 1,"$n's grabs $N's ear and rips it off!",
   "Your rip off $N's ear!"},
{19,"brain",1,"the jiggly brain of %s","The squishy brain of %s is here.",
 1,"$n shatters $N's skull, knocking the brain on the ground!",
   "You shatter $N's skull, knocking the brain on the ground!"},
{20,"lung",1,"a bloody lung from %s","A blood soaked lung from %s.",
 1,"$N screams his last as $n removes a lung!",
   "$N's screams are cut short as you remove a lung!"}
};

void make_fun_body_pieces(struct char_data *ch, struct char_data *killer)
{
  struct obj_data *piece;
  int i;
  extern int max_npc_corpse_time;

  /*lets check and see if we even GET body parts eh - i mean, they're
    fun, but it wouldn't be quite as fun if they were always there!*/

  if (number(1,5) < 4)
    return;

              /*Then Horray! We's got parts! */
                   /* But which part? */
  i=number(0,20);   /* 20 pieces should be okay*/
  piece = create_obj();

  /*now, everything we have should be in the structures neh?*/
  /*name first*/
  piece->name=str_dup(parts[i].name);
  /*then lets see about the descs */
  if (parts[i].nname) {
    sprintf(buf2, parts[i].sdesc, GET_NAME(ch));
    piece->short_description = str_dup(buf2);
    sprintf(buf2, parts[i].rdesc, GET_NAME(ch));
    piece->description = str_dup(buf2);
  }
  else {
    piece->short_description=str_dup(parts[i].sdesc);
    piece->description = str_dup(parts[i].rdesc);
  }
  /*well, now we know how it looks, lets see if we wanna take it.*/
  if (parts[i].take) {
    GET_OBJ_WEAR(piece) = ITEM_WEAR_TAKE;
  }
 /*  and lets see how it got here in the first place neh? */
  act(parts[i].actout,FALSE,0,killer,0,ch,TO_ROOM);
  act(parts[i].actkil,FALSE,0,killer,0,ch,TO_CHAR);

/* setup the rest of the stats any object needs */
  piece->item_number = NOTHING;
  piece->in_room = NOWHERE;
  GET_OBJ_TYPE(piece) = ITEM_CONTAINER;
  GET_OBJ_VAL(piece, 0) = 0;   /* You can't store stuff in a corpse */
  GET_OBJ_VAL(piece, 3) = 1;   /* corpse identifier */
  GET_OBJ_EXTRA(piece) = ITEM_NODONATE;
  GET_OBJ_WEIGHT(piece) = 1;
  GET_OBJ_RENT(piece) = 1;

        /* Note - you may have some trouble with corpse decay here -
improper settings WILL cause the mud to crash if you do not correcly
decay.  Right now, the pieces are setup as a corpse, so if you made any
changes to your corpse identifiers, fix it above. */

  GET_OBJ_TIMER(piece) = max_npc_corpse_time;

  /* and thats all folks! */
  obj_to_room(piece, ch->in_room);
}


<< Board code -- Replies [by tigeba] | Reply | View as text | Threaded | Book Portal [by Ryan Stuck] >>

 


Related Links
  download
Related Articles
More by greerga
 
 

CircleMUD Snippets
 
Note: Not all of these snippets will work perfectly with your version of code, so be prepared to fix one or two bugs that may arise, and please let me know what you needed to do to fix it. Sending a corrected version is always welcome.
Finally, if you wish to use any of the snippets from this page, you are more than welcome, just mention the authors in your credits. If you wish to release any of these snippets to the public on another site, contact me FIRST.