lua_baseentity:getMeleeHitDamage returning 4294967295?
Posted: Mon Aug 13, 2012 11:51 pm
Just checking if this is expected behavior before reporting it. The comments make it sound like I should be getting a -1 on miss, but according to printf("Damage: %u",damage); I'm getting a rather full 16-bit integer. Code in use is below, in case it's my gaffe.
I'm also getting a "<Player> uses Jump. \ The <target> takes 65535 points of damage." message on misses without return 0, if anybody wants to tell me what I'm doing wrong. Not sure how I'm going to cross that hurdle, actually. (see edit below)
Yes, even with my "damage > 65k."
I've also tried return -1, which did the same thing.
Edit:
First half still stands, I'd like to know if that's expected behavior. I'll report it properly if it's not.
Second half... yeesh. Don't sweat that too much. Jump needs a dedicated core function. Just... there would be so many missing caveats to regular behavior with getMeleeHitDamage. Dual-wielding, TP return, crits, en-spell damage, additional effects, gear modifying all of that... I can dump my research/code somewhere if someone wants to pick the baton up, but it needs a core function and I can't code that. Sorry. I better understand why nobody's coded Jump now.
Code: Select all
damage = player:getMeleeHitDamage(target);
-- Returns -1 on miss
printf("Damage: %u",damage);
if(damage == -1 or damage == 0 or damage > 65000) then
-- Return miss message how? Try passing -1 eventually.
player:messageBasic(324,66,target);
return 0;
else
target:delHP(damage);
target:updateEnmityFromDamage(player,damage);
return damage;
end
Yes, even with my "damage > 65k."
I've also tried return -1, which did the same thing.
Edit:
First half still stands, I'd like to know if that's expected behavior. I'll report it properly if it's not.
Second half... yeesh. Don't sweat that too much. Jump needs a dedicated core function. Just... there would be so many missing caveats to regular behavior with getMeleeHitDamage. Dual-wielding, TP return, crits, en-spell damage, additional effects, gear modifying all of that... I can dump my research/code somewhere if someone wants to pick the baton up, but it needs a core function and I can't code that. Sorry. I better understand why nobody's coded Jump now.