EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Bug Reports (https://www.eqemulator.org/forums/forumdisplay.php?f=591)
-   -   A HUGE bug with quest::modifynpcstat (https://www.eqemulator.org/forums/showthread.php?t=28665)

ChaosSlayerZ 06-23-2009 01:09 AM

A HUGE bug with quest::modifynpcstat
 
I found a tremendous bug.

The quest::modifynpcstat(identifier, value) command when used for HP doesn't seem to hold for long.

For example let say that in DB a test npc had 400 hp.

You used a script in game and run

quest::modifynpcstat("max_hp", 3500);

All is fine- the npc now has 3500 hp...
Now if npc just stands put (or fights in melee)- he will remain this way.

Now gues what- if npc has a LIFETAP type spell casted on him his Hp will REVERT to his DB default!!!

At first I thought the script didn't run right. I re-run everything. and looked at #showstats - the npc had 3500hp.

My NPC started fighting A Spector.- and suddenly as soon as Spector proced Lifetap - my npc took a large drop in his hit points - I did #showstats again, and his MAX hp were reporting only as 400 again - his Db default.

Then i decided to check everything by hand.

I made a new npc. upped his hps. casted a lifetap on him MYSELF- and his EXTRA hp instantly faded!

Then I repeated same process using a level 1 fire nuke for 5 dmg - same thing! BOOM - and all extra hps are gone

Next try: I cast HP buff on him- BOOM - extra hps gone.

next try: casting heal - extra hps GONE!

next try: Armor buff! (no hps) - his curent hps remain at 3500, but his MaxHp become 400 again! (as reported by #showstats)



Now this ONLY happens with hit points. All other modified stats- ac, resist etc- they all hold.

I have tryed upping npc AC, and then casting AC buff on him - the AC seem to hold up, and buff stacked with modified AC

So, Any ideas on this? :cool:

PS: running Rev 535 atm

KLS 06-23-2009 01:29 AM

mmm I haven't experienced this but I'll take a look, I wanted to change/fiddle with some of the commands anyway.

ChaosSlayerZ 06-23-2009 01:33 AM

oh KLS btw I posted some new data on players fake hp buffs at Storm Heaven forums in that thread.

Shendare 06-23-2009 01:34 AM

Fiddle with them all you like. Just don't banjo with them. *shudder*

So_1337 06-23-2009 08:47 AM

Well that was a great laugh to start the day off =)

ChaosSlayerZ 06-23-2009 06:20 PM

Here is a little update.

I tried to go around quest::modifynpcstat(); and set hps directly with

$npc->SetHP(); and $npc->SetMaxHP();
(also tried using mob-> with same result)

with this simple script



Code:


sub EVENT_SAY
{       
        if($text=~/Hail/i)
        {       

            $npc->SetMaxHP(9999);       
        $npc->SetHP(9999);

        my $hps=$npc->GetHP();       
        my $maxhps=$npc->GetMaxHP();       

        quest::say("my hp is $hps  out of $maxhps");

        }
}



Results:

-if script contains: $npc->SetMaxHP(); the cript will NOT run - the npc will not reply to Hail at all.

-if script contains ONLY $npc->SetHP(); the ncp will reply to hail but comand WILL NOT have effect- his hps will remain an altered (default)

trevius 06-23-2009 06:25 PM

Using $mob instead of $npc should work just fine for the HP setting quest objects.

ChaosSlayerZ 06-23-2009 06:26 PM

I have just tried it- the script won't run at all - the npc won't even reply to hail :confused:

realityincarnate 06-23-2009 06:32 PM

The problem with the last script is that SetMaxHP doesn't do what you think it does. It doesn't take any arguments, and just sets the current hp to max. SetHP() seems to work fine, but it won't allow values higher than the max hp.

Of course, none of this solves your real problem, but it's all I know for sure while I'm sitting at work bored.

Shendare 06-23-2009 06:37 PM

Ahh, so npc->SetMaxHP() is basically a way of saying npc->SetHPToMax().

trevius 06-23-2009 06:40 PM

Ahh, I guess it is $npc after all. Maybe I was thinking of what it shows in the wiki as an example for using that object. Here is an example of one of the quests for SH that use SetHP and it definitely works without any bugs:

$npc->SetHP($hp_increase);

The $hp_increase variable in this case is just something we use for calculating how much to heal the NPC for when certain things happen. That should be replaced with the amount of Current (not max) HPs you want the NPC to have. So, if your NPC has a max of 1000 hps, you could set it to half health by doing:

$npc->SetHP(500);

ChaosSlayerZ 06-23-2009 07:26 PM

ok I got it.
In otherowrds neither of the 2 comands can be used to go above default hps.
Well thats good to know, sicne wiki doens't actualy specify that

But we still have a problem with quest::modifystat =(

realityincarnate 06-23-2009 08:06 PM

I haven't looked into it much, but I did see that quest::modifynpcstat() does change the maxhp for the mob it's called on. So, based on your description, I'd guess that it's actually a problem with something in the spell handling. It probably pulls a max hp value from the database somewhere.

If you modify an npc and fight it without ever casting a spell, does it work properly? Conversely, does anything other than spells cause it to reset?

ChaosSlayerZ 06-23-2009 08:13 PM

Quote:

Originally Posted by realityincarnate (Post 172802)
I haven't looked into it much, but I did see that quest::modifynpcstat() does change the maxhp for the mob it's called on. So, based on your description, I'd guess that it's actually a problem with something in the spell handling. It probably pulls a max hp value from the database somewhere.

If you modify an npc and fight it without ever casting a spell, does it work properly? Conversely, does anything other than spells cause it to reset?

Yes. if no spells are casted on NPC- and it just fights - as it takes melee dmg, the hps are updated corectly with new max in mind.

So far I cannot tell if anything else can cuase hps to revert other that spells

Note that not just the nukes cause hps to revert- casting a pure Ac buff , or haste or stat buff/debuff - causes the revert of hp to default

realityincarnate 06-23-2009 09:08 PM

Ok, I think I got it. Anytime a spell lands, it recalculates the max hp in case the spell granted any bonuses. The command was directly changing the npc's max hp but not changing the base value that was used in these calculations. I seem to have it fixed in revision 709, but it could probably use some more rigorous testing.


All times are GMT -4. The time now is 12:52 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.