altering do_save so level ones can save

Posted by Gadush on Sat 09 Apr 2005 11:38 PM — 8 posts, 29,962 views.

#0
Hi all,
I removed the mprog that advanced a character to level 2 upon a new character entering the mud, since I wanted all to start at level one.
It works, but a level one character is not allowed to save. Have to be level two.
So, I searched the source for the 'You have to be level two to save' message, and found it in act_comm, in function do_save.
Below is my modification.


void do_save( CHAR_DATA *ch, char *argument )
{
    if ( IS_NPC(ch) )
	return;
    /* if ( ch->level < 2 ) {
	send_to_char_color( "&BYou must be at least second level to save.\n\r", ch );
	return;
     }
    */

    WAIT_STATE( ch, 2 ); /* For big muds with save-happy players, like RoD */
    update_aris(ch);     /* update char affects and RIS */
    save_char_obj( ch );
    saving_char = NULL;
    send_to_char( "Saved...\n\r", ch );
    return;
}


I then made clean and compiled. Mud works good, but when a new character tries to save, they get the right message "Saved . . ." but their pfile does not get written. They are not, in fact, saved.
I read the posts on problems saving, but none of them seem to be this problem. All the directories are there, in the correct order. This is something I did by changing the code. Can anyone tell me what I did wrong? It seems like commenting out that if check would work, but I am just learning as I go.
Any help is appreciated.
Gadush
USA #1
You did that correctly, but the save goes beyond do_save. Check in the saving function, it'll have something like:
if ( ch->level < 2 )
return;
#2
Hmmm I can't find it. I searched the whole src folder with TextPad, and only found that string in two files, act_comm and act_info. The one in act_info was already commented out and regarded practice.
Anyone have a clue where or what is wrong here?
Thanks,
Gadush
USA #3
Check save_char_obj. Mine says (in save.c under save_char_obj):

    if ( IS_NPC(ch) || ch->level < 2 )
	return;

Remove the portion relating to level and you should be all set :)
#4
Thanks, Whiteknight. I changed that, and the pfile is now being written. It seems to not be writing the correct vnum of the room the character has saved in, but always sets it to 21001. I'll see if I can figure that out in a bit.
Gadush
USA #5
I think that there was a reason it could never save a level 1, but I'm not sure. Another way you can fix this is to simply set the starting level of players to 2.
USA #6
Well, I looked in mud.h and I saw this:

#define ROOM_VNUM_TEMPLE	  21001

Go around and see where it references to it, as your answer will be in there somewhere.

However, this seem's more likely to be the problem if its saving your vnum's a little funny (save.c under fwrite_char):

    fprintf( fp, "Room         %d\n",
	(  ch->in_room == get_room_index( ROOM_VNUM_LIMBO )
	&& ch->was_in_room )
	    ? ch->was_in_room->vnum
	    : ch->in_room->vnum );

Maybe you can find the problem based off those.
#7
Thanks for all the help guys. I haven't had time to search much today, but I tested a bit more. It is not saving my char position because I was in a new (unfinished) area when I logged out. Sorry for the confusion.
Once more, thanks a lot.
Gadush