XP Part II [by Andy Hubbard]
Snippet Posted Wednesday, August 12th @ 11:39:41 PM, by George Greer in the Utils dept.
Added Mar 5, 1997. Click the link below to read it or download it.

From: Andy Hubbard <hub@leicester.ac.uk>
Subject: exp gain

Hi all,

 I base this bit of code on the snippet posted by Nic Suzor some
while ago, a patch which can be found in the contrib/code directory
at circlemud.org.

 Basically, after increasing the number of levels to about 200 I got
fed up of typing titles into the title array!  Plus when new classes
are added a lot of work is involved.

 I tried Nics patch, it seemed that there was always going to be an
erratic lurch in exp required each time you got to the
else if (GET_LEVEL(ch) < 60)
     modifier = 30;
(that may be my imagination or poor manual pathwork!)
and besides, it was all still far too much work for 200 lvls  :(

Hopefully this is an easy way to implement exp required and a simple
change in either utils.c or class.c will change the amounts needed
per lvl smoothly.  I also included a class distinction, keep the
numbers the same in class.c or do the same as me .... the differences
between levelling between classes at low lvl are small, but at higher
lvl .....

structs.h

 int spells_to_learn;

/* How many can you learn yet this level*/
 int player_size;
 int olc_zone;

!int emodifier;

/*Exp stuff: Andy*/
 int spare10;
 int spare11;


utils.h

 #define GET_BAD_PWS(ch)
((ch)->player_specials->saved.bad_pws)
 #define GET_TALK(ch, i)
((ch)->player_specials->saved.talks[i])
+#define GET_EMODIFIER(ch)  ((ch)->player_specials->saved.emodifier)/*Exp
stuff: Andy*/
 #define POOFIN(ch)
((ch)->player_specials->poofin)
 #define POOFOUT(ch)
((ch)->player_specials->poofout)


class.c

/* Some initializations for characters, including initial skills */
void do_start(struct char_data * ch) {
  void advance_level(struct char_data * ch);

  GET_LEVEL(ch) = 1;
  GET_EXP(ch) = 1;
+GET_EMODIFIER(ch) = 1;

/*Exp stuff: Andy*/

  set_title(ch, "\0");

####

/* the following provides an easy way to adjust exp required in a
progressive fashion and allows simple 'tweaking' Andy */

  case CLASS_MAGIC_USER:
    add_hp += number(1, 4);
    add_mana = number(GET_LEVEL(ch), (int) (1.5 * GET_LEVEL(ch)));
    add_mana = MIN(add_mana, 10); add_move = number(0, 2);
+GET_EMODIFIER(ch) = GET_EXP(ch) * 1.010;
/*Exp stuff: Andy,change values to suit*/
  break;

  case CLASS_CLERIC:
    add_hp += number(1, 8);
    add_mana = number(GET_LEVEL(ch), (int) (1.5 * GET_LEVEL(ch)));
    add_mana = MIN(add_mana, 10); add_move = number(0, 2);
+GET_EMODIFIER(ch) = GET_EXP(ch) * 1.020;
/*Exp stuff: Andy,change values to suit*/
  break;

  case CLASS_THIEF:
    add_hp += number(1, 6);
    add_mana = 0;
    add_move = number(1, 3);
+GET_EMODIFIER(ch) = GET_EXP(ch) * 1.015;
/*Exp stuff: Andy, change values to suit*/
  break;

  case CLASS_WARRIOR:
    add_hp += number(1, 10);
    add_mana = 0;
    add_move = number(1, 3);
+GET_EMODIFIER(ch) = GET_EXP(ch) * 1.025;
/*Exp stuff: Andy, change values to suit*/
  break;


utils.c

int exp_to_level(struct char_data *ch)
{
  int exp;

 exp = GET_LEVEL(ch) * 1500;
/*Exp stuff: Andy, change value to suit*/
 exp =  exp + GET_EMODIFIER(ch);

  return exp;
}

Then do everything else that Nic says about the title stuff and the
exp_to_level stuff.

Hope this proves useful

Andy


<< XP per Level and titles [by Nic Suzor/Dave Carver] | Reply | View as text | Threaded | Zone Command Force [by Andrey Fidrya] >>

 


Related Links
  CircleMUD
download
Related Articles
More by greerga
 
 

CircleMUD Snippets
 
Note: Not all of these snippets will work perfectly with your version of code, so be prepared to fix one or two bugs that may arise, and please let me know what you needed to do to fix it. Sending a corrected version is always welcome.
Finally, if you wish to use any of the snippets from this page, you are more than welcome, just mention the authors in your credits. If you wish to release any of these snippets to the public on another site, contact me FIRST.