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
➜ Relocation after death..
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Ephyu
(7 posts) Bio
|
| Date
| Wed 16 Nov 2005 02:55 AM (UTC) |
| Message
| I've junked most of the original SMAUG area files, except a few necessary ones such as limbo.are, gods.are, help.are, etc.
I've encountered a problem in which players are teleported to Limbo on death, after a bug message saying the room they were supposed to be sent to did not exist..
How do I define what room players are sent to, as a default?
My overall purpose would be to transfer ALL characters to a designated resurrection shrine (a room in my starting city) on death. I still want to deduct their exp penalties, but I would like to have the character themself transferred (stats, inventory, and all), and a corpse-object created only as a formality, to mark the spot where they died.
Could anyone even begin to point me in the right direction? I've picked through fight.c and can't seem to find anything useful, except the corpse creation function and the exp deduction functions. I can't even figure out what line of code transfers the victim's inventory to his or her corpse.
Also, a stupid question: In the current system, where items stay on a corpse, how does the player who originally owned the items retrieve them from his or her corpse?
Please help a newbie coder. Thanks. | | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #1 on Wed 16 Nov 2005 12:57 PM (UTC) |
| Message
| In mud.h, it should be something like ROOM_VNUM_TEMPLE. Look in comm.c where players enter the game to be sure.
Check in the make_corpse function about corpses.
Do 'get all corpse' to get all the items from the corpse. |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| Ephyu
(7 posts) Bio
|
| Date
| Reply #2 on Fri 18 Nov 2005 11:43 PM (UTC) |
| Message
| Well, I've got it where the victim goes to my own defined "death" area, so that works.. It was ROOM_VNUM_ALTAR.
By messing with the make_corpse function I've successfully prevented it from putting the player's items on the corpse... but it still removes the items from the player's posession. They're completely destroyed upon death.
Any ideas on where I can find the code that removes the items? I want the player to reincarnate with all of his or her items, and just take the usual experience penalty. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Sat 19 Nov 2005 01:12 AM (UTC) |
| Message
| Shortly after the call to make_corpse it does extract_char, in which I see these lines:
while( ( obj = ch->last_carrying ) != NULL )
extract_obj( obj );
This seems to be removing the character's inventory.
An easy fix would be to simply move the corpse to the room where the character is placed, so he simply has to get his stuff back from the corpse.
Alternatively, you could maybe remove those lines, but I would be careful as they seem to apply to NPCs as well. You may create a massive memory leak if NPCs die, but their possessions are not removed.
Again, maybe just wait till the code is almost finished, and then put the objects back into it from the corpse, and destroy the corpse. Sounds messy, but I'm not enough of an expert of the inner workings of the code to say for sure. Maybe Samson would know? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Ephyu
(7 posts) Bio
|
| Date
| Reply #4 on Sat 19 Nov 2005 01:23 AM (UTC) |
| Message
| Well, I've found this:
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 );
}
I've removed the whole block of code for testing purposes, but I may reinstate the part pertaining to ITEM_INVENTORY and ITEM_DEATHROT if this works, as those have gameplay purposes.
I'm still working on it, so I'm not sure if it's completely successful. I know it prevents the items from going to the corpse, but they stil vanish from the player as well.
The code doesn't seem to affect NPCs, from the look of it, because it is inside the "else" brackets for the NPC check, and seems to apply to the player only. I also found code in fight.c that seems to control the removal of items from corpses after death, called a good many lines after the make_corpse function, I've removed it and am going to test it soon.. I'll post to let everyone know how that goes. | | Top |
|
| Posted by
| Ephyu
(7 posts) Bio
|
| Date
| Reply #5 on Sun 20 Nov 2005 10:06 PM (UTC) |
| Message
| Okay, fixed it. Players restart with their own items.
I found that block of code you mentioned (in handler.c, under extract_char, a few lines down) and changed it to:
if ( IS_NPC(ch) )
{
while ( (obj = ch->last_carrying) != NULL )
extract_obj(obj);
}
I did have to make some changes to fight.c to prevent characters from "resetting" on death as if they lost their items, but still allow that NPCs would reset..
Namely, I had to change an old block of code to:
if ( IS_NPC(victim) )
{
victim->resistant = 0;
victim->susceptible = 0;
victim->immune = 0;
victim->carry_weight= 0;
victim->armor = 100;
victim->armor += race_table[victim->race]->ac_plus;
victim->attacks = race_table[victim->race]->attacks;
victim->defenses = race_table[victim->race]->defenses;
victim->mod_str = 0;
victim->mod_dex = 0;
victim->mod_wis = 0;
victim->mod_int = 0;
victim->mod_con = 0;
victim->mod_cha = 0;
victim->mod_lck = 0;
victim->damroll = 0;
victim->hitroll = 0;
victim->alignment = URANGE( -1000, victim->alignment, 1000 );
/* victim->alignment = race_table[victim->race]->alignment;
-- switched lines just for now to prevent mortals from building up
days of bellyaching about their angelic or satanic humans becoming
neutral when they die given the difficulting of changing align */
victim->saving_poison_death = race_table[victim->race]->saving_poison_death;
victim->saving_wand = race_table[victim->race]->saving_wand;
victim->saving_para_petri = race_table[victim->race]->saving_para_petri;
victim->saving_breath = race_table[victim->race]->saving_breath;
victim->saving_spell_staff = race_table[victim->race]->saving_spell_staff;
victim->hit = UMAX( 1, victim->hit );
}
while ( victim->first_affect )
affect_remove( victim, victim->first_affect );
victim->affected_by = race_table[victim->race]->affected;
victim->mental_state = -10;
victim->alignment = URANGE( -1000, victim->alignment, 1000 );
victim->position = POS_RESTING;
/* Shut down some of those naked spammer killers - Blodkai */
if ( victim->level < 50 )
victim->mana = UMAX( 1, victim->mana );
else
victim->mana = 1;
victim->move = UMAX( 1, victim->move );
To find the old code, just search "bellyaching" within the fight.c document. =p
I'll post if any problems arise with this setup, but I think it's fixed. | | Top |
|
| Posted by
| Ephyu
(7 posts) Bio
|
| Date
| Reply #6 on Fri 25 Nov 2005 06:54 AM (UTC) |
| Message
| Okay, yeah, I found a problem.
In that last block of code, for some reason I posted
victim->hit = UMAX( 1, victim->hit );
within the if if ( IS_NPC(victim) ) section, and it should go OUTSIDE of it.
I fixed it on my own MUD immediately after the last post, but i thought I'd update here in case anyone tries duplicating this system.
If you leave that line in the place it is, you'll have the result of players entering Death with negative HP, then respawning with negative amounts of HP and being able to run around.. sometimes it's treated as invincibility, sometimes a gentle breeze kills them. It's odd. | | 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.
20,180 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top