• 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.3 How do i add distance effect?

Marko999x

999x era
Premium User
Joined
Dec 14, 2017
Messages
2,861
Solutions
82
Reaction score
1,965
Location
Germany
Could someone help me quickly?
Why does the distance effect not working ?

TFS 1.3
Code:
Lua:
local blastStar = {
    { 0, 0, 0, 0, 0, 1, 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, 1, 1, 1, 1, 1, 0, 0, 0 },
    { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 },
    { 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1 },
    { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 },
    { 0, 0, 0, 1, 1, 1, 1, 1, 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, 1, 0, 0, 0, 0, 0 },
}

local blastHalo = {
    { 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, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 3, 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, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
}

local blastFocus = {
    { 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, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 3, 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, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
}

local magicBlastStar  = createCombatArea(blastStar)
local magicBlastHalo  = createCombatArea(blastHalo)
local magicBlastFocus = createCombatArea(blastFocus)

local combatBlast = Combat()
local combatHalo  = Combat()
local combatFocus = Combat()

combatBlast:setArea(magicBlastStar)
combatHalo :setArea(magicBlastHalo)
combatFocus:setArea(magicBlastFocus)

combatBlast:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combatHalo :setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combatFocus:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

combatBlast:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combatHalo :setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combatFocus:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)

combatBlast:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ME_ANI_SUDDENDEATH)
combatHalo :setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ME_ANI_SUDDENDEATH)
combatFocus:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ME_ANI_SUDDENDEATH)

combatBlast:setFormula(COMBAT_FORMULA_LEVELMAGIC, -1.5, -1.6, -1.7, -1.8)
combatHalo :setFormula(COMBAT_FORMULA_LEVELMAGIC, -14, -176, -15, -179)
combatFocus:setFormula(COMBAT_FORMULA_LEVELMAGIC, -13, -185, -14, -190)

function onCastSpell(caster, target)
    return combatBlast:execute(caster, target),
        combatHalo :execute(caster, target),
        combatFocus:execute(caster, target)
end
 
Solution
<instant group="attack" spellid="87" name="Mort Bomb" words="exevo gran mas mort" level="1000" mana="1500" premium="1" blockwalls="1" cooldown="1000" groupcooldown="1000" needlearn="0" script="mage/exevo gran mas mort.lua">
<vocation name="Sorcerer" />
<vocation name="Master Sorcerer" />
<vocation name="Druid" />
<vocation name="Elder Druid" />
</instant>
That's your answer. Distance effects apply only to targetable spells. You will have to use CALLBACK_PARAM_TARGETTILE.
Lua:
function onTargetTile(creature, position)
    creature:getPosition():sendDistanceEffect(position, distance effect here)
end

combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")
combatBlast:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combatHalo:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combatFocus:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)

combatBlast:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combatHalo:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combatFocus:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)

combatBlast:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
combatHalo:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
combatFocus:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
 
combatBlast:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combatHalo:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combatFocus:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)

combatBlast:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combatHalo:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combatFocus:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)

combatBlast:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
combatHalo:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
combatFocus:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)

Still doesnt work :(
 
Still doesnt work :(
try this one
Lua:
local blastHalo = {
    { 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, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 3, 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, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
}

local blastFocus = {
    { 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, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 3, 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, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
}


local combatBlast = Combat()
combatBlast:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combatBlast:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combatBlast:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
combatBlast:setArea(createCombatArea(blastStar))
combatBlast:setFormula(COMBAT_FORMULA_LEVELMAGIC, -1.5, -1.6, -1.7, -1.8)

local combatHalo  = Combat()
combatHalo:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combatHalo:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combatHalo:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
combatHalo :setArea(createCombatArea(blastHalo))
combatHalo:setFormula(COMBAT_FORMULA_LEVELMAGIC, -14, -176, -15, -179)

local combatFocus = Combat()
combatFocus:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combatFocus:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combatFocus:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
combatFocus:setArea(createCombatArea(blastFocus))
combatFocus:setFormula(COMBAT_FORMULA_LEVELMAGIC, -13, -185, -14, -190)

function onCastSpell(creature, variant)
    return combatBlast:execute(creature, variant),combatHalo:execute(creature, variant),combatFocus:execute(creature, variant)
end
 
still doesnt work :d
try this one
Lua:
local blastHalo = {
    { 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, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 3, 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, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
}

local blastFocus = {
    { 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, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 3, 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, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
}


local combatBlast = Combat()
combatBlast:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combatBlast:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combatBlast:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
combatBlast:setArea(createCombatArea(blastStar))
combatBlast:setFormula(COMBAT_FORMULA_LEVELMAGIC, -1.5, -1.6, -1.7, -1.8)

local combatHalo  = Combat()
combatHalo:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combatHalo:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combatHalo:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
combatHalo :setArea(createCombatArea(blastHalo))
combatHalo:setFormula(COMBAT_FORMULA_LEVELMAGIC, -14, -176, -15, -179)

local combatFocus = Combat()
combatFocus:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combatFocus:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combatFocus:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
combatFocus:setArea(createCombatArea(blastFocus))
combatFocus:setFormula(COMBAT_FORMULA_LEVELMAGIC, -13, -185, -14, -190)

function onCastSpell(creature, variant)
    return combatBlast:execute(creature, variant),combatHalo:execute(creature, variant),combatFocus:execute(creature, variant)
end
 
Post spell from spells.xml

<instant group="attack" spellid="87" name="Mort Bomb" words="exevo gran mas mort" level="1000" mana="1500" premium="1" blockwalls="1" cooldown="1000" groupcooldown="1000" needlearn="0" script="mage/exevo gran mas mort.lua">
<vocation name="Sorcerer" />
<vocation name="Master Sorcerer" />
<vocation name="Druid" />
<vocation name="Elder Druid" />
</instant>
 
<instant group="attack" spellid="87" name="Mort Bomb" words="exevo gran mas mort" level="1000" mana="1500" premium="1" blockwalls="1" cooldown="1000" groupcooldown="1000" needlearn="0" script="mage/exevo gran mas mort.lua">
<vocation name="Sorcerer" />
<vocation name="Master Sorcerer" />
<vocation name="Druid" />
<vocation name="Elder Druid" />
</instant>
That's your answer. Distance effects apply only to targetable spells. You will have to use CALLBACK_PARAM_TARGETTILE.
Lua:
function onTargetTile(creature, position)
    creature:getPosition():sendDistanceEffect(position, distance effect here)
end

combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")
 
Solution
That's your answer. Distance effects apply only to targetable spells. You will have to use CALLBACK_PARAM_TARGETTILE.
Lua:
function onTargetTile(creature, position)
    creature:getPosition():sendDistanceEffect(position, distance effect here)
end

combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")

Could u add this to my script?
Getting errors always im confused
 
How are you unable to add this few lines where you have literally only 2 things to change, combat variable name and distance effect here.

Thanks thanks
my fault I was kinad confused
Post automatically merged:

How are you unable to add this few lines where you have literally only 2 things to change, combat variable name and distance effect here.

yo sorry for the next dumb question but how can I put delay betweens these 3 spells?
as explain spell 1 has no delay then spell 2 comes out after 0.2sec andspell 3 after 0.3?
 
Last edited:
Do I need to remove these parts to create an addevent function?

return combatBlast:execute(caster, target),
combatHalo :execute(caster, target),
combatFocus:execute (caster, target)
end

or is it possible like this?
Lua:
function onCastSpell(caster, target)
addEvent(combatHalo, 2*1000, caster, target)
    return combatBlast:execute(caster, target),
        combatHalo :execute(caster, target),
      combatFocus:execute ,1000(caster, target)
end

sorry for the question
Never done that befor
 
Do I need to remove these parts to create an addevent function?

return combatBlast:execute(caster, target),
combatHalo :execute(caster, target),
combatFocus:execute (caster, target)
end

or is it possible like this?
Lua:
function onCastSpell(caster, target)
addEvent(combatHalo, 2*1000, caster, target)
    return combatBlast:execute(caster, target),
        combatHalo :execute(caster, target),
      combatFocus:execute ,1000(caster, target)
end

sorry for the question
Never done that befor
1min Search
You cant pass a UserData in addEvent, its unsafe. Unless you use @Infernum safe-addEvent.
 
Back
Top