View Single Post
  #3  
Old 08-10-2009, 10:15 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Do you have any specific examples of it not working? Giving the level, maxlevel, maxhp, actual hps (as seen in #showstats or #npcstats), and scalerate as examples?

Note that I added some extra code for NPCs that are level 25 or lower for their base level setting. This was added to help prevent stats (other than HPs) from scaling at insane rates, and can be adjusted with the scalerate setting still if needed.

Here is the full method for LevelScale as it is set now. Note the section in green for the part where I adjusted for lower levels to scale their stats a bit better:

Code:
void NPC::LevelScale() {

        int8 random_level = (MakeRandomInt(level, maxlevel));

        float scaling = (((random_level / (float)level) - 1) * (scalerate / 100.0f));
        
        // Compensate for scale rates at low levels so they don't add too much
        int8 scale_adjust = 1;
        if(level > 0 && level <= 5)
                scale_adjust = 10;
        if(level > 5 && level <= 10)
                scale_adjust = 5;
        if(level > 10 && level <= 15)
                scale_adjust = 3;
        if(level > 15 && level <= 25)
                scale_adjust = 2;

        max_hp += (max_hp * scaling);
        cur_hp = max_hp;
        STR += (int)(STR * scaling / scale_adjust);
        STA += (int)(STA * scaling / scale_adjust);
        AGI += (int)(AGI * scaling / scale_adjust);
        DEX += (int)(DEX * scaling / scale_adjust);
        INT += (int)(INT * scaling / scale_adjust);
        WIS += (int)(WIS * scaling / scale_adjust);
        CHA += (int)(CHA * scaling / scale_adjust);
        if (MR)
                MR += (int)(MR * scaling / scale_adjust); 
        if (CR)
                CR += (int)(CR * scaling / scale_adjust);
        if (DR)
                DR += (int)(DR * scaling / scale_adjust);
        if (FR)
                FR += (int)(FR * scaling / scale_adjust);
        if (PR)
                PR += (int)(PR * scaling / scale_adjust);

        if (max_dmg)
        {
                max_dmg += (int)(max_dmg * scaling / scale_adjust);
                min_dmg += (int)(min_dmg * scaling / scale_adjust);
        }

        level = random_level;

        return;
}
If there is an issue, it may just be that the scale_adjust needs to be set to (float)scale_adjust for the parts that are being divided by it. You can give that a try if you want and see if that corrects any issues you are seeing. Here is an example of how that might need to be set:

Code:
STR += (int)(STR * scaling / (float)scale_adjust);
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 08-11-2009 at 06:18 AM..
Reply With Quote