Hello! Im trying to create a script for when equipping an armor, you end up with 1hp and get extra mana. I know it's possible to do in items.xml however it doesn't give the desired effect when the item is removed. Which is that i want it to return to the hp/mana before equipping the item.
The script send the deEquip message, but nothing is really happening during the equip. All help would be appreciated.
This is what i've come up with so far...
The script send the deEquip message, but nothing is really happening during the equip. All help would be appreciated.
This is what i've come up with so far...
Code:
local hp = Combat()
hp:setParameter(CONDITION_PARAM_STAT_MAXHITPOINTS, 1)
hp:setParameter(CONDITION_PARAM_SUBID, 1)
local mana = Combat()
mana:setParameter(CONDITION_PARAM_STAT_MAXMANAPOINTS, 1)
mana:setParameter(CONDITION_PARAM_SUBID, 500)
function onEquip(cid, item, slot)
if getPlayerSlotItem(cid, slot).itemid == item.itemid then
local player = Player(cid)
player:addCondition(hp)
player:addCondition(mana)
player:setStorageValue(101703, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "on")
end
return true
end
function onDeEquip(cid, item, slot)
local player = Player(cid)
player:removeCondition(hp)
player:removeCondition(mana)
player:setStorageValue(101703, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "off")
return true
end