[CODE] Multiclass problem

From: Phillip A Ames (kirk47@juno.com)
Date: 08/25/99

Hi all, in my effort to perfect my multiclass code, I've hacked up a
function that (should) tell the players how many times they can level in
each different class, based on their current exp.  It's (appropriately)
named 'level_check'.  Now, the problem is this.  Whenever a player gets
any amount of exp, even if its 1 and they had 0 before, this is the

You receive 38 experience points.
You can rise 1345210671 level in: Command
You can rise 1345210671 level in: Helm
You can rise 1345210672 level in: Communications
You can rise 1345210673 level in: Engineer
You can rise 1345210674 level in: Security
You can rise 1345210675 level in: Tactical
You can rise 1345210676 level in: Medical
You can rise 1345210677 level in: Operations
You can rise 1345210678 level in: Science
You can rise 1345210679 level in: Global

Obviously, something is wrong, since they should need about 29,962 exp
more to level 1 more level.  Here's the function, apologies in advance
for the ugliness in formatting, etc.

void level_check(struct char_data *ch){
int i, check_class_lev, num_levels;
char classname[MAX_STRING_LENGTH+1];

sprintf(buf, ""); // Clear anything in buf since we use sprintf(buf +
strlen(buf) ...)

for(i = 0; i < NUM_CLASSES; i++){

for(check_class_lev = GET_CLASS_LEV(ch, i), check_class_lev++;
GET_EXP(ch) > level_exp(check_class_lev); check_class_lev+=1){ // Check
if they have enough XP to level, and how many times, in each class
if(num_levels > 0){
    sprinttype(i, pc_class_types, classname);
    sprintf(buf + strlen(buf), "You can rise %d level%s in: %s\r\n",
num_levels, num_levels > 1 ? "" : "s", classname);

send_to_char(buf, ch);


Now, I think the problem lies in the for loop(d'uh).  But I, for the life
of me, can't figure it out.  And in case you were wondering, level_exp is
being called properly - each class has the exact same amount of XP needed
to level for each different level, so I need no class integer at the end
of calling it.  And in the code where it advances them a level, it will
subtract the amount of XP they needed to level from their EXP so I know
THAT isn't the problem.  Thanks in advance for any help you guys can


Phillip Ames    | Implementor of Apocalypse MUD
kirk47@juno.com | telnet://startrek.circlemud.net:1701
ICQ: 8778335    | AOL IM: Grathol

Get the Internet just the way you want it.
Free software, free e-mail, and free Internet access for a month!
Try Juno Web: http://dl.www.juno.com/dynoget/tagj.

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |

This archive was generated by hypermail 2b30 : 12/15/00 PST