|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Development::Bug Reports Post detailed bug reports and what you would like to see next in the emu here. |
08-10-2009, 09:26 PM
|
|
Demi-God
|
|
Join Date: May 2007
Location: b
Posts: 1,447
|
|
Issue with maxlevel
Figure I post this here so it doesn't get lost. Maxlevel scaling isn't working for certain NPCs. I can't find a pattern to it, and it's not related to the lower level stuff. I tried to use level scaling stuff on NPCs and some NPCs end up with -133% health when others scale perfectly fine. I tried this in a zone where the maxlevel was 20 and the level field was 1. (1-20)
I'm guessing it's another rounding issue like we were having before on IRC but I would have no idea where
Any advice?
|
08-10-2009, 09:26 PM
|
|
Demi-God
|
|
Join Date: May 2007
Location: b
Posts: 1,447
|
|
Also, the scalerate field doesn't seem to affect this. It scales the NPCs properly, it just doesn't work half the time. It may be class related, but again, I don't know.
|
|
|
|
08-10-2009, 10:15 PM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
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);
Last edited by trevius; 08-11-2009 at 06:18 AM..
|
|
|
|
|
|
|
08-10-2009, 10:18 PM
|
|
Demi-God
|
|
Join Date: May 2007
Location: b
Posts: 1,447
|
|
Quote:
Originally Posted by trevius
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;
}
|
Yeah, I am looking at a level 16 NPC with base HP (which is 100) from the database (the hp field) and 187 stats (all stats are 75 in the database and scalerate is set to 100%.)
Something also to note is the NPC is wielding a statless 2Hander. It is also a warrior. It also happens to the same NPCs each time.
|
|
|
|
08-10-2009, 10:21 PM
|
|
Demi-God
|
|
Join Date: May 2007
Location: b
Posts: 1,447
|
|
Also, to narrow it down a bit, even with int placed in front of maxhp like the other ones, it still happens. So it's definately not related to a lack of int in front of the hp. The other stats still work fine, which makes me worried that it's some HP thingy.
|
|
|
|
08-10-2009, 10:26 PM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
Quote:
Originally Posted by Secrets
Yeah, I am looking at a level 16 NPC with base HP (which is 100) from the database (the hp field) and 187 stats (all stats are 75 in the database and scalerate is set to 100%.)
Something also to note is the NPC is wielding a statless 2Hander. It is also a warrior. It also happens to the same NPCs each time.
|
The NPC is level 16, but is that the level or the random level generated from maxlevel? Are you using an NPC that can scale from level 1 up to 16 or so? This scaling system is specifically meant for very small level ranges at the low level range. It can be used for more variance in level range the higher level you go, but at the low level range it would be really hard to control how stats scale to give good enough results if you are using a very wide range like 1 to 20 or so. For lower than level 25 or so, I would recommend keeping the level and maxlevel settings within 5 levels or less most of the time. If you were doing level 40 to maxlevel 50 ranges (or higher level ranges), that wouldn't be as bad because the scaling would be quite a bit more leveled in that range.
Quote:
Originally Posted by Secrets
Also, to narrow it down a bit, even with int placed in front of maxhp like the other ones, it still happens. So it's definately not related to a lack of int in front of the hp. The other stats still work fine, which makes me worried that it's some HP thingy.
|
If you notice this only on NPC that actually wear equipment (visible), then it could possibly be something related to the hp calculating functions that get used when calculating bonuses for NPCs for the gear they are wearing. If it is doing those calculations before the level scaling portion is run, it could probably effect the total outcome. Though, I don't think that would be the case. Everything for checking level should be using GetLevel, which gets the actual variable "level", which is what the scaling is setting. I think HPs may do the same, but maybe I need to check out the GetHP() method to make sure nothing is actually pulling that info from the database value.
Last edited by trevius; 08-11-2009 at 06:30 AM..
|
|
|
|
|
|
|
08-10-2009, 10:29 PM
|
|
Demi-God
|
|
Join Date: May 2007
Location: b
Posts: 1,447
|
|
Quote:
Originally Posted by trevius
The NPC is level 16, but is that the level or the random level generated from maxlevel? Are you using an NPC that can scale from level 1 up to 16 or so? This scaling system is specifically meant for very small level ranges at the low level range. It can be used for more variance in level range the higher level you go, but at the low level range it would be really hard to control how stats scale to give good enough results if you are using a very wide range like 1 to 20 or so. For lower than level 25 or so, I would recommend keeping the level and maxlevel settings within 5 levels or less most of the time. If you were doing level 40 to maxlevel 50 ranges (or higher level ranges), that wouldn't be as bad because the scaling would be quite a bit more leveled in that range.
|
Random generated from maxlevel. I'll try to keep it 1-10 and see how that goes. Due to the gear on my server, those mobs would not be hard that were generated. But the issue might still stand. We'll see. Tweaking it now, will post results.
|
|
|
|
08-10-2009, 10:35 PM
|
|
Demi-God
|
|
Join Date: May 2007
Location: b
Posts: 1,447
|
|
Still the same issue, -111% HP on the NPC on range 1-5 with a level 4 NPC on the same mob. 100 hp, 97 stats, 88 resists. I think HP is the culprit once again, and not my outrageous scaling. I'm willing to bet it's recalculated for warriors and when specific buffs hit NPCs, but I am not sure. I'll post back when I do some more testing/debuggin'
|
|
|
|
08-10-2009, 10:39 PM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
Quote:
Originally Posted by Secrets
Random generated from maxlevel. I'll try to keep it 1-10 and see how that goes. Due to the gear on my server, those mobs would not be hard that were generated. But the issue might still stand. We'll see. Tweaking it now, will post results.
|
Ahh, so your level was set at 1 for that level 16 NPC? That will definitely have an effect on how the stats scale, since every level will multiply all stats on the NPC by the base of each stat. So, a level 10 NPC would have 10X as many HPs, STR, STA, etc. Since I put the extra code in to help with lower level stat scaling, the HPs result shouldn't be too bad, but the STR, STA, etc will still be considerably higher than a normal NPC in that level range. If base stats are 75, a level 10 NPC would have an additional 750 / 10 (75) to each stat to total 150 to each STR, STA, etc. Going higher than that will just increase it even further, so your level 16 NPC probably has 200 or more to each stat, which is very extreme!
I am sure that a system could be created to allow NPCs to scale at a good enough rate that they could scale from level 1 to 60 for the same NPC, but that is not what this scaling is designed for. The idea of this scaling is to replace the need to have 5 NPCs with the same name, and in the same spawn group just to have an NPC that can vary from level 10 - 15 (or whatever range you want). It allows for some more dynamics in a zone with very minimal work to do it. I went through and added the level scaling to 2 of my new SoF zones last night and it took only about 10 minutes That would have taken forever to do the old way of creating new NPCs and spawngroups. Not to mention, it just makes for a cleaner/smaller database and easier to manage a zone full of NPCs.
|
|
|
|
08-10-2009, 10:41 PM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
Quote:
Originally Posted by Secrets
Still the same issue, -111% HP on the NPC on range 1-5 with a level 4 NPC on the same mob. 100 hp, 97 stats, 88 resists. I think HP is the culprit once again, and not my outrageous scaling. I'm willing to bet it's recalculated for warriors and when specific buffs hit NPCs, but I am not sure. I'll post back when I do some more testing/debuggin'
|
It's possible that they may be getting calculated again, but I would think they would use the same setting that is being set for scaling. I haven't tested them with buffs or items, but all of my NPCs set to scale seem to do so very well so far.
|
08-10-2009, 10:45 PM
|
|
Demi-God
|
|
Join Date: May 2007
Location: b
Posts: 1,447
|
|
Quote:
Originally Posted by trevius
It's possible that they may be getting calculated again, but I would think they would use the same setting that is being set for scaling. I haven't tested them with buffs or items, but all of my NPCs set to scale seem to do so very well so far.
|
I tried it locally and i'm going to try and debug this thing. It almost has to be related to items, as the same NPC spawns without items and it works perfectly normal. Or buffs, for that matter ;p
|
08-10-2009, 11:03 PM
|
|
Demi-God
|
|
Join Date: May 2007
Location: b
Posts: 1,447
|
|
Yep, definately related to buffs and items equipped by NPCs. It adds to the NPC's base hp when an item gets added to a mob and the mob equips it. Thus, it adds 0 to base HP, recalculates base HP, and sends it to the mob. That's why the client sees -133% HP, it's getting WAY higher HP in a packet, but the mob actually has less serversided. When the client targets it, it shows the number, and when you showstats the NPC, the number is 100.
Now to fix this. :P
|
08-10-2009, 11:29 PM
|
|
Demi-God
|
|
Join Date: May 2007
Location: b
Posts: 1,447
|
|
Fixed it, I think. We need to modify the NPC's base_hp as well as max_hp. Though, I think we probably are better off modifying both, as it is a mod ontop of the base and max HP.
When the calc check goes through for CalcMaxHP in mob.h, it works when base_hp is also there.
Items also get taken into effect this way, too.
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 12:42 AM.
|
|
|
|
|
|
|
|
|
|
|
|
|