Shadowman321
Member
- Joined
- Mar 27, 2010
- Messages
- 205
- Reaction score
- 22
Code:
amount = {
-- [vocation] = {minmp, maxmp, minhp, maxhp}, (it will be multiplied by player level)
[1] = {3, 3.5, 0, 0},
[2] = {3, 3.5, 0, 0},
[3] = {1,1.2, 2, 2.2},
[4] = {0, 0, 5, 7},
[5] = {3, 3.5, 0, 0},
[6] = {3, 3.5, 0, 0},
[7] = {1,1.2, 2, 2.2},
[8] = {0, 0, 5, 7}
}
function onUse(cid, item, itemEx)
local lv = getPlayerLevel(cid)
local conf = {
v = amount[getPlayerVocation(cid)],
voc = getPlayerVocation(cid),
level = 180 -- min level
}
if getPlayerLevel(cid) >= conf.level then
doCreatureAddMana(cid, math.random((lv*conf.v[1]),(lv*conf.v[2])))
doCreatureAddHealth(cid, math.random((lv*conf.v[3]),(lv*conf.v[4])))
doCreatureSay(cid, "Aaaah... ", TALKTYPE_ORANGE_1)
doSendMagicEffect(getPlayerPosition(cid), 12)
else
doPlayerSendTextMessage(cid, 22, "Only players above " .. conf.level .. " level can drink this potion.")
end
end
Simply config.
Health and mana depends on vocation and level. You can simply exclude level dependence by removing "lv*" on lines where script add mana and health. And you can change min lvl to use potion. At last but not least, you can just change "local lv = getPlayerLevel(cid)" to "local lv = getPlayerSkill(cid, skillid)". And then mp/hp will depends on skill or magic level not on level.