• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

manarune cooldown

prymus1

New Member
Joined
Mar 1, 2020
Messages
1
Reaction score
0
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
XML:
<action itemid="2270" script="manarune.lua" allowfaruse="0" />
and also in spells/spells.xml
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
 
Back
Top