It was solved, thank you ♥♥
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if not player then
return false
end
local level = player:getLevel()
local mlevel = player:getMagicLevel()
-- Exhaustion Settings --
local exhausted_seconds = 10 -- How many seconds the mana rune will be unavailable to use.
local exhausted_storagevalue = 1555 -- Storage Value to store exhaustion state. MUST be an unused value!
-- Exhaustion Settings END --
-- Mana Formula Settings --
-- You can use "level" and "mlevel" --
local mana_minimum = (level * 3) + (mlevel * 5) - 50
local mana_maximum = (level * 3) +...
<action itemid="2270" script="manarune.lua" />
function onUse(cid, item, frompos, item2, topos)
local level = getPlayerLevel(cid)
local mlevel = getPlayerMagLevel(cid)
-- Exhausted Settings --
local exhausted_seconds = 1 -- How many seconds manarune will be unavailible to use. --
local exhausted_storagevalue = 1555 -- Storage Value to store exhaust. It MUST be unused! --
-- Exhausted Settings END --
-- Mana Formula Settings --
-- You can use "level" and "mlevel" --
local mana_minimum = (level * 3) + (mlevel * 5) - 50
local mana_maximum = (level * 3) + (mlevel * 5)
-- Mana Formula Settings END --
local mana_add = math.random(mana_minimum, mana_maximum)
-- We check the charges. --
if(item.type > 1) then
-- Exhausted check. --
if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
-- Entity is player? --
if(isPlayer(item2.uid) == 1) then
doSendMagicEffect(topos,28)
doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
doSendAnimatedText(topos, mana_add, TEXTCOLOR_LIGHTBLUE)
doPlayerSay(cid,"Mana UUPP!!!",1)
doPlayerAddMana(item2.uid, mana_add)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
doChangeTypeItem(item.uid, item.type - 1)
else
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You can use this rune only on players.")
end
else
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You are exhausted.")
end
else
if(os.time() < getPlayerStorageValue(cid, exhausted_storagevalue)) then
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You are exhausted.")
else
if(isPlayer(item2.uid) == 1) then
doSendMagicEffect(topos,28)
doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
doSendAnimatedText(topos, mana_add, TEXTCOLOR_LIGHTBLUE)
doPlayerSay(cid,"Mana UUPP!!!",1)
doPlayerAddMana(item2.uid, mana_add)
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
doRemoveItem(item.uid, 1)
else
doSendMagicEffect(frompos, CONST_ME_POFF)
doPlayerSendCancel(cid, "You can use this rune only on players.")
end
end
end
return 1
end
player:addMana(manaToAdd)
player:say("Your mana has been increased by " .. manaToAdd .. " points!", TALKTYPE_ORANGE_1)
function onUse(cid, item, frompos, item2, topos)
local player = Player(cid)
if not player then
return false
end
local level = player:getLevel()
local mlevel = player:getMagicLevel()
-- Exhaustion Settings --
local exhausted_seconds = 1 -- How many seconds the mana rune will be unavailable to use.
local exhausted_storagevalue = 1555 -- Storage Value to store exhaustion state. MUST be an unused value!
-- Exhaustion Settings END --
-- Mana Formula Settings --
-- You can use "level" and "mlevel" --
local mana_minimum = (level * 3) + (mlevel * 5) - 50
local mana_maximum = (level * 3) + (mlevel * 5)
-- Mana Formula Settings END --
local mana_add = math.random(mana_minimum, mana_maximum)
-- Checking charges. --
if (item.type > 1) then
-- Exhaustion check. --
if (os.time() > player:getStorageValue(exhausted_storagevalue)) then
-- Is the entity a player? --
if (isPlayer(item2.uid)) then
player:getPosition():sendMagicEffect(topos, 28)
player:getPosition():sendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
Game.sendAnimatedText("+" .. mana_add .. " Mana", topos, TEXTCOLOR_LIGHTBLUE)
player:say("Mana UUPP!!!", TALKTYPE_ORANGE_1)
player:addMana(mana_add)
player:setStorageValue(exhausted_storagevalue, os.time() + exhausted_seconds)
item:transform(item.type - 1)
else
player:getPosition():sendMagicEffect(frompos, CONST_ME_POFF)
player:sendCancelMessage("You can only use this rune on players.")
end
else
player:getPosition():sendMagicEffect(frompos, CONST_ME_POFF)
player:sendCancelMessage("You are exhausted.")
end
else
if (os.time() < player:getStorageValue(exhausted_storagevalue)) then
player:getPosition():sendMagicEffect(frompos, CONST_ME_POFF)
player:sendCancelMessage("You are exhausted.")
else
if (isPlayer(item2.uid)) then
player:getPosition():sendMagicEffect(topos, 28)
player:getPosition():sendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
Game.sendAnimatedText("+" .. mana_add .. " Mana", topos, TEXTCOLOR_LIGHTBLUE)
player:say("Mana UUPP!!!", TALKTYPE_ORANGE_1)
player:addMana(mana_add)
player:setStorageValue(exhausted_storagevalue, os.time() + exhausted_seconds)
item:remove(1)
else
player:getPosition():sendMagicEffect(frompos, CONST_ME_POFF)
player:sendCancelMessage("You can only use this rune on players.")
end
end
end
return true
end
The script worksIt hasn't been tested yet. Let me ask your source if it has "Game.sendAnimatedText". If it doesn't, you can change it to
Lua:player:addMana(manaToAdd) player:say("Your mana has been increased by " .. manaToAdd .. " points!", TALKTYPE_ORANGE_1)
Lua:function onUse(cid, item, frompos, item2, topos) local player = Player(cid) if not player then return false end local level = player:getLevel() local mlevel = player:getMagicLevel() -- Exhaustion Settings -- local exhausted_seconds = 1 -- How many seconds the mana rune will be unavailable to use. local exhausted_storagevalue = 1555 -- Storage Value to store exhaustion state. MUST be an unused value! -- Exhaustion Settings END -- -- Mana Formula Settings -- -- You can use "level" and "mlevel" -- local mana_minimum = (level * 3) + (mlevel * 5) - 50 local mana_maximum = (level * 3) + (mlevel * 5) -- Mana Formula Settings END -- local mana_add = math.random(mana_minimum, mana_maximum) -- Checking charges. -- if (item.type > 1) then -- Exhaustion check. -- if (os.time() > player:getStorageValue(exhausted_storagevalue)) then -- Is the entity a player? -- if (isPlayer(item2.uid)) then player:getPosition():sendMagicEffect(topos, 28) player:getPosition():sendMagicEffect(topos, CONST_ME_MAGIC_GREEN) Game.sendAnimatedText("+" .. mana_add .. " Mana", topos) player:say("Mana UUPP!!!", TALKTYPE_ORANGE_1) player:addMana(mana_add) player:setStorageValue(exhausted_storagevalue, os.time() + exhausted_seconds) item:transform(item.type - 1) else player:getPosition():sendMagicEffect(frompos, CONST_ME_POFF) player:sendCancelMessage("You can only use this rune on players.") end else player:getPosition():sendMagicEffect(frompos, CONST_ME_POFF) player:sendCancelMessage("You are exhausted.") end else if (os.time() < player:getStorageValue(exhausted_storagevalue)) then player:getPosition():sendMagicEffect(frompos, CONST_ME_POFF) player:sendCancelMessage("You are exhausted.") else if (isPlayer(item2.uid)) then player:getPosition():sendMagicEffect(topos, 28) player:getPosition():sendMagicEffect(topos, CONST_ME_MAGIC_GREEN) Game.sendAnimatedText("+" .. mana_add .. " Mana", topos) player:say("Mana UUPP!!!", TALKTYPE_ORANGE_1) player:addMana(mana_add) player:setStorageValue(exhausted_storagevalue, os.time() + exhausted_seconds) item:remove(1) else player:getPosition():sendMagicEffect(frompos, CONST_ME_POFF) player:sendCancelMessage("You can only use this rune on players.") end end end return true end
The script works
but I want it to write the value that was added, as in the picture
TY
Game.sendAnimatedText("+" .. mana_add .. " Mana", topos)
Game.sendAnimatedText("+" ..mana_add .."", topos, TEXTCOLOR_LIGHTBLUE)
Ah, I had forgotten those details! Thanks for mentioning.change this
toLua:Game.sendAnimatedText("+" .. mana_add .. " Mana", topos)
Lua:Game.sendAnimatedText("+" .. mana_add .. " Mana", topos, TEXTCOLOR_LIGHTBLUE)
function onUse(cid, item, frompos, item2, topos)
local player = Player(cid)
if not player then
return false
end
local level = player:getLevel()
local mlevel = player:getMagicLevel()
-- Exhaustion Settings --
local exhausted_seconds = 1 -- How many seconds the mana rune will be unavailable to use.
local exhausted_storagevalue = 1555 -- Storage Value to store exhaustion state. MUST be an unused value!
-- Exhaustion Settings END --
-- Mana Formula Settings --
-- You can use "level" and "mlevel" --
local mana_minimum = (level * 3) + (mlevel * 5) - 50
local mana_maximum = (level * 3) + (mlevel * 5)
-- Mana Formula Settings END --
local mana_add = math.random(mana_minimum, mana_maximum)
-- Checking charges. --
if (item.type > 1) then
-- Exhaustion check. --
if (os.time() > player:getStorageValue(exhausted_storagevalue)) then
-- Is the entity a player? --
if (isPlayer(item2.uid)) then
player:getPosition():sendMagicEffect(topos, 28)
player:getPosition():sendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
Game.sendAnimatedText("+" .. mana_add .. " Mana", topos, TEXTCOLOR_LIGHTBLUE)
player:say("Mana UUPP!", TALKTYPE_ORANGE_1)
player:addMana(mana_add)
player:setStorageValue(exhausted_storagevalue, os.time() + exhausted_seconds)
if mana_add > 1 then
item:transform(item.type - 1)
else
item:remove(1)
end
else
player:getPosition():sendMagicEffect(frompos, CONST_ME_POFF)
player:sendCancelMessage("You can only use this rune on players.")
end
else
player:getPosition():sendMagicEffect(frompos, CONST_ME_POFF)
player:sendCancelMessage("You are exhausted.")
end
else
if (os.time() < player:getStorageValue(exhausted_storagevalue)) then
player:getPosition():sendMagicEffect(frompos, CONST_ME_POFF)
player:sendCancelMessage("You are exhausted.")
else
-- Is the entity a player? --
if (isPlayer(item2.uid)) then
player:getPosition():sendMagicEffect(topos, 28)
player:getPosition():sendMagicEffect(topos, CONST_ME_MAGIC_GREEN)
Game.sendAnimatedText("+" .. mana_add .. " Mana", topos, TEXTCOLOR_LIGHTBLUE)
player:say("Mana UUPP!", TALKTYPE_ORANGE_1)
player:addMana(mana_add)
player:setStorageValue(exhausted_storagevalue, os.time() + exhausted_seconds)
if mana_add > 1 then
item:remove(1)
end
else
player:getPosition():sendMagicEffect(frompos, CONST_ME_POFF)
player:sendCancelMessage("You can only use this rune on players.")
end
end
end
return true
end
The rune ends if the number is only 1try.
ERROR: invalid effect id 0
at:
[C++]: ?parseMagicEffect@ProtocolGame@@AAEXABV?$shared_object_ptr@VInputMessage@@@stdext@@@Z
ERROR: invalid effect id 0
at:
[C++]: ?parseMagicEffect@ProtocolGame@@AAEXABV?$shared_object_ptr@VInputMessage@@@stdext@@@Z
A rune does not end unless the number of runes is 1Show errors
or whats the problem?
ERROR: invalid effect id 0
at:
[C++]: ?parseMagicEffect@ProtocolGame@@AAEXABV?$shared_object_ptr@VInputMessage@@@stdext@@@Z
ERROR: invalid effect id 0
at:
[C++]: ?parseMagicEffect@ProtocolGame@@AAEXABV?$shared_object_ptr@VInputMessage@@@stdext@@@Z
A rune does not end unless the number of runes is 1
and when i use i got this \/
Lua:ERROR: invalid effect id 0 at: [C++]: ?parseMagicEffect@ProtocolGame@@AAEXABV?$shared_object_ptr@VInputMessage@@@stdext@@@Z ERROR: invalid effect id 0 at: [C++]: ?parseMagicEffect@ProtocolGame@@AAEXABV?$shared_object_ptr@VInputMessage@@@stdext@@@Z
player:getPosition():sendMagicEffect(10)
I have this script running in xml engines. Can you convert it to tfs 1.2?
XML:<action itemid="2270" script="manarune.lua" />
Lua:function onUse(cid, item, frompos, item2, topos) local level = getPlayerLevel(cid) local mlevel = getPlayerMagLevel(cid) -- Exhausted Settings -- local exhausted_seconds = 1 -- How many seconds manarune will be unavailible to use. -- local exhausted_storagevalue = 1555 -- Storage Value to store exhaust. It MUST be unused! -- -- Exhausted Settings END -- -- Mana Formula Settings -- -- You can use "level" and "mlevel" -- local mana_minimum = (level * 3) + (mlevel * 5) - 50 local mana_maximum = (level * 3) + (mlevel * 5) -- Mana Formula Settings END -- local mana_add = math.random(mana_minimum, mana_maximum) -- We check the charges. -- if(item.type > 1) then -- Exhausted check. -- if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then -- Entity is player? -- if(isPlayer(item2.uid) == 1) then doSendMagicEffect(topos,28) doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN) doSendAnimatedText(topos, mana_add, TEXTCOLOR_LIGHTBLUE) doPlayerSay(cid,"Mana UUPP!!!",1) doPlayerAddMana(item2.uid, mana_add) setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds) doChangeTypeItem(item.uid, item.type - 1) else doSendMagicEffect(frompos, CONST_ME_POFF) doPlayerSendCancel(cid, "You can use this rune only on players.") end else doSendMagicEffect(frompos, CONST_ME_POFF) doPlayerSendCancel(cid, "You are exhausted.") end else if(os.time() < getPlayerStorageValue(cid, exhausted_storagevalue)) then doSendMagicEffect(frompos, CONST_ME_POFF) doPlayerSendCancel(cid, "You are exhausted.") else if(isPlayer(item2.uid) == 1) then doSendMagicEffect(topos,28) doSendMagicEffect(topos, CONST_ME_MAGIC_GREEN) doSendAnimatedText(topos, mana_add, TEXTCOLOR_LIGHTBLUE) doPlayerSay(cid,"Mana UUPP!!!",1) doPlayerAddMana(item2.uid, mana_add) setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds) doRemoveItem(item.uid, 1) else doSendMagicEffect(frompos, CONST_ME_POFF) doPlayerSendCancel(cid, "You can use this rune only on players.") end end end return 1 end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if not player then
return false
end
local level = player:getLevel()
local mlevel = player:getMagicLevel()
-- Exhaustion Settings --
local exhausted_seconds = 1 -- How many seconds the mana rune will be unavailable to use.
local exhausted_storagevalue = 1555 -- Storage Value to store exhaustion state. MUST be an unused value!
-- Exhaustion Settings END --
-- Mana Formula Settings --
-- You can use "level" and "mlevel" --
local mana_minimum = (level * 3) + (mlevel * 5) - 50
local mana_maximum = (level * 3) + (mlevel * 5)
-- Mana Formula Settings END --
local mana_add = math.random(mana_minimum, mana_maximum)
-- Checking charges. --
if (item.type > 1) then
-- Exhaustion check. --
if (os.time() > player:getStorageValue(exhausted_storagevalue)) then
-- Is the entity a player? --
if player then
player:getPosition():sendMagicEffect(10)
player:getPosition():sendMagicEffect(10)
-- Game.sendAnimatedText("+" .. mana_add .. " Mana", topos, TEXTCOLOR_LIGHTBLUE)
player:say("Mana UUPP!", TALKTYPE_ORANGE_1)
player:addMana(mana_add)
player:setStorageValue(exhausted_storagevalue, os.time() + exhausted_seconds)
if mana_add > 1 then
item:transform(item.itemid, item.type - 1)
else
item:remove(1)
end
else
player:getPosition():sendMagicEffect(10)
player:sendCancelMessage("You can only use this rune on players.")
end
else
player:getPosition():sendMagicEffect(10)
player:sendCancelMessage("You are exhausted.")
end
else
if (os.time() < player:getStorageValue(exhausted_storagevalue)) then
player:getPosition():sendMagicEffect(10)
player:sendCancelMessage("You are exhausted.")
else
-- Is the entity a player? --
if player then
player:getPosition():sendMagicEffect(10)
player:getPosition():sendMagicEffect(10)
-- Game.sendAnimatedText("+" .. mana_add .. " Mana", topos, TEXTCOLOR_LIGHTBLUE)
player:say("Mana UUPP!", TALKTYPE_ORANGE_1)
player:addMana(mana_add)
player:setStorageValue(exhausted_storagevalue, os.time() + exhausted_seconds)
if mana_add > 1 then
item:remove(1)
end
else
player:getPosition():sendMagicEffect(10)
player:sendCancelMessage("You can only use this rune on players.")
end
end
end
return true
end
TyRemove all topos or frompos in sendMagicEffect, leave only numbers or effect(CONST_ME_MAGIC_BLUE)
Ex.:
Lua:player:getPosition():sendMagicEffect(10)
function onUse(cid, item, frompos, item2, topos)
local player = Player(cid)
if not player then
return false
end
local level = player:getLevel()
local mlevel = player:getMagicLevel()
-- Exhaustion Settings --
local exhausted_seconds = 1 -- How many seconds the mana rune will be unavailable to use.
local exhausted_storagevalue = 1555 -- Storage Value to store exhaustion state. MUST be an unused value!
-- Exhaustion Settings END --
-- Mana Formula Settings --
-- You can use "level" and "mlevel" --
local mana_minimum = (level * 3) + (mlevel * 5) - 50
local mana_maximum = (level * 3) + (mlevel * 5)
-- Mana Formula Settings END --
local mana_add = math.random(mana_minimum, mana_maximum)
-- Checking charges. --
if (item.type > 1) then
-- Exhaustion check. --
if (os.time() > player:getStorageValue(exhausted_storagevalue)) then
-- Is the entity a player? --
if (isPlayer(item2.uid)) then
player:getPosition():sendMagicEffect(10)
player:getPosition():sendMagicEffect(10)
Game.sendAnimatedText("+" .. mana_add .. " Mana", topos, TEXTCOLOR_LIGHTBLUE)
player:say("Mana UUPP!", TALKTYPE_ORANGE_1)
player:addMana(mana_add)
player:setStorageValue(exhausted_storagevalue, os.time() + exhausted_seconds)
if mana_add > 1 then
item:transform(item.type - 1)
else
item:remove(1)
end
else
player:getPosition():sendMagicEffect(10)
player:sendCancelMessage("You can only use this rune on players.")
end
else
player:getPosition():sendMagicEffect(10)
player:sendCancelMessage("You are exhausted.")
end
else
if (os.time() < player:getStorageValue(exhausted_storagevalue)) then
player:getPosition():sendMagicEffect(10)
player:sendCancelMessage("You are exhausted.")
else
-- Is the entity a player? --
if (isPlayer(item2.uid)) then
player:getPosition():sendMagicEffect(10)
player:getPosition():sendMagicEffect(10)
Game.sendAnimatedText("+" .. mana_add .. " Mana", topos, TEXTCOLOR_LIGHTBLUE)
player:say("Mana UUPP!", TALKTYPE_ORANGE_1)
player:addMana(mana_add)
player:setStorageValue(exhausted_storagevalue, os.time() + exhausted_seconds)
if mana_add > 1 then
item:remove(1)
end
else
player:getPosition():sendMagicEffect(10)
player:sendCancelMessage("You can only use this rune on players.")
end
end
end
return true
end
Ty
A rune does not end unless the number of runes is 1
Lua:function onUse(cid, item, frompos, item2, topos) local player = Player(cid) if not player then return false end local level = player:getLevel() local mlevel = player:getMagicLevel() -- Exhaustion Settings -- local exhausted_seconds = 1 -- How many seconds the mana rune will be unavailable to use. local exhausted_storagevalue = 1555 -- Storage Value to store exhaustion state. MUST be an unused value! -- Exhaustion Settings END -- -- Mana Formula Settings -- -- You can use "level" and "mlevel" -- local mana_minimum = (level * 3) + (mlevel * 5) - 50 local mana_maximum = (level * 3) + (mlevel * 5) -- Mana Formula Settings END -- local mana_add = math.random(mana_minimum, mana_maximum) -- Checking charges. -- if (item.type > 1) then -- Exhaustion check. -- if (os.time() > player:getStorageValue(exhausted_storagevalue)) then -- Is the entity a player? -- if (isPlayer(item2.uid)) then player:getPosition():sendMagicEffect(10) player:getPosition():sendMagicEffect(10) Game.sendAnimatedText("+" .. mana_add .. " Mana", topos, TEXTCOLOR_LIGHTBLUE) player:say("Mana UUPP!", TALKTYPE_ORANGE_1) player:addMana(mana_add) player:setStorageValue(exhausted_storagevalue, os.time() + exhausted_seconds) if mana_add > 1 then item:transform(item.type - 1) else item:remove(1) end else player:getPosition():sendMagicEffect(10) player:sendCancelMessage("You can only use this rune on players.") end else player:getPosition():sendMagicEffect(10) player:sendCancelMessage("You are exhausted.") end else if (os.time() < player:getStorageValue(exhausted_storagevalue)) then player:getPosition():sendMagicEffect(10) player:sendCancelMessage("You are exhausted.") else -- Is the entity a player? -- if (isPlayer(item2.uid)) then player:getPosition():sendMagicEffect(10) player:getPosition():sendMagicEffect(10) Game.sendAnimatedText("+" .. mana_add .. " Mana", topos, TEXTCOLOR_LIGHTBLUE) player:say("Mana UUPP!", TALKTYPE_ORANGE_1) player:addMana(mana_add) player:setStorageValue(exhausted_storagevalue, os.time() + exhausted_seconds) if mana_add > 1 then item:remove(1) end else player:getPosition():sendMagicEffect(10) player:sendCancelMessage("You can only use this rune on players.") end end end return true end
item:transform(item.type - 1) >> item:transform(item.itemid, item.type - 1)
no workitem:transform(item.type - 1) >> item:transform(item.itemid, item.type - 1)
no work
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if not player then
return false
end
local level = player:getLevel()
local mlevel = player:getMagicLevel()
-- Exhaustion Settings --
local exhausted_seconds = 1 -- How many seconds the mana rune will be unavailable to use.
local exhausted_storagevalue = 1555 -- Storage Value to store exhaustion state. MUST be an unused value!
-- Exhaustion Settings END --
-- Mana Formula Settings --
-- You can use "level" and "mlevel" --
local mana_minimum = (level * 3) + (mlevel * 5) - 50
local mana_maximum = (level * 3) + (mlevel * 5)
-- Mana Formula Settings END --
local mana_add = math.random(mana_minimum, mana_maximum)
-- Checking charges. --
-- Exhaustion check. --
if(isPlayer(target)) then
if (os.time() > player:getStorageValue(exhausted_storagevalue)) then
player:addMana(mana_add)
player:say("Mana UUPP!", TALKTYPE_ORANGE_1)
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
player:setStorageValue(exhausted_storagevalue, os.time() + exhausted_seconds)
item:remove(1)
else
player:getPosition():sendMagicEffect(CONST_ME_POFF)
player:sendCancelMessage("You are exhausted.")
end
else
player:getPosition():sendMagicEffect(CONST_ME_POFF)
player:sendCancelMessage("You can only use this rune on players.")
end
return true
end
Lua:function onUse(player, item, fromPosition, target, toPosition, isHotkey) if not player then return false end local level = player:getLevel() local mlevel = player:getMagicLevel() -- Exhaustion Settings -- local exhausted_seconds = 1 -- How many seconds the mana rune will be unavailable to use. local exhausted_storagevalue = 1555 -- Storage Value to store exhaustion state. MUST be an unused value! -- Exhaustion Settings END -- -- Mana Formula Settings -- -- You can use "level" and "mlevel" -- local mana_minimum = (level * 3) + (mlevel * 5) - 50 local mana_maximum = (level * 3) + (mlevel * 5) -- Mana Formula Settings END -- local mana_add = math.random(mana_minimum, mana_maximum) -- Checking charges. -- -- Exhaustion check. -- if (os.time() > player:getStorageValue(exhausted_storagevalue)) then player:addMana(mana_add) player:say("Mana UUPP!", TALKTYPE_ORANGE_1) player:getPosition():sendMagicEffect(10) Game.sendAnimatedText("+" .. mana_add .. " Mana", topos, TEXTCOLOR_LIGHTBLUE) player:setStorageValue(exhausted_storagevalue, os.time() + exhausted_seconds) item:remove(1) else player:getPosition():sendMagicEffect(10) player:sendCancelMessage("You are exhausted.") end return true end
Lua Script Error: [Action Interface]
data/actions/scripts/ManaRune.lua:onUse
attempt to index a nil value
stack traceback:
[C]: at 0x01400b2170
[C]: in function 'sendAnimatedText'
data/actions/scripts/ManaRune.lua:30: in function <data/actions/scripts/
ManaRune.lua:1>