--[[---------------------------------------------
This should be placed in a global file
]]
hp, mana, max, maxhp, maxmana = {}, {}, 255, 1000, 1000
for i = 1, max do
hp[i] = Condition(CONDITION_ATTRIBUTES)
hp[i]:setParameter(CONDITION_PARAM_SUBID, i)
hp[i]:setParameter(CONDITION_PARAM_TICKS, -1)
hp[i]:setParameter(CONDITION_PARAM_STAT_MAXHITPOINTS, maxhp)
mana[i] = Condition(CONDITION_ATTRIBUTES)
mana[i]:setParameter(CONDITION_PARAM_SUBID, i)
mana[i]:setParameter(CONDITION_PARAM_TICKS, -1)
mana[i]:setParameter(CONDITION_PARAM_STAT_MAXMANAPOINTS, maxmana)
end
buffstorage = { -- change the storage values to fit your needs
hp = 123456,
mana = 654321
}
function setCreatureMaxHealth(cid)
local player = Player(cid)
local n = player:getStorageValue(buffstorage.hp)
if n > 1 then
player:addCondition(hp[n])
else
player:addCondition(hp[1])
end
player:setStorageValue(buffstorage.hp, n > 1 and n or 1)
end
function setCreatureMaxMana(cid)
local player = Player(cid)
local n = player:getStorageValue(buffstorage.mana)
if n > 1 then
player:addCondition(mana[n])
else
player:addCondition(mana[1])
end
player:setStorageValue(buffstorage.mana, n > 1 and n or 1)
end
-------------------------------------------------