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

Solved Annihilation (Exori Gran Ico) PROBLEM !

Daniel Kopeć

Member
Joined
Dec 8, 2018
Messages
125
Solutions
4
Reaction score
12
Location
Poland
I want to introduce new spells like Annihilation (Exori Gran Ico).
The problem is that once a spell has been used, it cannot be used anymore.

I changed the parameters
setPlayerStorageValue(cid, 3200, os.time()+30000) - But it didn't help.

TFS 0.4 Tibia 8.6


Here are my scripts:

XML:
</instant>
    <instant name="Annihilation" words="exori gran ico" lvl="110" mana="300" prem="1" range="5" needtarget="1" blockwalls="1" needweapon="1" exhaustion="2000" needlearn="0" event="script" value="attack/Annihilation.lua">
        <vocation id="4"/>
        <vocation id="8"/>
    </instant>

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, true)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)

function onGetFormulaValues(cid, level, skill, attack, factor)
    local skillTotal, levelTotal = skill * attack, level / 5
    return -(skillTotal * 0.1606 + levelTotal)/2, -(skillTotal * 0.1606 + levelTotal)
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
    if getPlayerStorageValue(cid, 3200) <= 0 then
        setPlayerStorageValue(cid, 3200, os.time()+30000) 
        return doCombat(cid, combat, var)
    else
        doPlayerSendCancel(cid, "You are exhausted.")
    end
end


Does anyone know how to fix it ?
 
Solution
E
why are you setting the exhaustion on the spell instead of only relying to the exhaustion="2000" tag in spells.xml?

just leave the exhaustion where it should be (xml) and use the spell like this:

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, true)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)

function onGetFormulaValues(cid, level, skill, attack, factor)
    local skillTotal, levelTotal = skill * attack, level / 5
    return -(skillTotal * 0.1606 + levelTotal)/2, -(skillTotal * 0.1606 +...
why are you setting the exhaustion on the spell instead of only relying to the exhaustion="2000" tag in spells.xml?

just leave the exhaustion where it should be (xml) and use the spell like this:

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, true)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)

function onGetFormulaValues(cid, level, skill, attack, factor)
    local skillTotal, levelTotal = skill * attack, level / 5
    return -(skillTotal * 0.1606 + levelTotal)/2, -(skillTotal * 0.1606 + levelTotal)
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end
 
Solution
why are you setting the exhaustion on the spell instead of only relying to the exhaustion="2000" tag in spells.xml?

just leave the exhaustion where it should be (xml) and use the spell like this:

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, true)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)

function onGetFormulaValues(cid, level, skill, attack, factor)
    local skillTotal, levelTotal = skill * attack, level / 5
    return -(skillTotal * 0.1606 + levelTotal)/2, -(skillTotal * 0.1606 + levelTotal)
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end
Thank you very much for help :) REP+
 
Back
Top