• 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!

Lua Mana Rune tfs 1.2 +(Spells)

UnLucky

New Member
Joined
Jul 15, 2021
Messages
36
Reaction score
1
GitHub
UnLucky
How to change this script :
I wanted these manarune to be used at the same time as "utani hur" exori vis, exori. But not when runes, healing like uh.

what should a well-written lua look like?




Lua:
local combat = Combat()
    if player:getStorageValue(55555) >= os.time() then
    player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are exhausted")
combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)

function onGetFormulaValues(cid, level, maglevel)
    min = ((level / 5) + 130)
    max = ((level / 5) + 130)
    return min, max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, var)
    if target:isPlayer() then
    player:setStorageValue(55555, os.time() + 0)
    return combat:execute(creature, var)
end
 
Last edited:
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)

function onGetFormulaValues(cid, level, maglevel)
    min = ((level / 5) + 130)
    max = ((level / 5) + 130)
    return min, max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, var)
    if creature:getStorageValue(55555) >= os.time() then
        creature:sendTextMessage(MESSAGE_STATUS_SMALL, "You are exhausted")
        return true
    end
    creature:setStorageValue(55555, os.time() + 0)
    combat:execute(creature, var)
    return true
end
 
something went wrong.

i little change script
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_MANADRAIN)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)

function onGetFormulaValues(cid, level, maglevel)
    min = ((level / 5) + 130)
    max = ((level / 5) + 130)
    return min, max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, var)
    if creature:getStorageValue(55555) >= os.time() then
        creature:sendTextMessage(MESSAGE_STATUS_SMALL, "You are exhausted")
        return true
    end
    creature:setStorageValue(55555, os.time() + 1)
    combat:execute(creature, var)
    return true
end
 
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)

function onGetFormulaValues(cid, level, maglevel)
    min = ((level / 5) + 130)
    max = ((level / 5) + 130)
    return min, max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, var)
    if creature:getStorageValue(55555) >= os.time() then
        creature:sendTextMessage(MESSAGE_STATUS_SMALL, "You are exhausted")
        return true
    end
    creature:setStorageValue(55555, os.time() + 1)
    combat:execute(creature, var)
    return true
end

working perfect for me idk
 
Lua:
<rune group="healing" spellid="225" name="Mana Rune" id="2275" allowfaruse="1" charges="1" lvl="24" maglv="4" exhaustion="0" groupcooldown="1" aggressive="0" needtarget="1" blocktype="solid" script="healing/mana.lua"/>


how are you set up spells.lua? there i need have exh 0, and take exh from script
 
Lua:
    <instant group="attack" spellid="62" name="test" words="test" level="1" mana="1" premium="1" range="1" cooldown="0" needlearn="0" script="test.lua">
        <vocation name="Sorcerer" />
        <vocation name="Druid" />
        <vocation name="Paladin" />
        <vocation name="Knight" />
        <vocation name="Master Sorcerer" />
        <vocation name="Elder Druid" />
        <vocation name="Royal Paladin" />
        <vocation name="Elite Knight" />
    </instant>
 
maybe is possible to add this to script?
can it work?
Lua:
local exhaust = Condition(CONDITION_EXHAUST)
exhaust:setParameter(CONDITION_PARAM_TICKS, 1000) -- Here you can put your exhaust as you want. ( 1000 means = 1 second )

if you hold down a hotkey, you're not wasting your count of item ?
Post automatically merged:

maybe you can help me in the same, but from a different side. How to add exh here, to runes, without adding exh to spells like "utani hur" exori?

Lua:
local exhaust = Condition(CONDITION_EXHAUST)
exhaust:setParameter(CONDITION_PARAM_TICKS, 1000) -- Here you can put your exhaust as you want. ( 1000 means = 1 second )


function onUse(player, item, fromPosition, target, toPosition, isHotkey)
  
    local level = player:getLevel()
    local magLevel = player:getMagicLevel()
    local min = (level * 1) + (magLevel * 1) -- for every level you heal 1 mana more so if you setup 10 you'll heal for every level 10 mana more / same for magic level.
    local max = (level * 1) + (magLevel * 1)
    local mana_add = math.random(min,max)

    targetPlayer = Player(target)
    if not targetPlayer then
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You may only use this on players!")
        return true
    end

    local pos = targetPlayer:getPosition()
  
    if player:getCondition(CONDITION_EXHAUST) then
       player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
       return true
    end

    targetPlayer:addMana(mana_add)

    -- This part allows you to heal with animated text even without source edits or custom client.
    local spectators = Game.getSpectators(pos, false, false, 13, 13, 7, 7)
    if #spectators > 0 then
        for i = 1, #spectators do
            local spectator = spectators[i]
            if spectator:isPlayer() then
                spectator:sendTextMessage(MESSAGE_HEALED, nil, pos, mana_add) -- <-- There you can change the color as you want.
            end
        end
    end
    pos:sendMagicEffect(CONST_ME_MAGIC_RED) -- Here you can change your effect as you want.
    targetPlayer:addCondition(exhaust)
    return true
end
 
Last edited:
Back
Top