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

Spell [TFS 1.3] - How to change damage / effects etc on spells?

jonesl216

New Member
Joined
Apr 2, 2021
Messages
5
Reaction score
1
Could someone give me an example of how I can make this spell have different damage, different magic effects and different delay in each area and how to execute it?

Lua:
local animationDelay = 300
local combat = {}

-- Frames (1 = Area, 2 = Player, 3 = Player + Self Damaging)
local area = {
    {
        {0, 1, 0},
        {1, 2, 1},
        {0, 1, 0}
    },
    {
        {1, 0, 1},
        {0, 2, 0},
        {1, 0, 1}
    },
    {
        {0, 1, 1, 1, 0},
        {1, 0, 0, 0, 1},
        {1, 0, 2, 0, 1},
        {1, 0, 0, 0, 1},
        {0, 1, 1, 1, 0}
    },
    {
        {0, 0, 1, 0, 0},
        {0, 0, 1, 0, 0},
        {1, 1, 3, 1, 1},
        {0, 0, 1, 0, 0},
        {0, 0, 1, 0, 0}
    },
    {
        {0, 0, 0, 0, 0},
        {0, 0, 1, 0, 0},
        {0, 1, 3, 1, 0},
        {0, 0, 1, 0, 0},
        {0, 0, 0, 0, 0}
    },
    {
        {0, 0, 0, 0, 0},
        {0, 1, 0, 1, 0},
        {0, 0, 3, 0, 0},
        {0, 1, 0, 1, 0},
        {0, 0, 0, 0, 0}
    },
    {
        {0, 0, 1, 0, 0},
        {0, 1, 1, 1, 0},
        {1, 1, 3, 1, 1},
        {0, 1, 1, 1, 0},
        {0, 0, 1, 0, 0}
    },
        {
        {0, 0, 0, 0, 0},
        {0, 1, 1, 1, 0},
        {0, 1, 3, 1, 0},
        {0, 1, 1, 1, 0},
        {0, 0, 0, 0, 0}
    },
}

for i = 1, #area do
    combat[i] = Combat()
    combat[i]:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
    combat[i]:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_PURPLEENERGY)
end

for x, _ in ipairs(area) do
    combat[x]:setArea(createCombatArea(area[x]))
end

function executeCombat(p, i)
    if not p.player then
        return false
    end
    if not p.player:isPlayer() then
            return false
    end
    p.combat[i]:execute(p.player, p.var)
end

function onCastSpell(player, var)

    local p = {player = player, var = var, combat = combat}

    -- Damage formula
    local level = player:getLevel()
    local maglevel = player:getMagicLevel()
    local min = (level / 2) + (maglevel * 145) + 8
    local max = (level / 2) + (maglevel * 150) + 14

    for i = 1, #area do
        combat[i]:setFormula(COMBAT_FORMULA_LEVELMAGIC, 0, -min, 0, -max)
        if i == 1 then
            combat[i]:execute(player, var)
        else
            addEvent(executeCombat, (animationDelay * i) - animationDelay, p, i)
        end
    end

    return true
end
 
U have wroten it man
local animationDelay = 300 -- deley in ms.
local combat = {}

-- Frames (1 = Area, 2 = Player, 3 = Player + Self Damaging)
local area = {
{
{0, 1, 0},
{1, 2, 1},
{0, 1, 0}
},
{
{1, 0, 1},
{0, 2, 0},
{1, 0, 1}
},
{
{0, 1, 1, 1, 0},
{1, 0, 0, 0, 1},
{1, 0, 2, 0, 1},
{1, 0, 0, 0, 1},
{0, 1, 1, 1, 0}
},
{
{0, 0, 1, 0, 0},
{0, 0, 1, 0, 0},
{1, 1, 3, 1, 1},
{0, 0, 1, 0, 0},
{0, 0, 1, 0, 0}
},
{
{0, 0, 0, 0, 0},
{0, 0, 1, 0, 0},
{0, 1, 3, 1, 0},
{0, 0, 1, 0, 0},
{0, 0, 0, 0, 0}
},
{
{0, 0, 0, 0, 0},
{0, 1, 0, 1, 0},
{0, 0, 3, 0, 0},
{0, 1, 0, 1, 0},
{0, 0, 0, 0, 0}
},
{
{0, 0, 1, 0, 0},
{0, 1, 1, 1, 0},
{1, 1, 3, 1, 1},
{0, 1, 1, 1, 0},
{0, 0, 1, 0, 0}
},
{
{0, 0, 0, 0, 0},
{0, 1, 1, 1, 0},
{0, 1, 3, 1, 0},
{0, 1, 1, 1, 0},
{0, 0, 0, 0, 0}
},
}

for i = 1, #area do
combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_PURPLEENERGY) -- EFFECT
end

for x, _ in ipairs(area) do
combat[x]:setArea(createCombatArea(area[x]))
end

function executeCombat(p, i)
if not p.player then
return false
end
if not p.player:isPlayer() then
return false
end
p.combat:execute(p.player, p.var)
end

function onCastSpell(player, var)

local p = {player = player, var = var, combat = combat}

-- Damage formula
local level = player:getLevel()
local maglevel = player:getMagicLevel()
local min = (level / 2) + (maglevel * 145) + 8
local max = (level / 2) + (maglevel * 150) + 14 -- DMG


for i = 1, #area do
combat:setFormula(COMBAT_FORMULA_LEVELMAGIC, 0, -min, 0, -max)
if i == 1 then
combat:execute(player, var)
else
addEvent(executeCombat, (animationDelay * i) - animationDelay, p, i)
end
end

return true
end
 
How can I do that?
This is the wrong section for seeking help.

Please move thread to the support section found here

To change the type of damage each iteration, would require an edit on the LOOP part of your script, you would need to modify the damage type before using addevent.
 
Last edited:
Back
Top