While the items.xml does not support level and vocation requirement, it can be done LUA.
potions.lua:
:thumbup:
potions.lua:
Code:
local greatHealthPot = 7591
local greatManaPot = 7590
local strongHealthPot = 7588
local strongManaPot = 7589
local healthPot = 7618
local manaPot = 7620
local greatEmptyPot = 7635
local strongEmptyPot = 7634
local emptyPot = 7636
local knightsandpaladins = {3, 4, 7, 8}
local druidsandsorcerers = {1, 2, 5, 6}
local druidspaladinsandsorcerers = {1, 2, 3, 5, 6, 7}
local knights = {4, 8}
function onUse(cid, item, frompos, item2, topos)
if(item.itemid == healthPot) then
if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 170, 230, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
doTransformItem(item.uid, emptyPot)
elseif(item.itemid == manaPot) then
if(doTargetCombatMana(0, cid, 170, 230, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
doTransformItem(item.uid, emptyPot)
elseif(item.itemid == strongHealthPot) then
if getPlayerLevel(cid) >= 50 and isInArray(knightsandpaladins, getPlayerVocation(cid)) == TRUE then
if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 300, 500, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
doTransformItem(item.uid, strongEmptyPot)
else
doCreatureSay(cid, "Only knights and paladins of level 50 or above may drink this fluid.", TALKTYPE_ORANGE_1)
end
elseif(item.itemid == strongManaPot) then
if getPlayerLevel(cid) >= 50 and isInArray(druidspaladinsandsorcerers, getPlayerVocation(cid)) == TRUE then
if(doTargetCombatMana(0, cid, 300, 500, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
doTransformItem(item.uid, strongEmptyPot)
else
doCreatureSay(cid, "Only druids, sorcerers and paladins of level 50 or above may drink this fluid.", TALKTYPE_ORANGE_1)
end
elseif(item.itemid == greatHealthPot) then
if getPlayerLevel(cid) >= 80 and isInArray(knights, getPlayerVocation(cid)) == TRUE then
if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 500, 800, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
doTransformItem(item.uid, greatEmptyPot)
else
doCreatureSay(cid, "Only knights of level 80 or above may drink this fluid.", TALKTYPE_ORANGE_1)
end
elseif(item.itemid == greatManaPot) then
if getPlayerLevel(cid) >= 80 and isInArray(druidsandsorcerers, getPlayerVocation(cid)) == TRUE then
if(doTargetCombatMana(0, cid, 500, 800, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
doTransformItem(item.uid, greatEmptyPot)
else
doCreatureSay(cid, "Only druids and sorcerers of level 80 or above may drink this fluid.", TALKTYPE_ORANGE_1)
end
end
return TRUE
end
:thumbup:
Last edited: