Charachters are losing items on save...

Posted by Grimm on Fri 01 Oct 2004 09:43 PM — 11 posts, 33,620 views.

#0
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.
Amended on Fri 01 Oct 2004 09:50 PM by Grimm
Canada #1
There is a specific check for keys, search for OBJ_KEY in save.c, and that should bring it up
USA #2
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?
#3
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

:)
#4
Just did a search through ALL the code for obj_key, and no luck. Would it be called something else maybe?
Canada #5
    /*
     * Castrate storage characters.
     */
    if ( obj->item_type == ITEM_KEY && !IS_OBJ_STAT(obj, ITEM_CLANOBJECT ))
	return;


fwrite_obj, save.c
Amended on Sat 02 Oct 2004 03:02 AM by Greven
#6
Ok - where can I find that line? And how do I change it to work so that the key stays in one's pocket?
Canada #7
Like I said, its in the fwrite_obj function, which is in save.c. All you need to do is remove that whole check.
#8
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...
Canada #9
Well, its only an issue if you are getting a bug message, are you?
#10
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.