JDB
OtLand Veteran
- Joined
- Jun 1, 2009
- Messages
- 4,145
- Solutions
- 2
- Reaction score
- 115
Here is just a basic refill rune that I am releasing because it seems people still need it. If you need it, feel free to use it! :thumbup:
data/actions/actions.xml
data/actions/scripts/manarune.lua
Change...
to
And change...
to
Regards,
JDB.
data/actions/actions.xml
Code:
<action itemid="2294" event="script" value="manarune.lua"/>
data/actions/scripts/manarune.lua
Code:
local exhausted = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhausted, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
function onUse(cid, item, fromPosition, itemEx, toPosition)
local min, max
local lvl, mag = getPlayerLevel(cid), getPlayerMagLevel(cid)
if isSorcerer(cid) or isDruid(cid) then
min = lvl * 1.0 + mag * 1.0
max = lvl * 1.0 + mag * 1.0
elseif isPaladin(cid) then
min = lvl * 1.0 + mag * 1.0
max = lvl * 1.0 + mag * 1.0
elseif isKnight(cid) then
min = lvl * 0.5 + mag * 0.5
max = lvl * 1.0 + mag * 1.0
end
local rand = math.random(min, max)
if rand > 400 then
rand = 400
end
if rand < 100 then
rand = 100
end
if hasCondition(cid, CONDITION_EXHAUST_HEAL) then
return doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
end
if not isPlayer(itemEx.uid) then
return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
end
if(getCreatureMana(cid) >= getCreatureMaxMana(cid)) then
return doPlayerSendCancel(cid, "Your mana is currently full.")
end
return doChangeTypeItem(item.uid, item.type - 1) and doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE) and doPlayerAddMana(itemEx.uid, rand) and doAddCondition(cid, exhausted) and doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
end
- Want to refill health instead of mana? Continue reading!
Change...
Code:
doPlayerAddMana(itemEx.uid, rand)
to
Code:
doCreatureAddHealth(itemEx.uid, rand)
And change...
Code:
if(getCreatureMana(cid) >= getCreatureMaxMana(cid)) then
return doPlayerSendCancel(cid, "Your mana is currently full.")
end
to
Code:
if(getCreatureHealth(cid) >= getCreatureMaxHealth(cid)) then
return doPlayerSendCancel(cid, "Your health is currently full.")
end
Regards,
JDB.
Last edited: