you have to add this in pc_data

int		exp_to_lvl   /* The exp the pj has to gain a level */
int		exp_each_lvl /* The exp_per_level */



In the nanny stuff, just down of the  ch->exp = exp_per_level (ch, ch->pcdata->points);

add this:

ch->pcdata->exp_to_lvl = 0;
ch->pcdata->exp_each_lvl = ch->exp;


In fight.c add this:


find where you gain exp:

        xp = xp_compute (gch, victim, group_levels);

add this down your message of exp gain.

		ch->pcdata->exp_to_lvl += xp;

In update.c

Change this gain_exp to this:

void gain_exp (CHAR_DATA * ch, int gain)
{
    char buf[MAX_STRING_LENGTH];

    if (IS_NPC (ch) || ch->level >= LEVEL_HERO)
        return;

    ch->exp = UMAX (exp_per_level (ch, ch->pcdata->points), ch->exp + gain);
    while (ch->level < LEVEL_HERO && ch->pcdata->exp_to_lvl >= ch->pcdata->exp_por_lvl )
    {
        send_to_char ("{GYou gain a level!!  {x\n\r", ch);
        ch->level += 1;
		ch->pcdata->exp_to_lvl = 0; /* Reset the exp */
		ch->pcdata->exp_por_lvl += 100; /* Add 100 more exp to gain the next level */

		ch->pcdata->qpni = 0; // ad this if you have quests on your mud
        sprintf (buf, "$N has attained level %d!", ch->level);
        wiznet (buf, ch, NULL, WIZ_LEVELS, 0, 0);
        advance_level (ch, FALSE);
        save_char_obj (ch);
    }

    return;
}


Now the nicest part of this: A progress bar to show your exp_to_lvl :D

add it in do_score if you want.


	int percent;


	percent = ( (ch->pcdata->exp_to_lvl * 40 ) / ch->pcdata->exp_each_lvl);
	send_to_char("{C== {cPoints to gain a level:\n\r",ch);
    sprintf(buf, "\n\r		  {R-[{C");

    for( i = 0 ; i < percent ; i++)
	strcat(buf, "*");

    for( i = percent ; i < 40 ; i++)
	strcat(buf, " ");

    strcat(buf, "{R]-{x\n\r");
    send_to_char(buf, ch);
    send_to_char("\n\r", ch);



You are thinking why 40 and not 100? Here is the answer: If you put 100 the progress bar is like this:
[******													], or too long xD
and if (you put 40 its the same with 100, because you are setting the max at 40


Enjoy IT!

pagrodoconce@gmail.com

Kh4nn -> NvT INC.