• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved getCreatureMaxHealth.. only get base, not current?

Xikini

I whore myself out for likes
Senator
Premium User
Joined
Nov 17, 2010
Messages
6,795
Solutions
581
Reaction score
5,359
0.3.7
If someone has on an armor that has this in items.xml it will change their max hp up a percentage.
Code:
<attribute key="maxHealthPercent" value="130"/>
Now what I'm trying to do is find the creature/players max hp, but only their base, not with the accumulated armor value on-top.
Any idea's?
This is the current way I'm finding the creatures max hp, and as far as I can tell, there's no modifiers.
Code:
print(getCreatureMaxHealth(cid))
print(getCreatureMaxMana(cid))
 
The second param of the funcion is a boolean of the modifier, if is true then it will return the REAL hp/mana of the player.
 
The second param of the funcion is a boolean of the modifier, if is true then it will return the REAL hp/mana of the player.
Ugh I tried false, never tried true. Dx :p
Thanks.
Code:
print(getCreatureMaxHealth(cid, true))
print(getCreatureMaxMana(cid, true))
 
If that doesn't work.
Create the function

Code:
function getCreatureActualMaxHealth(cid)
    local Info = db.getResult('SELECT `healthmax` FROM `players` WHERE `id` = "' .. getPlayerGUID(cid) .. '" LIMIT 1')
    if Info:getID() ~= LUA_ERROR then
        local maxhealth = Info:getDataInt("healthmax")
        Info:free()
        return maxhealth
    end
    return LUA_ERROR
end
 
Back
Top