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

[TFS 1.3] Spell cooldown. I am exhausted

ivvanek

New Member
Joined
Mar 24, 2009
Messages
113
Reaction score
3
Hello

Spells working like too exhausted because when i use "exevo gran mas flam" and trying to hit with "sd rune" then i am exhausted for too long time and i cannot hit any runes or spells.

Code:
<instant group="attack" name="Hell's Core" words="exevo gran mas flam" level="60" mana="1100" premium="1" cooldown="1600" selftarget="1" needlearn="0" script="attack/hell's_core.lua">
        <vocation name="Sorcerer" />
        <vocation name="Master Sorcerer" />
    </instant>

When i reduce "cooldown" value from spells.xml from "16000" to "1600" for UE Spell then i can use runes sd after a little delay (it is good btw.) but i can again use ue spell without delay :p
2. When i change back the value from spells.xml from "1600" to "16000" for UE Spell then i again i cannot use runes sd after using UE spell.... with toooooo long delay or exahust.

Who knows a solution to fix MULTI SPELLS exhaust/cooldown after using UE for example. ?


EDIT:
Maybe it is hard to explain what i am talking about but in short words, After use UE i cannot use any other spell or rune because i am exhasted. I think it is a bug...
 
Last edited:
Solution
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 5) + (magicLevel * 8) + 50
    local max = (level / 5) + (magicLevel * 12) + 75
    return -min, -max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")



function onCastSpell(creature, variant)
    local player = Player(creature)
    if player:getStorageValue(55555) >= os.time() then
    player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are exhausted")
        return true
    end
    player:setStorageValue(55555, os.time() + 3) -- last...
Its working!
But when you are exhausted and trying to spell it again then it say "you are exhasted" but takes mana. How to disable taking mana when exhausted?
 
Can you explain me what the storage is and how to do it correctly?

Storages are something like boxes with number thats have inside number :D
Example: Storage with number 55555
player:setStorageValue(55555, 1) - first number define storage number, second set value inside
player:getStorageValue(55555) - with this function script check storage 55555, and get values that are set inside.


55555 This number is storage, for other spell make it 55556, 55557 etc.
 

Storages are something like boxes with number thats have inside number :D
Example: Storage with number 55555
player:setStorageValue(55555, 1) - first number define storage number, second set value inside
player:getStorageValue(55555) - with this function script check storage 55555, and get values that are set inside.


55555 This number is storage, for other spell make it 55556, 55557 etc.
So, when i have other spells thats use the same cooldown i can use the same storage number or i neccesary is to use unique storage numbers for every spell?
 
Now i have another issue, everything works fine but i can cast spell for example: exevo vis hur + exevo gran mas flam immediately, it's look like Combo ^^, how to make cooldown betwen some spells?
 
Now i have another issue, everything works fine but i can cast spell for example: exevo vis hur + exevo gran mas flam immediately, it's look like Combo ^^, how to make cooldown betwen some spells?
Make extra cooldown
Lua:
function onCastSpell(creature, variant)
    local player = Player(creature)
    if player:getStorageValue(55555) >= os.time() and player:getStorageValue(60022) >= os.time() then
    player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are exhausted")
        return true
    end
    player:setStorageValue(55555, os.time() + 3) -- last number "3"  is the cooldown in seconds
    player:setStorageValue(60022, os.time() + 1) -- Make this storage in every spell
    return combat:execute(creature, variant)
end
 
Make extra cooldown
Lua:
function onCastSpell(creature, variant)
    local player = Player(creature)
    if player:getStorageValue(55555) >= os.time() and player:getStorageValue(60022) >= os.time() then
    player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are exhausted")
        return true
    end
    player:setStorageValue(55555, os.time() + 3) -- last number "3"  is the cooldown in seconds
    player:setStorageValue(60022, os.time() + 1) -- Make this storage in every spell
    return combat:execute(creature, variant)
end

Dont work...
Code:
function onCastSpell(creature, variant)
    local player = Player(creature)
    if player:getStorageValue(55555) >= os.time() and player:setStorageValue(60025, os.time() + 1) then
    player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are exhausted")
        return false
    end
    player:setStorageValue(55555, os.time() + 30) -- last number "3"  is the cooldown in seconds
    player:setStorageValue(60025, os.time() + 1) -- Make this storage in every spell
    return combat:execute(creature, variant)
end
 
Last edited:
Dont work...
Code:
function onCastSpell(creature, variant)
    local player = Player(creature)
    if player:getStorageValue(55555) >= os.time() and player:setStorageValue(60025, os.time() + 1) then
    player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are exhausted")
        return false
    end
    player:setStorageValue(55555, os.time() + 30) -- last number "3"  is the cooldown in seconds
    player:setStorageValue(60025, os.time() + 1) -- Make this storage in every spell
    return combat:execute(creature, variant)
end
Sory there was set instead of get, change it to this
Lua:
    if player:getStorageValue(55555) >= os.time() and player:getStorageValue(60025, os.time() + 1) then
 
Sory there was set instead of get, change it to this
Lua:
    if player:getStorageValue(55555) >= os.time() and player:getStorageValue(60025, os.time() + 1) then
Still no cooldown betwen spells.. ;/
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 5) + (magicLevel * 8) + 50
    local max = (level / 5) + (magicLevel * 12) + 75
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")



function onCastSpell(creature, variant)
    local player = Player(creature)
    if player:getStorageValue(55555) >= os.time() and player:getStorageValue(60025, os.time() + 1) then
    player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are exhausted")
        return false
    end
    player:setStorageValue(55555, os.time() + 30) -- last number "3"  is the cooldown in seconds
    player:setStorageValue(60025, os.time() + 1) -- Make this storage in every spell
    return combat:execute(creature, variant)
end
 
Still no cooldown betwen spells.. ;/
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 5) + (magicLevel * 8) + 50
    local max = (level / 5) + (magicLevel * 12) + 75
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")



function onCastSpell(creature, variant)
    local player = Player(creature)
    if player:getStorageValue(55555) >= os.time() and player:getStorageValue(60025, os.time() + 1) then
    player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are exhausted")
        return false
    end
    player:setStorageValue(55555, os.time() + 30) -- last number "3"  is the cooldown in seconds
    player:setStorageValue(60025, os.time() + 1) -- Make this storage in every spell
    return combat:execute(creature, variant)
end

Sorry, my bad... SOmetimes im blind, take :D

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 5) + (magicLevel * 8) + 50
    local max = (level / 5) + (magicLevel * 12) + 75
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")



function onCastSpell(creature, variant)
    local player = Player(creature)
    if player:getStorageValue(55555) >= os.time() and player:getStorageValue(60025) >= os.time() then
    player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are exhausted")
        return false
    end
    player:setStorageValue(55555, os.time() + 30) -- last number "3"  is the cooldown in seconds
    player:setStorageValue(60025, os.time() + 1) -- Make this storage in every spell
    return combat:execute(creature, variant)
end
 
Show me you two spells.lua, thats you using to tests

Energy wave:
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
combat:setArea(createCombatArea(AREA_SQUAREWAVE5, AREADIAGONAL_SQUAREWAVE5))

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 5) + (magicLevel * 4.5) + 20
    local max = (level / 5) + (magicLevel * 7.6) + 48
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, variant)
    local player = Player(creature)
    if player:getStorageValue(55556) >= os.time() and player:getStorageValue(60025) >= os.time() then
    player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are exhausted")
        return false
    end
    player:setStorageValue(55556, os.time() + 8) -- last number "3"  is the cooldown in seconds
    player:setStorageValue(60025, os.time() + 1) -- Make this storage in every spell
    return combat:execute(creature, variant)
end

Hell's Core:
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 5) + (magicLevel * 8) + 50
    local max = (level / 5) + (magicLevel * 12) + 75
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, variant)
    local player = Player(creature)
    if player:getStorageValue(55555) >= os.time() and player:getStorageValue(60025) >= os.time() then
    player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are exhausted")
        return false
    end
    player:setStorageValue(55555, os.time() + 30) -- last number "3"  is the cooldown in seconds
    player:setStorageValue(60025, os.time() + 1) -- Make this storage in every spell
    return combat:execute(creature, variant)
end

Here is it, sorry for delay.
 
Last edited:
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 5) + (magicLevel * 8) + 50
    local max = (level / 5) + (magicLevel * 12) + 75
    return -min, -max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")



function onCastSpell(creature, variant)
    local player = Player(creature)
    if player:getStorageValue(55555) >= os.time() then
    player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are exhausted")
        return true
    end
    player:setStorageValue(55555, os.time() + 3) -- last number "3"  is the cooldown in seconds
    return combat:execute(creature, variant)
end
I added this and deleted the cooldown on the spells.xml , I can spam the spell and the spell will appear like text every 1 second and waste my mana, even though it justs attacks on the spell with the timer + 1 second, and that second I dont know where it comes from

How can I make it that it doesnt get the mana when doesnt throw de animation of the spell?
 
Last edited:
I added this and deleted the cooldown on the spells.xml , I can spam the spell and the spell will appear like text every 1 second and waste my mana, even though it justs attacks on the spell with the timer + 1 second, and that second I dont know where it comes from

How can I make it that it doesnt get the mana when doesnt throw de animation of the spell?
return false instead of return true. It was explained earlier in the thread :)
Post automatically merged:

Energy wave:
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
combat:setArea(createCombatArea(AREA_SQUAREWAVE5, AREADIAGONAL_SQUAREWAVE5))

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 5) + (magicLevel * 4.5) + 20
    local max = (level / 5) + (magicLevel * 7.6) + 48
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, variant)
    local player = Player(creature)
    if player:getStorageValue(55556) >= os.time() and player:getStorageValue(60025) >= os.time() then
    player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are exhausted")
        return false
    end
    player:setStorageValue(55556, os.time() + 8) -- last number "3"  is the cooldown in seconds
    player:setStorageValue(60025, os.time() + 1) -- Make this storage in every spell
    return combat:execute(creature, variant)
end

Hell's Core:
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 5) + (magicLevel * 8) + 50
    local max = (level / 5) + (magicLevel * 12) + 75
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, variant)
    local player = Player(creature)
    if player:getStorageValue(55555) >= os.time() and player:getStorageValue(60025) >= os.time() then
    player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are exhausted")
        return false
    end
    player:setStorageValue(55555, os.time() + 30) -- last number "3"  is the cooldown in seconds
    player:setStorageValue(60025, os.time() + 1) -- Make this storage in every spell
    return combat:execute(creature, variant)
end

Here is it, sorry for delay.
I'm new to coding, but shouldn't it be
Code:
or
instead of
Code:
and
? Since you would want it to not work when either of those cooldowns are active right?
 
Back
Top