Hello, I am having a problem with a manarune's cooldown. I can use mr and any other spell/rune at the same time. I'd like manarune to share cooldowns with runes (so you cannot use mr+sd/uh at the same time) but not with spells, if it's even possible.
Manarune is placed in data/actions/scripts/manarune.lua and there is a line in data/actions/actions.xml
and also in spells/spells.xml
I've tried to put it into spells instead of actions, but then "I cannot use this object". The engine I am using is Aries 0.4.0.
Manarune is placed in data/actions/scripts/manarune.lua and there is a line in data/actions/actions.xml
XML:
<action itemid="2270" script="manarune.lua" allowfaruse="0" />
Lua:
<rune name="Manarune" id="2270" charges="3" maglv="0" exhaustion="1" enabled="1" allowfaruse="0" script="manarune.lua"></rune>
I've tried to put it into spells instead of actions, but then "I cannot use this object". The engine I am using is Aries 0.4.0.
Lua:
-- Manarune by Avixu
-- Based on Killavus' manarune
-- Dedicated for Aries 0.4.0
-- Actions.XML: <action itemid="2270" script="manarune.lua" allowfaruse="0" />
local config = {
constantManaAmount = 0, -- set on 0 to use a formula with variables like level etc (line 33, 34)
removeItem = 0,
exhaustSeconds = 1,
exhaustStorageID = 25500, -- this one MUST be unused!
onlyOnPlayersMsg = 'You may use this item only on players',
exhaustedMsg = 'You are exhausted.'
}
function onUse(cid, item, frompos, item2, topos)
if(isPlayer(item2.uid) == FALSE) then
doPlayerSendCancel(cid, config.onlyOnPlayersMsg)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return FALSE
end
if(os.time() < getPlayerStorageValue(cid, config.exhaustStorageID)) then
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
doPlayerSendCancel(cid, config.exhaustedMsg)
return FALSE
end
if config.constantManaAmount == 0 then
local level, mlevel = getPlayerLevel(cid), getPlayerMagLevel(cid)
-- formula settings
-- you may use 'level' and 'mlevel'
local manaMin = 150
local manaMax = 250
if manaMin < 30 then
local manaMin = 30
end
if manaMax < 30 then
local manaMax = 30
end
local manaAdd = math.random(manaMin, manaMax)
doPlayerAddMana(item2.uid, manaAdd)
doSendAnimatedText(getPlayerPosition(item2.uid), manaAdd, TEXTCOLOR_LIGHTBLUE)
else
doPlayerAddMana(item2.uid, config.constantManaAmount)
doSendAnimatedText(getPlayerPosition(item2.uid), config.constantManaAmount, TEXTCOLOR_LIGHTBLUE)
end
setPlayerStorageValue(cid, config.exhaustStorageID, os.time() + config.exhaustSeconds)
doSendMagicEffect(getPlayerPosition(item2.uid), CONST_ME_MAGIC_BLUE)
doPlayerSay(cid, "Aaaah...", 16)
if config.removeItem == 1 then
if(item.type > 1) then
doChangeTypeItem(item.uid, item.type - 1)
elseif(item.type == 1) then
doRemoveItem(item.uid, 1)
end
end
end