• 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!

Lua getCreatureMaxHealth/Mana (??)

unicodem

New Member
Joined
Dec 18, 2011
Messages
48
Reaction score
1
Hi guys,
I have a big problem because when I'm wearing item :

<item id="2427" article="a" name="test pants">
<attribute key="weight" value="100"/>
<attribute key="armor" value="1"/>
<attribute key="slotType" value="legs"/>
<attribute key="maxhealthpoints" value="1000"/>
</item>

And using " Transform " then gets a health bonus from item and transformation.

Sample :
TEST 1HP
Equip armor 1001HP
Using transform 3003HP
DeEquip armor 2003 HP

local tabela = {
---Naruto---
[1] = {newvoc = 2, level = 30, hp = 1000}
}


function onCastSpell(cid, var)
local arr = tabela[getPlayerVocation(cid)]

if(arr ~= NULL) then
if getPlayerLevel(cid) >= arr.level then
doPlayerSetVocation(cid, arr.newvoc)
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + arr.hp)

else
doPlayerSendCancel(cid, "You need " .. arr.level .. " level to transform.")
end
else
doPlayerSendCancel(cid, "You don't have more transformations.")
end
return true
end
 
<attribute key="maxhealthpoints" value="1000"/>
This code give you 1000 hp when u equip item.

doPlayerSetVocation(cid, arr.newvoc)
This line changing your vocation.

setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + arr.hp)
This line changing your amount of max. health.

Sum up... Your script double time changing your amount of health.

Note!
You must create another script on deequip to check amount of health.
 
Back
Top