• 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.2] [Spells] How to call spell effect multiple times

SixNine

Active Member
Joined
Dec 12, 2018
Messages
442
Reaction score
40
Hello otland,
im new here and my first post starts with help request, thats kinda embarrassing, but i couldn't figure it out by myself. So anyway i made this simple area spell
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)


local area = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
}

combat:setArea(createCombatArea(area))

function onGetFormulaValues(player, level, maglevel)
    local min = (level * 10) + (maglevel * 15.5) + 25
    local max = (level * 10) + (maglevel * 25) + 50
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, variant)
    sendCustomMagicEffect(creature:getPosition(), 47, 2, 0)
    return combat:execute(creature, variant)
end
Which is pretty simple. It takes dmg to those squares and it cast spell effect from number 2
1,1,1
1,1,1
1,2,1
1,1,1
1,1,1
My goal is to call this effect multiple times what i mean is to add effect three time for example now its like this
1,1,1
1,1,1
1,2,1 (Effect is here)
1,1,1
1,1,1

I need same effect at the same time right there
1,1,1
1,1,1(Effect is here)
1,2,1(Effect is here)
1,1,1(Effect is here)
1,1,1
 
Just send more effects after 1/4 sec and 1/2
So its still timer based. Proably you think that i need something like this (First effect) after one sec (second effect) after second sec (third effects) after third second. So no its not what i need. To make thinks clear
Untitled.png

Red is sendCustomMagicEffect(creature:getPosition(), 47, 2, 0)
 
So its still timer based. Proably you think that i need something like this (First effect) after one sec (second effect) after second sec (third effects) after third second. So no its not what i need. To make thinks clear
Untitled.png

Red is sendCustomMagicEffect(creature:getPosition(), 47, 2, 0)

Try create combat2 and combat3 (with no damage, but only effect) and execute them it his way.

Code:
combat:execute(creature, variant)
combat2:execute(creature, variant)
combat3:execute(creature, variant)
return true
 
Try create combat2 and combat3 (with no damage, but only effect) and execute them it his way.

Code:
combat:execute(creature, variant)
combat2:execute(creature, variant)
combat3:execute(creature, variant)
return true
Thats the problem how am i going to apply sendCustomMagicEffect position to combat2 and combat2
 
Thats the problem how am i going to apply sendCustomMagicEffect position to combat2 and combat2
I guess now I understand You.
You should take a look at CALLBACK_PARAM_TARGETTILE,

Not tested. It should look like this
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)


local area = {
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 1, 2, 1, 0, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
}

combat:setArea(createCombatArea(area))

local function onGetFormulaValues(player, level, maglevel)
    local min = (level * 10) + (maglevel * 15.5) + 25
    local max = (level * 10) + (maglevel * 25) + 50
    return -min, -max
end

local function onGetTargetTile(creature, tile)
    local tile = Tile(tile)
    sendCustomMagicEffect(tile:getPosition(), 47, 2, 0)
    return true
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onGetTargetTile")

function onCastSpell(creature, variant)
    sendCustomMagicEffect(creature:getPosition(), 47, 2, 0)
    return combat:execute(creature, variant)
end
 
I guess now I understand You.
You should take a look at CALLBACK_PARAM_TARGETTILE,

Not tested. It should look like this
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)


local area = {
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 1, 2, 1, 0, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
}

combat:setArea(createCombatArea(area))

local function onGetFormulaValues(player, level, maglevel)
    local min = (level * 10) + (maglevel * 15.5) + 25
    local max = (level * 10) + (maglevel * 25) + 50
    return -min, -max
end

local function onGetTargetTile(creature, tile)
    local tile = Tile(tile)
    sendCustomMagicEffect(tile:getPosition(), 47, 2, 0)
    return true
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onGetTargetTile")

function onCastSpell(creature, variant)
    sendCustomMagicEffect(creature:getPosition(), 47, 2, 0)
    return combat:execute(creature, variant)
end
My tfs cant load onGetTargetTile. I think CALLBACK_PARAM_TARGETTILE is not a function that people use on tfs 1.2 because i cant find any information about it, but if you find something about it those post are made in 2009 when tfs 1.2 didnt even existed. So it doesnt work
 
My tfs cant load onGetTargetTile. I think CALLBACK_PARAM_TARGETTILE is not a function that people use on tfs 1.2 because i cant find any information about it, but if you find something about it those post are made in 2009 when tfs 1.2 didnt even existed. So it doesnt work

Remove word local before word function and try again.
Double check if I made a typo in code.

Anyway check your source files, in Linux machine
Code:
grep -R CALLBACK_PARAM_TARGETTILE _source_directory

## EDIT
I use CALLBACK_PARAM_TARGETTILE in TFS 1.2
 
Remove word local before word function and try again.
Double check if I made a typo in code.

Anyway check your source files, in Linux machine
Code:
grep -R CALLBACK_PARAM_TARGETTILE _source_directory

## EDIT
I use CALLBACK_PARAM_TARGETTILE in TFS 1.2
Hmmmm so i tested it and it calls that effect on every area that has 1
local area =
{0, 0, 0, 0, 0, 0, 0}
{0, 0, 1, 1, 1, 0, 0}
{0, 0, 1, 1, 1, 0, 0}
{0, 0, 1, 2, 1, 0, 0}
{0, 0, 1, 1, 1, 0, 0}
{0, 0, 1, 1, 1, 0, 0}
{0, 0, 0, 0, 0, 0, 0},
}
So it sends effect 11 times while it should be on the middle one on top and one at the bottom, but it should apply damage on those numbers.
Untitled.png
 
Hmmmm so i tested it and it calls that effect on every area that has 1
local area =
{0, 0, 0, 0, 0, 0, 0}
{0, 0, 1, 1, 1, 0, 0}
{0, 0, 1, 1, 1, 0, 0}
{0, 0, 1, 2, 1, 0, 0}
{0, 0, 1, 1, 1, 0, 0}
{0, 0, 1, 1, 1, 0, 0}
{0, 0, 0, 0, 0, 0, 0},
}
So it sends effect 11 times while it should be on the middle one on top and one at the bottom, but it should apply damage on those numbers.
Untitled.png

I guess you have all parts that should help create effect you want.
 
I guess you have all parts that should help create effect you want.
"I guess" :D First of all i already knew how to call effect on every area that has value 1 so you taught me nothing. Call effect three times and apply different x,y,z for each of them and still be able to keep same hit range its not even similar, but still i appreciate that zero help.
 
Back
Top