• 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 "distance" | TFS 1.3

Salvus

Well-Known Member
Joined
Feb 7, 2019
Messages
102
Solutions
1
Reaction score
69
How can i make this spell throw bolts, arrows or spears?

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, 18)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setParameter(COMBAT_PARAM_USECHARGES, true)
combat:setArea(createCombatArea(AREA_WAVE3))

function onGetFormulaValues(player, skill, attack, factor)
    local min = (player:getLevel() / 0.1) + (skill * attack * 0.03) + 7
    local max = (player:getLevel() / 0.1) + (skill * attack * 0.05) + 3
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

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

I need to add something like combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, 1) ?

I dont want the param_effect i want to trow arrows and not some magic effect
 
Solution
Wow, amazing. Thank you mate!

Edit:

But how i set this up?

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, 21)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SPEAR)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setParameter(COMBAT_PARAM_USECHARGES, true)
combat:setArea(createCombatArea(AREA_WAVE3))

function onGetFormulaValues(player, skill, attack, factor)
    local min = (player:getLevel() / 0.1) + (skill * attack * 0.03) + 7
    local max = (player:getLevel() / 0.1) + (skill * attack * 0.05) + 3
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onCastSpell(creature...
How can i make this spell throw bolts, arrows or spears?

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, 18)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setParameter(COMBAT_PARAM_USECHARGES, true)
combat:setArea(createCombatArea(AREA_WAVE3))

function onGetFormulaValues(player, skill, attack, factor)
    local min = (player:getLevel() / 0.1) + (skill * attack * 0.03) + 7
    local max = (player:getLevel() / 0.1) + (skill * attack * 0.05) + 3
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

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

I need to add something like combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, 1) ?

I dont want the param_effect i want to trow arrows and not some magic effect
Yeah you use something like:
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)

You can find the distance effects here:
or
 
Wow, amazing. Thank you mate!

Edit:

But how i set this up?

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, 21)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SPEAR)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setParameter(COMBAT_PARAM_USECHARGES, true)
combat:setArea(createCombatArea(AREA_WAVE3))

function onGetFormulaValues(player, skill, attack, factor)
    local min = (player:getLevel() / 0.1) + (skill * attack * 0.03) + 7
    local max = (player:getLevel() / 0.1) + (skill * attack * 0.05) + 3
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

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

Because this aren't working.

How do i add distanceeffect on it?
 
Last edited:
Wow, amazing. Thank you mate!

Edit:

But how i set this up?

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, 21)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SPEAR)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setParameter(COMBAT_PARAM_USECHARGES, true)
combat:setArea(createCombatArea(AREA_WAVE3))

function onGetFormulaValues(player, skill, attack, factor)
    local min = (player:getLevel() / 0.1) + (skill * attack * 0.03) + 7
    local max = (player:getLevel() / 0.1) + (skill * attack * 0.05) + 3
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

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

Because this aren't working.

How do i add distanceeffect on it?
Be aware it's against the rules to re-post within 24 hours if you are the last person who has posted.
I didn't notice before, you can't use distance effect with area spells, unless you use the onTargetTile callback, like this:
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_POISONAREA)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setParameter(COMBAT_PARAM_USECHARGES, true)
combat:setArea(createCombatArea(AREA_WAVE3))

function onTargetTile(creature, position)
    creature:getPosition():sendDistanceEffect(position, CONST_ANI_SPEAR)
end

function onGetFormulaValues(player, skill, attack, factor)
    local min = (player:getLevel() / 0.1) + (skill * attack * 0.03) + 7
    local max = (player:getLevel() / 0.1) + (skill * attack * 0.05) + 3
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")

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

This code above will send spears to all tiles in spell area. If you want it to only send distance effect to the tile infront of player you can replace onTargetTile with this:
Lua:
function onTargetTile(creature, position)
    local toPosition = creature:getPosition()
    if getDistanceBetween(toPosition, position) == 1 then
        toPosition:sendDistanceEffect(position, CONST_ANI_SPEAR)
    end
end
 
Solution
Back
Top