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) +...
1 No message appears with the added valueLua: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>
2 No exhausted
3 A rune does not end unless the number of runes is 1
Problems increased xD
if you have full mana, no message!No message appears with the added value
the exhausted was for 1 second...No exhausted
it was in the script so it remainedC]: in function 'sendAnimatedText'
is removed when you useA rune does not end unless the number of runes is 1
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) + (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_WHISPER)
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
Game.sendAnimatedText("+" .. mana_add .. " Mana", player:getPosition(), TEXTCOLOR_LIGHTBLUE)
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
It works well now and the rune ends, but the added value does not appearLua: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) + (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_WHISPER) player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) -- Game.sendAnimatedText("+" .. mana_add .. " Mana", topos, TEXTCOLOR_LIGHTBLUE) 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
if you have full mana, no message!It works well now and the rune ends, but the added value does not appear
It just shows Mana UUPP!
-- Game.sendAnimatedText("+" .. mana_add .. " Mana", topos, TEXTCOLOR_LIGHTBLUE)
Game.sendAnimatedText("+" .. mana_add .. " Mana", player:getPosition(), TEXTCOLOR_LIGHTBLUE)
The added value is never shown, whether it is empty or fullif you have full mana, no message!
updated codeThe added value is never shown, whether it is empty or full
iam use tfs 1.2
It was solved, thank you ♥♥updated code
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) + (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
if player:getMana() ~= player:getMaxMana() then
player:addMana(mana_add)
player:say("Mana UUPP!", TALKTYPE_WHISPER)
Game.sendAnimatedText("+" .. mana_add .. " Mana", player:getPosition(), 35)
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("Your mana is already full.")
end
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
One of the officials will do this because it is no longer available to peoplemark as resolved