Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
 Couple bugs
Today, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Sogou

Members: 0
Guests: 14
Stats
Files
Topics
Posts
Members
Newest Member
477
3,705
19,232
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » ?do_die?do_death?
Forum Rules | Mark all | Recent Posts

?do_die?do_death?
< Newer Topic :: Older Topic > Looking for help

Pages:<< prev 1 next >>
Post is unread #1 Oct 21, 2005, 6:46 pm
Go to the top of the page
Go to the bottom of the page

reaplo

GroupMembers
Posts6
JoinedOct 21, 2005

I am a newbie and having trouble finding specific code is there a more complete list than whats in the help files? Dis i miss something?
I am looking for the part of the code where it decides what happens when someone dies more specifically what happens with the corpse. Can someone point me in the right direction?
       
Post is unread #2 Oct 21, 2005, 11:27 pm
Go to the top of the page
Go to the bottom of the page

Greven
Magician
GroupMembers
Posts204
JoinedMar 5, 2005

You want to look at raw_kill in fight.c.
       
Post is unread #3 Oct 22, 2005, 1:07 am
Go to the top of the page
Go to the bottom of the page

reaplo

GroupMembers
Posts6
JoinedOct 21, 2005

I found that part and decided i need to make some changes to make_corpse
My aim is to make dloyal flag for objects to stay with players when they die
I changed makeobjs.c around line 200
FROM:
   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 );
   }

   obj_to_room( corpse, ch->in_room );
   return;

Heres how i think the above code works take objfromchar if its deathrot or INVENTORY(what does that mean?) destroy it else throw it in the corpse repeat till no objects left throw corpse on the ground
What i want to do is if the obj is ITEM_DLOYAL put it back in players inventory
so i changed
TO:
   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
      {
            if ( IS_OBJ_STAT( obj, ITEM_DLOYAL ))
            {
               obj_to_char( obj, ch );
            }
            else
            {
               obj_to_obj( obj, corpse );
            }
      }
   }

   obj_to_room( corpse, ch->in_room );
   return;


and i test it
i gave bread not flagged dloyal and a dagger that is flagged dloyal to a mort and let him get killed by a big mob
the dagger is totally vanished the corpse is still there and it has the bread in it i am not sure
what else to try
       
Post is unread #4 Oct 22, 2005, 5:47 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,858
JoinedJul 26, 2005

Try it like this
   for( obj = ch->first_carrying; obj; obj = obj_next )
   {
      obj_next = obj->next_content;
      if( IS_OBJ_STAT( obj, ITEM_DLOYAL ) )
         continue;
      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 );
   }

   obj_to_room( corpse, ch->in_room );
   return;

       
Post is unread #5 Oct 22, 2005, 11:03 am
Go to the top of the page
Go to the bottom of the page

reaplo

GroupMembers
Posts6
JoinedOct 21, 2005

The item is still missing
i am totally lost does the player get a new body or something? does something purge their inventory? i am going to remove that whole for loop and see what happens to items
       
Post is unread #6 Oct 22, 2005, 1:29 pm
Go to the top of the page
Go to the bottom of the page

reaplo

GroupMembers
Posts6
JoinedOct 21, 2005

ok i decided to mess with handler.c around line 1962 in the extract_char function
FROM:
   while( ( obj = ch->last_carrying ) != NULL )
      extract_obj( obj );


TO:
   for( obj = ch->first_carrying; obj; obj = obj_next )
   {
      if( IS_OBJ_STAT( obj, ITEM_DLOYAL ) )
	  continue;
	  extract_obj( obj );
   }


and i added OBJ_DATA *obj_next;

Now i get a seg fault but when the mud reboots the corpse is there empty and character still has the dloyal item
i used IS_OBJ_STAT( obj, ITEM_DLOYAL ) in other sections while trying to figure this out and got segfaults is there
somewhere i should be telling the function thats going to use IS_OBJ_STAT or referencing the ITEM_DLOYAL flag?
ITEM_DLOYAL is defined in mud.h
HELP!
       
Post is unread #7 Oct 22, 2005, 3:03 pm
Go to the top of the page
Go to the bottom of the page

reaplo

GroupMembers
Posts6
JoinedOct 21, 2005

Ok i fixed it but not sure of the other reprecussions i totally removed
   while( ( obj = ch->last_carrying ) != NULL )
      extract_obj( obj );


Anyone think that will cause a problem?
       
Post is unread #8 Oct 25, 2005, 10:58 am
Go to the top of the page
Go to the bottom of the page

Qidexan

GroupMembers
Posts20
JoinedOct 17, 2005

Bad idea. You need to extract the objects a character has when he quits or you end up with a memory leak.

switching the while statement to:
   for( obj = ch->first_carrying; obj; obj = obj_next )
   {
      if( IS_OBJ_STAT( obj, ITEM_DLOYAL ) )
      continue;
      extract_obj( obj );
   }


is on the right track, but you are never changing (and possibly never initializing) obj_next.

try replacing:
   while( ( obj = ch->last_carrying ) != NULL )
      extract_obj( obj );


with
   for( obj = ch->first_carrying; obj; obj = obj_next )
   {
      obj_next = obj->next_content;
      if( !fPull && IS_OBJ_STAT( obj, ITEM_DLOYAL ) )
          continue;
      else
          extract_obj( obj );
   }


This at least takes into consideration that you still want to extract objects when a character is quitting (fPull) and sets obj_next so you go through the entire inventory. It is untested though, so you may still need to fiddle with it.
       
Pages:<< prev 1 next >>