Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Resurection

Resurection

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Gregar   (20 posts)  Bio
Date Tue 23 Dec 2003 02:14 AM (UTC)
Message
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
Top

Posted by Gregar   (20 posts)  Bio
Date Reply #1 on Tue 23 Dec 2003 08:58 PM (UTC)
Message
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.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #2 on Wed 24 Dec 2003 03:03 AM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Gregar   (20 posts)  Bio
Date Reply #3 on Thu 25 Dec 2003 12:15 AM (UTC)
Message


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
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #4 on Thu 25 Dec 2003 12:20 AM (UTC)
Message
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.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


13,961 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.