.,-'^'-,..,-'^'-,..,-'^'-,.,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,.

From: Darkened Lights 2.0. Mayhem, Mike Ryan. [mikeypryan@yahoo.com]

spunge.org 4002, http://www.thedarkenedlights.biz 

Code: Better Bodypart Code. -> Step by Step Tutorial.

Code Written: Original Credits, Kavir [Godwars 1995], Mayhem [Darkened Lights 2.0].

.,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,..,-'^'-,.

Hello everyone, recently i have been searching for some new and exciting code to give life to my MUD
right now i am in the process of creating a CIRCLEMUD/GODWARS code.
I was originally going to use the bodyparts code from the contribution page but i found it was bleek and 
not at all applicable to the theme of my mud. So i gathered the concept of the Godwars code and 
rewrote the code and put it to use.

If you are going to credit this code, please give credit to Kavir. Because all i did was rewrite this code.

Thanks,

Step one, 

first we need to define some things so lets open [ structs.h ]
 
To Define the OBJ_VNUM NUMBER for the bodypart. CHANGE XXXX to the vnum of the bodypart.

#define OBJ_VNUM_SEVERED_HEAD     XXXX
#define OBJ_VNUM_TORN_HEART          XXXX
#define OBJ_VNUM_SLICED_ARM           XXXX
#define OBJ_VNUM_SLICED_LEG            XXXX
#define OBJ_VNUM_SPILLED_ENTRAILS  XXXX
#define OBJ_VNUM_QUIVERING_BRAIN   XXXX
#define OBJ_VNUM_SQUIDGY_EYEBALL  XXXX
#define OBJ_VNUM_SPILT_BLOOD      XXXX
#define OBJ_VNUM_RIPPED_FACE     XXXX
#define OBJ_VNUM_RIPPED_FACE      XXXX
#define OBJ_VNUM_TORN_WINDPIPE    XXXX
#define OBJ_VNUM_CRACKED_HEAD    XXXX
#define OBJ_VNUM_SLICED_EAR       XXXX
#define OBJ_VNUM_SLICED_NOSE      XXXX
#define OBJ_VNUM_KNOCKED_TOOTH    XXXX
#define OBJ_VNUM_TORN_TONGUE      XXXX
#define OBJ_VNUM_SEVERED_HAND    XXXX
#define OBJ_VNUM_SEVERED_FOOT    XXXX
#define OBJ_VNUM_SEVERED_THUMB   XXXX
#define OBJ_VNUM_SEVERED_INDEX    XXXX
#define OBJ_VNUM_SEVERED_MIDDLE  XXXX
#define OBJ_VNUM_SEVERED_RING     XXXX
#define OBJ_VNUM_SEVERED_LITTLE   XXXX
#define OBJ_VNUM_SEVERED_TOE      XXXX

/******** NOW go down to the PLR_ Macros and define a new one

#define PLR_FACE  (1 << XX)  XX = the number next in your structs.h

-=-=-=-=-=- NOW CLOSE STRUCTS.H -=-=-=-=-=
               (OPEN FIGHT.C)
add this at the top in the externs....

void make_part(struct char_data *ch, char *argument)

add this entire code anywhere.

void make_part(struct char_data *ch, char *argument)
{
    struct obj_data *obj;
    int vnum;

    one_argument(argument, arg);
    vnum = 0;

    if (arg[0] == '\0') return;
    if (!str_cmp(arg,"head")) vnum = OBJ_VNUM_SEVERED_HEAD;
        else if (!str_cmp(arg,"arm")) vnum = OBJ_VNUM_SLICED_ARM;
    else if (!str_cmp(arg,"leg")) vnum = OBJ_VNUM_SLICED_LEG;
    else if (!str_cmp(arg,"heart")) vnum = OBJ_VNUM_TORN_HEART;
    else if (!str_cmp(arg,"turd")) vnum = OBJ_VNUM_TORN_HEART;
    else if (!str_cmp(arg,"entrails")) vnum = OBJ_VNUM_SPILLED_ENTRAILS;
    else if (!str_cmp(arg,"brain")) vnum = OBJ_VNUM_QUIVERING_BRAIN;
    else if (!str_cmp(arg,"eyeball")) vnum = OBJ_VNUM_SQUIDGY_EYEBALL;
    else if (!str_cmp(arg,"blood")) vnum = OBJ_VNUM_SPILT_BLOOD;
    else if (!str_cmp(arg,"face")) vnum = OBJ_VNUM_RIPPED_FACE;
    else if (!str_cmp(arg,"windpipe")) vnum = OBJ_VNUM_TORN_WINDPIPE;
    else if (!str_cmp(arg,"cracked_head")) vnum = OBJ_VNUM_CRACKED_HEAD;
    else if (!str_cmp(arg,"ear")) vnum = OBJ_VNUM_SLICED_EAR;
    else if (!str_cmp(arg,"nose")) vnum = OBJ_VNUM_SLICED_NOSE;
    else if (!str_cmp(arg,"tooth")) vnum = OBJ_VNUM_KNOCKED_TOOTH;
    else if (!str_cmp(arg,"tongue")) vnum = OBJ_VNUM_TORN_TONGUE;
    else if (!str_cmp(arg,"hand")) vnum = OBJ_VNUM_SEVERED_HAND;
    else if (!str_cmp(arg,"foot")) vnum = OBJ_VNUM_SEVERED_FOOT;
    else if (!str_cmp(arg,"thumb")) vnum = OBJ_VNUM_SEVERED_THUMB;
    else if (!str_cmp(arg,"index")) vnum = OBJ_VNUM_SEVERED_INDEX;
    else if (!str_cmp(arg,"middle")) vnum = OBJ_VNUM_SEVERED_MIDDLE;
    else if (!str_cmp(arg,"ring")) vnum = OBJ_VNUM_SEVERED_RING;
    else if (!str_cmp(arg,"little")) vnum = OBJ_VNUM_SEVERED_LITTLE;
    else if (!str_cmp(arg,"toe")) vnum = OBJ_VNUM_SEVERED_TOE;

    if ( vnum != 0 )
    {
        struct obj_data *obj;
        char *name;

        name            = IS_NPC(ch) ? obj->short_description : GET_NAME(ch);
                obj             = create_obj();
        GET_OBJ_TIMER(obj) = max_npc_corpse_time;}
        obj = read_object(vnum, VIRTUAL);

        if (vnum == OBJ_VNUM_SPILT_BLOOD) GET_OBJ_TIMER(obj) =max_npc_corpse_time;

        if (!IS_NPC(ch))
        {
            sprintf( buf, obj->name, GET_NAME(ch) );
                  obj->name = str_dup( buf );
        }
        else
        {
            sprintf( buf, obj->name, "mob" );
            obj->name = str_dup( buf );
        }

        sprintf( buf, obj->short_description, GET_NAME(ch) );
        obj->short_description = str_dup( buf );

        sprintf( buf, obj->description, GET_NAME(ch) );
        obj->description = str_dup( buf );
        obj_to_room(obj, ch->in_room );

    return;
}

Now that we have added that depending on what VERSION of cicleMUD you might have to define the BUF and the ARgument.
just add buf[MAX_STRING_LENGTH]; and arg[MAX_STRING_LENGTH]; under the void.

Now move down to dam_message and under this block of code:
  if (dam == 0)         msgnum = 0;
  else if (dam <= 2)    msgnum = 1;
  else if (dam <= 6)    msgnum = 3;
  else if (dam <= 10)   msgnum = 4;
  else if (dam <= 14)   msgnum = 5;
  else if (dam <= 19)   msgnum = 6;
  else if (dam <= 23)   msgnum = 7;
  else                  msgnum = 8;
ADD:
if (dam == number(1, 5)) {
if (!PLR_FLAGGED(victim, PLR_FACE)) {
act("You ram your fingers into $N's eye sockets and rip $S face off.", FALSE, ch, 0, victim, TO_CHAR);
act("$n rams $s fingers into $N's eye sockets and rips $S face off.",FALSE, ch, 0, victim, TO_NOTVICT);
act("$n rams $s fingers into your eye sockets and rips your face off.",FALSE, ch, 0, victim, TO_VICT);
SET_BIT(PLR_FLAGS(victim), PLR_FACE);
make_part(victim,"face");
 } else if (PLR_FLAGGED(victim, PLR_FACE))
return;
} 

/*** NOW, for each Bodypart you'll have to add this and change the name of the bodypart in the ACTION SEQUENCE ABOVE,
and add a new PLR_ Macro into structs.h.

/***** TO ADD THE OBJECTS TO BE LOADED.

in your mud prompt type oedit and the number the bodypart is defined as in STRUCTS.H.
To add the name of the person who has lost the limb add a %s in the name in the short description, and long description.

Example: The hacked off arm of %s is lying here on the floow


Now with this the options are INFINITUM, for windpipe you can make it so the can't say or gossip.
You can remove the arms and not allow them to wield anything, or walk without legs, etc etc etc. just play around with the code.

to have the bodyparts Just add the REMOVE_BIT in point_update in LIMITS.C.

Enjoy,
   Mayhem - Implementor of Darkened Lights. telnet://spunge.org:4002 or http://www.thedarkenedlights.biz