• 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.X+ Spell help

isac001

New Member
Joined
May 15, 2018
Messages
23
Reaction score
0
how to put a 5 second exhaust on that power?

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, 129)

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 10) + (magicLevel / 10) + 4
    local max = (level / 6) + (magicLevel / 6) + 6
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local function castSpellEvent(creatureId, variant)
    local creature = Creature(creatureId)
    if not creature then
        return
    end
    combat:execute(creature, variant)
end

local function castSpellEvent2(creatureId)
    local creature = Creature(creatureId)
    if not creature then
        return
    end
    local position = creature:getPosition()
    local effectPosition = Position({x = position.x+1, y = position.y, z = position.z})
    effectPosition:sendMagicEffect(154)
end

local function falar(cid)
    local creature = Creature(cid)
    creature:say("Dragon", TALKTYPE_MONSTER_SAY)
    addEvent( function() creature:say("Fist", TALKTYPE_MONSTER_SAY) end, 200)
    addEvent( function() creature:say("Haa", TALKTYPE_MONSTER_SAY) end, 400)
end

function onCastSpell(creature, variant)
    addEvent(falar, 0, creature:getId())
    addEvent(castSpellEvent, 600, creature:getId(), variant)
    addEvent(castSpellEvent2, 900, creature:getTarget():getId())
    return true
end
 
Add it in your spells.xml and set the exhaustion="5000"

PHP:
<instant name="Test Spell" words="spellwords" maglv="1" mana="25" aggressive="0" selftarget="1" exhaustion="5000" needlearn="0" script="test_spell.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>

if so desired you can also add it to a group and add exhaustion for that like if you want to add cooldown for other spells in the same category f.e.

PHP:
<instant group="healing" groupcooldown="1000" name="Test Spell" words="spellwords" maglv="1" mana="25" aggressive="0" selftarget="1" exhaustion="5000" needlearn="0" script="test_spell.lua">
 
Add it in your spells.xml and set the exhaustion="5000"

PHP:
<instant name="Test Spell" words="spellwords" maglv="1" mana="25" aggressive="0" selftarget="1" exhaustion="5000" needlearn="0" script="test_spell.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>

if so desired you can also add it to a group and add exhaustion for that like if you want to add cooldown for other spells in the same category f.e.

PHP:
<instant group="healing" groupcooldown="1000" name="Test Spell" words="spellwords" maglv="1" mana="25" aggressive="0" selftarget="1" exhaustion="5000" needlearn="0" script="test_spell.lua">
I wanted some time inside the script, I don't want to use spells.xml.
 
you asked for a 5 second exhaust? idk what you're trying to achieve?
if you want a delay in your script use addEvent() but that's not the same as exhaustion as you asked in your op
 
Back
Top