I have seen it done, so I need some suggestions and feedback on how to implement this ritual to our game.
What I am looking for is this; Character dies, instead of creating a corpse at the death location, and a new body at a temple, there is only one corpse, and the character is still attached to it.
Until either a) the corpse decays, or b) the corpse is found by a cleric and is resurected.
Suggestions on how to make this so are appreciated and encouraged.
Gregar
New direction with it, what we are leaning towards now, is that at the moment of death, your new body is transferred to an infirmary, at a cost in exp (same as death) and gold.
Rather than creating a Character Corpse, you will simply be knocked out, and awaken in the sick house with all of your gear.
New death message indicating what happened to you, and re-equiping the new body with current EQ. Here are the lines of code that concern me, with some questions following, for anyone who wants to step up and reply.
Thanks!
Gregar
Current code:
void make_corpse( CHAR_DATA *ch, CHAR_DATA *killer )
{
char buf[MAX_STRING_LENGTH];
OBJ_DATA *corpse;
OBJ_DATA *obj;
OBJ_DATA *obj_next;
ROOM_INDEX_DATA *location;
char *name;
if ( IS_NPC(ch) )
{
name = ch->short_descr;
corpse = create_object(get_obj_index(OBJ_VNUM_CORPSE_NPC), 0);
corpse->timer = 6;
if ( ch->gold > 0 )
{
if ( ch->in_room )
{
ch->in_room->area->gold_looted += ch->gold;
sysdata.global_looted += ch->gold/100;
}
obj_to_obj( create_money( ch->gold ), corpse );
ch->gold = 0;
}
corpse->cost = (-(int)ch->pIndexData->vnum);
corpse->value[2] = corpse->timer;
}
else
{
name = ch->name;
corpse = create_object(get_obj_index(OBJ_VNUM_CORPSE_PC), 0);
if ( in_arena( ch ) )
corpse->timer = 0;
else
corpse->timer = 40;
corpse->value[2] = (int)(corpse->timer/8);
corpse->value[4] = ch->level;
location = get_room_index ( ROOM_VNUM_MORGUE );
if ( CAN_PKILL( ch ) && sysdata.pk_loot )
xSET_BIT( corpse->extra_flags, ITEM_CLANCORPSE );
/* Pkill corpses get save timers, in ticks (approx 70 seconds)
This should be anough for the killer to type 'get all corpse'. */
if ( !IS_NPC(ch) && !IS_NPC(killer) )
corpse->value[3] = 1;
else
corpse->value[3] = 0;
}
if ( CAN_PKILL( ch ) && CAN_PKILL( killer ) && ch != killer )
{
sprintf( buf, "%s", killer->name );
STRFREE( corpse->action_desc );
corpse->action_desc = STRALLOC( buf );
}
/* Added corpse name - make locate easier , other skills */
sprintf( buf, "corpse %s", name );
STRFREE( corpse->name );
corpse->name = STRALLOC( buf );
sprintf( buf, corpse->short_descr, name );
STRFREE( corpse->short_descr );
corpse->short_descr = STRALLOC( buf );
sprintf( buf, corpse->description, name );
STRFREE( corpse->description );
corpse->description = STRALLOC( buf );
for ( obj = ch->first_carrying; obj; obj = obj_next )
{
obj_next = obj->next_content;
obj_from_char( obj );
if ( IS_OBJ_STAT( obj, ITEM_INVENTORY )
|| IS_OBJ_STAT( obj, ITEM_DEATHROT ) )
extract_obj( obj );
else
obj_to_obj( obj, corpse );
}
if (IS_NPC(ch))
obj_to_room( corpse, ch->in_room );
else
obj_to_room (corpse,location );
return;
}
Proposed butchered code :
void make_corpse( CHAR_DATA *ch, CHAR_DATA *killer )
{
char buf[MAX_STRING_LENGTH];
OBJ_DATA *corpse;
OBJ_DATA *obj;
OBJ_DATA *obj_next;
ROOM_INDEX_DATA *location;
char *name;
if ( IS_NPC(ch) )
{
name = ch->short_descr;
corpse = create_object(get_obj_index(OBJ_VNUM_CORPSE_NPC), 0);
corpse->timer = 6;
if ( ch->gold > 0 )
{
if ( ch->in_room )
{
ch->in_room->area->gold_looted += ch->gold;
sysdata.global_looted += ch->gold/100;
}
obj_to_obj( create_money( ch->gold ), corpse );
ch->gold = 0;
}
corpse->cost = (-(int)ch->pIndexData->vnum);
corpse->value[2] = corpse->timer;
}
/* Added corpse name - make locate easier , other skills */
sprintf( buf, "corpse %s", name );
STRFREE( corpse->name );
corpse->name = STRALLOC( buf );
sprintf( buf, corpse->short_descr, name );
STRFREE( corpse->short_descr );
corpse->short_descr = STRALLOC( buf );
sprintf( buf, corpse->description, name );
STRFREE( corpse->description );
corpse->description = STRALLOC( buf );
for ( obj = ch->first_carrying; obj; obj = obj_next )
{
obj_next = obj->next_content;
obj_from_char( obj );
if ( IS_OBJ_STAT( obj, ITEM_INVENTORY )
|| IS_OBJ_STAT( obj, ITEM_DEATHROT ) )
extract_obj( obj );
else
obj_to_obj( obj, location );
}
if (IS_NPC(ch))
obj_to_room( corpse, ch->in_room );
else
obj_to_room (obj, location );
return;
}
So, will this work?
Thank ya.
It will make your code posts more readable on this forum to check "Forum codes" when posting, and putting your code blocks into sections like this:
[code]
... some code here ...
[/code]
If you do that you need to "escape" certain characters or they may not print properly, namely:
[ becomes \[
] becomes \]
\ becomes \\
In the MUSHclient notepad is a feature "quote forum codes" that will do that for you.
Simpified.
What do I need to change in this line to make items that were on a character, go onto the characters new body, rather than the corpse?
obj_to_room ( corpse,location );
Thanks in advance.
Gregar
That's not the line or even the function you want to change at all.
obj_to_room is what inserts an object into a room's list of contents. It has nothing to do with corpses or players or anything.
You want to change the make_corpse function to not put items onto the corpse (and thus take off of the character). You may also have to make sure that extract_char doesn't remove all the objects, but that shouldn't happen.