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 :x Any advice? |
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.
|
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() { Code:
STR += (int)(STR * scaling / (float)scale_adjust); |
Quote:
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. |
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.
|
Quote:
Quote:
|
Quote:
|
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'
|
Quote:
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 :D 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. |
Quote:
|
Quote:
|
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 |
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. |
All times are GMT -4. The time now is 12:02 PM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.