Top Mud Sites Forum

Top Mud Sites Forum (http://www.topmudsites.com/forums/index.php)
-   MUD Coding (http://www.topmudsites.com/forums/forumdisplay.php?f=9)
-   -   what am I missing? (http://www.topmudsites.com/forums/showthread.php?t=492)

Tavish 05-04-2002 11:10 AM

I have just toyed around with the exp_per_level function on a modified ROM codebase.  What I am attempting to do seemed quite simple but for some reason I am stuck with a strange return.

[code] int exp_per_level(CHAR_DATA *ch, int points)
{
   int expl,multip,tnl;
expl = 0;
tnl = UMAX(1000,points*25);

if (ch->level > 10)
{
multip =  (ch->level - 5) / 5;
expl = tnl * (multip + 1);
}
else
{
expl = tnl;
}
  return expl * pc_race_table[ch->race].class_mult[ch->class]/100;
}[/quote]

Starting at level 11 the exp_per_level begins to multiply (or at least it should).  I can advance characters to each multipler jump (11,16,21 etc.) and the tnl works just fine.  When a player levels from 10 to 11 the old fashion way the 11 to 12 tnl is outrageous, upwards of 14000.

What am I missing?

Alastair 05-04-2002 11:43 AM

Just a quick browsing, but I think your problem is here:
[code] multip =  (ch->level - 5) / 5;
expl = tnl * (multip + 1);[/quote]

A quick calculation shows that your tnl multiplier is 2.2 on level 11.

Whereas the multiplier only kicks in at level 11.

Teelf 05-04-2002 04:14 PM

The multiplier would actually be 2, but I think that is what Tavish is trying to accomplish?

You said it works fine when you jump a character to a level.  This function doesn't seem to care how they came to be their current level. So barring any freaky table lookup data, I am led to believe the problem lies elsewhere.

What is done with the return result?

Tavish 05-04-2002 05:18 PM

Thats the strange thing, and what I was hoping someone would know. The return's biggest use is in advance_level.


[code]
from gain_exp..

while ( ch->level < LEVEL_HERO && ch->exp >=
exp_per_level(ch,ch->pcdata->points) * (ch->level+1) )[/quote]

Now that basically stock code there, and calls a function advance_level which does the stat additions.

Teelf 05-04-2002 06:25 PM

Ok.  I think I get it.  

What your doing is manipulating the exp_per_level function based on the persons level.  Which, when you think about it, isn't a good thing.  

You are saying that when a person is level 10, their exp per level is 1000 (for example).  So they need (10 + 1) * 1000 exp or 11,000 exp to make lvl 11.  Then when they make lvl 11, they now need 2000 per level, (11 + 1) * 2000 or 24,000 exp to make lvl 12.  They only have 11,000, so they need 13,000 to make the next lvl.  

You'll have to move that lvl check somewhere else.  I'm not familiar with ROM, so I couldn't say where.

Good luck!

Tavish 05-04-2002 09:29 PM

Grrrr.. OK at least now I see what I was missing. Thanks Teelf. It was getting quite aggrevating as to why I could advance the player and the tnl be fine, plus someone actually went and made the 13000 needed for 12 and the tnl for 13 went back to normal. Just wasn't looking at the whole picture right, but now I can readjust it.


All times are GMT -4. The time now is 07:14 AM.

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright Top Mud Sites.com 2022