Jacobs
Webdev, mapper
Hey, kind of getting back to lua and I don't understand why is my script being executed 3 times.
It has nothing to do with the 3 Ifs as I've tested it with just one in the beginning.
It keeps saying Gladiator 3 times in a row as well as it counts 10% of max hp 3 times in a row resulting into final of 133% maximum HP, instead of wanted 110%.
When you equip a helmet and you have the rest of the set equipped, your health is supposed to increase by 10%.
DeEquip works well as it's based on previous amount of health without any calculations.
It has nothing to do with the 3 Ifs as I've tested it with just one in the beginning.
It keeps saying Gladiator 3 times in a row as well as it counts 10% of max hp 3 times in a row resulting into final of 133% maximum HP, instead of wanted 110%.
When you equip a helmet and you have the rest of the set equipped, your health is supposed to increase by 10%.
DeEquip works well as it's based on previous amount of health without any calculations.
Code:
function onEquip(cid, item, slot)
local gM = getPlayerMaxMana(cid)
local gH = getCreatureMaxHealth(cid)
local newH = gH*1.1
local newM = gM*1.1
if getPlayerSlotItem(cid, CONST_SLOT_ARMOR).itemid == 12642 then -- +merc gl warplate
if getPlayerSlotItem(cid, CONST_SLOT_LEGS).itemid == 18405 then -- +merc gl wall
if getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid == 12646 then -- +merc gl greaves
doPlayerSendTextMessage(cid,22,"Gladiator")
Player(cid):setMaxHealth(newH)
Player(cid):setMaxMana(newM)
end
end
end
return TRUE
end