I get this error when I use my manarune and my code is down:
manarune script:
Code:
[11/10/2008 04:18:03] Lua Script Error: [Action Interface]
[11/10/2008 04:18:03] data/actions/scripts/manarunevipnytest.lua:onUse
[11/10/2008 04:18:03] data/actions/scripts/manarunevipnytest.lua:38: attempt to call global 'exhaust' (a nil value)
[11/10/2008 04:18:03] stack traceback:
[11/10/2008 04:18:03] data/actions/scripts/manarunevipnytest.lua:38: in function <data/actions/scripts/manarunevipnytest.lua:25>
manarune script:
Code:
-- Script 90% by Colandus and 10% by Souldrainer(Except for the exhaustion system).
-- If you edit this script, make sure to leave the credits to me, Colandus and me Souldrainer :) .
-- >>CONFIG<< --
local ACCESS = {NO_REMOVE = 5, NO_EXHAUST = 5} -- The access of players that does not lose charges/get exhausted using the rune.
local MIN_MANA = 100 -- How much mana minium will you get?
local MAX_MANA = 120 -- How much mana max will you get?
local STORE_VALUE = 3567 -- Value where exhaust is saved.
local EXHAUST_TIME = 1 -- Exhaust time in seconds.
local ANIMATION_COLOR = 41 -- The color of the "animation".
local VOCATIONS = {9, 10, 11, 12} -- Vocations that may use this rune.
-- >>CONFIG<< --
local vocMultiply = {0.35, 0.35, 0.85, 1.05, 0, 0, 0.65, 1.05}
local removeMana = 0
function comparePos(pos_1,pos_2)
if pos_1.x ~= pos_2.x or pos_1.y ~= pos_2.y then
return FALSE
else
return TRUE
end
end
function onUse(cid, item, frompos, item2, topos)
if isInArray(VOCATIONS, getPlayerVocation(cid)) == TRUE then
if isPlayer(item2.uid) == 1 then
local maxMana = getPlayerMaxMana(item2.uid)
local randMana = math.random(MIN_MANA, MAX_MANA)
if getPlayerVocation(cid) >= 1 and getPlayerVocation(cid) <= 8 then
removeMana = vocMultiply[getPlayerVocation(cid)]
end
local newMana = math.ceil(randMana + getPlayerLevel(cid) + getPlayerMagLevel(cid) - (randMana * removeMana))
if (maxMana - newMana) < 0 then
newMana = maxMana - getPlayerMana(cid)
end
if getPlayerMana(item2.uid) < maxMana then
if exhaust(cid, STORE_VALUE, EXHAUST_TIME) > 0 or getPlayerAccess(cid) >= ACCESS.NO_EXHAUST then
if getPlayerAccess(cid) < ACCESS.NO_REMOVE and math.random(1, 3) == 2 then
if item.type > 1 then
doChangeTypeItem(item.uid, item.type - 1)
else
doRemoveItem(item.uid, 1)
end
end
if comparePos(getPlayerPosition(cid),getPlayerPosition(item2.uid)) == TRUE then
doSendMagicEffect(getPlayerPosition(cid), 12)
doPlayerSendTextMessage(cid, 23, "You received " .. newMana .. " mana.")
else
doSendMagicEffect(getPlayerPosition(cid), 14)
doSendMagicEffect(getPlayerPosition(item2.uid), 12)
doPlayerSendTextMessage(item2.uid, 23, "You received " .. newMana .. " mana from " .. getPlayerName(cid) .. ".")
doPlayerSendTextMessage(cid, 23, "You gave " .. getPlayerName(item2.uid) .. " " .. newMana .. " mana.")
end
doPlayerAddMana(item2.uid, newMana)
doSendAnimatedText(getPlayerPosition(item2.uid), newMana, ANIMATION_COLOR)
else
doPlayerSendCancel(cid, "You are exhausted.")
end
else
if comparePos(getPlayerPosition(cid),getPlayerPosition(item2.uid)) == TRUE then
doPlayerSendCancel(item2.uid, "Your mana is already full.")
else
doPlayerSendCancel(cid, getPlayerName(item2.uid) .. " mana is already full.")
end
doSendMagicEffect(getPlayerPosition(cid), 2)
end
else
doPlayerSendCancel(cid, "You can only use this rune on players.")
doSendMagicEffect(getPlayerPosition(cid), 2)
end
else
doPlayerSendCancel(cid, "Your vocation cannot use this rune.")
doSendMagicEffect(getPlayerPosition(cid), 2)
end
return 1
end