[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Charachters are losing items on save...

Charachters are losing items on save...

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


Posted by Grimm   (17 posts)  [Biography] bio
Date Fri 01 Oct 2004 09:43 PM (UTC)

Amended on Fri 01 Oct 2004 09:50 PM (UTC) by Grimm

Message
Yet another little issue that's been popping up for me. I have been able to remove the level restrictions on weapons and armor for my players, but sometimes, if they have a weapon equipped that is of a higher level than they are, it is deleted from their inventory when they quit - even after saving. I have looked everywhere I can think of in the code for this reference, but I'm really not sure exactly what to look for.

Any ideas?

EDIT - I also seem to have a key that won't save either - it disappears from inventory every time I re-log.
[Go to top] top

Posted by Greven   Canada  (835 posts)  [Biography] bio
Date Reply #1 on Sat 02 Oct 2004 01:08 AM (UTC)
Message
There is a specific check for keys, search for OBJ_KEY in save.c, and that should bring it up

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio
Date Reply #2 on Sat 02 Oct 2004 01:55 AM (UTC)
Message
In your last topic "Old subject, but I'm in need of assistance (weapon levels in shops)", you asked where to find the part that removed items that were above their level, and I told you to look for a certain ifcheck. Then you said you found it. Did it not work?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Grimm   (17 posts)  [Biography] bio
Date Reply #3 on Sat 02 Oct 2004 02:10 AM (UTC)
Message
It worked for allowing players to wield weapons above their level, but every now and again, the weapons and armor get taken away when the player quits. It happened to me twice today while testing.

I will look for the key in save.c - what do I do when I get there?

<-coding n00b

:)
[Go to top] top

Posted by Grimm   (17 posts)  [Biography] bio
Date Reply #4 on Sat 02 Oct 2004 02:15 AM (UTC)
Message
Just did a search through ALL the code for obj_key, and no luck. Would it be called something else maybe?
[Go to top] top

Posted by Greven   Canada  (835 posts)  [Biography] bio
Date Reply #5 on Sat 02 Oct 2004 03:00 AM (UTC)

Amended on Sat 02 Oct 2004 03:02 AM (UTC) by Greven

Message
    /*
     * Castrate storage characters.
     */
    if ( obj->item_type == ITEM_KEY && !IS_OBJ_STAT(obj, ITEM_CLANOBJECT ))
	return;


fwrite_obj, save.c

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
[Go to top] top

Posted by Grimm   (17 posts)  [Biography] bio
Date Reply #6 on Sat 02 Oct 2004 04:57 PM (UTC)
Message
Ok - where can I find that line? And how do I change it to work so that the key stays in one's pocket?
[Go to top] top

Posted by Greven   Canada  (835 posts)  [Biography] bio
Date Reply #7 on Sat 02 Oct 2004 07:47 PM (UTC)
Message
Like I said, its in the fwrite_obj function, which is in save.c. All you need to do is remove that whole check.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
[Go to top] top

Posted by Grimm   (17 posts)  [Biography] bio
Date Reply #8 on Fri 08 Oct 2004 12:57 AM (UTC)
Message
Ok - I removed that check, but the key still isn't saving with the char's. Might this bit of code have something to do with the prob as well?



/*
 * Un-equip character before saving to ensure proper	-Thoric
 * stats are saved in case of changes to or removal of EQ
 */
void de_equip_char( CHAR_DATA *ch )
{
    char buf[MAX_STRING_LENGTH];
    OBJ_DATA *obj;
    int x,y;

    for ( x = 0; x < MAX_WEAR; x++ )
	for ( y = 0; y < MAX_LAYERS; y++ )
	    save_equipment[x][y] = NULL;
    for ( obj = ch->first_carrying; obj; obj = obj->next_content )
	if ( obj->wear_loc > -1 && obj->wear_loc < MAX_WEAR )
	{
	    if ( get_trust( ch ) >= obj->level )
	    {
		for ( x = 0; x < MAX_LAYERS; x++ )
		   if ( !save_equipment[obj->wear_loc][x] )
		   {
			save_equipment[obj->wear_loc][x] = obj;
			break;
		   }
		if ( x == MAX_LAYERS )
		{
		    sprintf( buf, "%s had on more than %d layers of clothing in one location (%d): %s",
			ch->name, MAX_LAYERS, obj->wear_loc, obj->name );
		    bug( buf, 0 );
		}
	    }
	    else
	    {
	       sprintf( buf, "%s had on %s:  ch->level = %d  obj->level = %d",
		ch->name, obj->name,
	       	ch->level, obj->level );
	       bug( buf, 0 );
	    }
	    unequip_char(ch, obj);
	}
}


It seems to refer to the object level and whether it gets un-equipped at save time...
[Go to top] top

Posted by Greven   Canada  (835 posts)  [Biography] bio
Date Reply #9 on Fri 08 Oct 2004 01:23 AM (UTC)
Message
Well, its only an issue if you are getting a bug message, are you?

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
[Go to top] top

Posted by Grimm   (17 posts)  [Biography] bio
Date Reply #10 on Fri 08 Oct 2004 01:33 AM (UTC)
Message
Yes. When the charachters save, *sometimes* I get the message contained in the above code:

sprintf( buf, "%s had on %s: ch->level = %d obj->level = %d",
ch->name, obj->name,
ch->level, obj->level );

and it lists the object level in contrast to the player level, and when the player logs back on, the armor they were wearing, along with any keys, is gone.
[Go to top] 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,636 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]