Page 1 of 1

BUG: char(hp,regen)

Posted: Sun Nov 09, 2003 4:34 pm
by Teh_ish
$char(hp,regen) pumping out -430ish value in between ticks, w/ latest irc-latest.zip

Posted: Sun Nov 09, 2003 4:37 pm
by Lax

Code: Select all

	if (LastHealth && pChar->HPCurrent>LastHealth)
	{
		if (pChar->HPCurrent!=pChar->HPMax)
		{ // gained health, and not max
			HealthGained=pChar->HPCurrent-LastHealth;
		}
	}
	LastHealth=pChar->HPCurrent;
HealthGained (which is $char(hp,regen)) should never be negative. It's only set when current HPs are more than they were. If you can determine what's wrong I'll give you a cookie :)

Posted: Sun Nov 09, 2003 4:58 pm
by Teh_ish
It's only showing positive now..

I'm gonna throw out a guess, haven't confirmed yet but.. I think 433(value i'm getting regularly between ticks) is roughly the amount of +hp gear I've got on at the moment.

I'm back at negative after failing a mend.. Hrm..

I'm an iksar, curretnly get 4 regen per tick.

Numbers go like this:
-437, -433, -429, 4, repeat.
I just pased 433 hp and now it's:
4, half the tick, 433, half the tick, repeat.

Posted: Sun Nov 09, 2003 5:34 pm
by Teh_ish
Culprit Found: My +HP gear amounts to +433 hp. When I am below 433 hp it goes negative.

Posted: Mon Nov 10, 2003 12:50 am
by Lax
Hmm I see. I'll have to look into this and see whats going on.

Posted: Mon Nov 10, 2003 12:52 am
by Teh_ish
Lax wrote:Hmm I see. I'll have to look into this and see whats going on.
Great. I've confirmed, the number goes up in accordance to the +hp going up. Stays exactly the same.

Sorry to bug ya about it ;)

Posted: Mon Nov 10, 2003 7:56 pm
by Teh_ish
Ok, well I've looked at this and here's my thoughts:

It's pulling HPMax from the Spawninfo struct, which is not the character and thus I suspect that it does not include +hp items. As to how to fix this, I really don't know. Could make a function for GetMaxHP and cycle through a char's eq and pull out the +hp value.. Might be better just to add EQADDR_MAXHP if someone can find it in the offsets.

Posted: Mon Nov 10, 2003 8:55 pm
by Lax
Well, you'd be right except you're not :P I'll get it fixed sit tight.

Posted: Mon Nov 10, 2003 9:14 pm
by Teh_ish
Be sure to give a good explanation of what's borked/how to fix it. Trying to learn how all this stuff works ;)

Posted: Tue Nov 11, 2003 3:16 am
by Lax
Well, looking into the problem. It appears as though we catch it in the middle of updating hit points. I'm adding calls to the EQ_Character::Max_HP and Cur_HP functions ;) There's a different way to get it using a global variable from EQ, but that relies on a specific label being used and we can't guarantee that. Anyway, solving this now.

Posted: Tue Nov 11, 2003 3:58 am
by Lax
Zip updated, this works correctly all the time now.