• 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+ [TFS 1.3] How to Create An Instant Spell in Spell Folder (RevScripts)?

Yan18

Member
Joined
Jun 14, 2014
Messages
104
Solutions
3
Reaction score
17
Hello guys!

As the title says, I would like to know how to create an instant spell. I'm learning how to use RevScripts and I would like to know if there is someone that can explain me how to do that.

If is possible, to create a easy spell, as Fireball for example.
 
Default example is Spell Runes. I want Instant Spells
semi ironic that you asked for 'fireball' as an example, since it's a rune spell. xP

Here's 'exori flam' as an example but renamed to 'fireball strike'

and before anyone asks, I have no idea what ';true' means in the vocation field.
It works with or without that added, so I left it in. xD

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 5) + (magicLevel * 1.4) + 8
    local max = (level / 5) + (magicLevel * 2.2) + 14
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local spell = Spell(SPELL_INSTANT)

function spell.onCastSpell(creature, variant)
    return combat:execute(creature, variant)
end

spell:group("attack")
spell:id(220)
spell:name("fireball strike")
spell:words("fireball strike")
spell:level(14)
spell:mana(20)
spell:isPremium(false)
spell:range(3)
spell:needCasterTargetOrDirection(true)
spell:isBlockingWalls(true)
spell:cooldown(2000)
spell:groupCooldown(2000)
spell:needLearn(false)
spell:vocation("sorcerer;true", "druid;true", "master sorcerer", "elder druid")
spell:register()
 
semi ironic that you asked for 'fireball' as an example, since it's a rune spell. xP

Here's 'exori flam' as an example but renamed to 'fireball strike'

and before anyone asks, I have no idea what ';true' means in the vocation field.
It works with or without that added, so I left it in. xD

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 5) + (magicLevel * 1.4) + 8
    local max = (level / 5) + (magicLevel * 2.2) + 14
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local spell = Spell(SPELL_INSTANT)

function spell.onCastSpell(creature, variant)
    return combat:execute(creature, variant)
end

spell:group("attack")
spell:id(220)
spell:name("fireball strike")
spell:words("fireball strike")
spell:level(14)
spell:mana(20)
spell:isPremium(false)
spell:range(3)
spell:needCasterTargetOrDirection(true)
spell:isBlockingWalls(true)
spell:cooldown(2000)
spell:groupCooldown(2000)
spell:needLearn(false)
spell:vocation("sorcerer;true", "druid;true", "master sorcerer", "elder druid")
spell:register()
Thanks! I wasn't ironic haha, but I wanted to say that I want a spell that doesn't use an Item to conjure. My server is a derivative from Tibia, then I don't know Tibia very well because Tibia is just a base for me doing my game.

I'm tring to use your script in a Summon and the damage is 0. I don't know why. I tried change the:
Lua:
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

to:
Lua:
combat:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onGetFormulaValues")

And the damage continues 0. This Spell is target and can be used from the max distance 8 tiles.

I need to use :
Lua:
combat:setFormula(COMBAT_FORMULA_DAMAGE, -25, -102, -25,-250)
(The values inside the Formula are randons)

Instead:
Lua:
combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
?
 
Back
Top