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

Lua [TFS 1.x][Spell] Display distance effect on every spell field

pasiak12

Well-Known Member
Joined
Jun 7, 2009
Messages
260
Solutions
13
Reaction score
70
I want to create a spell that send BOLTs to every field of the wave spell

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)

AREA_WAVEBOLT = {
{1,1,1, 1, 1, 1, 1, 1, 1},  
{0,1,1, 1, 1, 1, 1, 1, 0},
{0,0,1, 1, 1, 1, 1, 0, 0},
{0,0,0, 1, 1, 1, 0, 0, 0},
{0,0,0, 0, 2, 0, 0, 0, 0} }

combat:setArea(createCombatArea(AREA_WAVEBOLT))
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_BOLT)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)



function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 1.2) + 7
    local max = (level / 5) + (maglevel * 2) + 12
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

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

spells.xml
Code:
    <instant group="attack" name="Bolt Wave" words="exevo bolt hur" lvl="30" direction="1" mana="100"  exhaustion="2000" needlearn="0" script="attack/Bolt Wave.lua">
        <vocation name="Paladin"/>
        <vocation name="Royal Paladin"/>
    </instant>

the effect is:
VnjWc

Imgur: The most awesome images on the Internet

Sends the bolt only on the first square in the front of player (red square on screen)

Would like to send bolt on every square of the definied AREA_WAVEBOLT
 
Solution
I want to create a spell that send BOLTs to every field of the wave spell

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)

AREA_WAVEBOLT = {
{1,1,1, 1, 1, 1, 1, 1, 1}, 
{0,1,1, 1, 1, 1, 1, 1, 0},
{0,0,1, 1, 1, 1, 1, 0, 0},
{0,0,0, 1, 1, 1, 0, 0, 0},
{0,0,0, 0, 2, 0, 0, 0, 0} }

combat:setArea(createCombatArea(AREA_WAVEBOLT))
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_BOLT)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)



function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 1.2) + 7
    local max = (level / 5) + (maglevel * 2) + 12
    return -min, -max
end...
I want to create a spell that send BOLTs to every field of the wave spell

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)

AREA_WAVEBOLT = {
{1,1,1, 1, 1, 1, 1, 1, 1}, 
{0,1,1, 1, 1, 1, 1, 1, 0},
{0,0,1, 1, 1, 1, 1, 0, 0},
{0,0,0, 1, 1, 1, 0, 0, 0},
{0,0,0, 0, 2, 0, 0, 0, 0} }

combat:setArea(createCombatArea(AREA_WAVEBOLT))
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_BOLT)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)



function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 1.2) + 7
    local max = (level / 5) + (maglevel * 2) + 12
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

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

spells.xml
Code:
    <instant group="attack" name="Bolt Wave" words="exevo bolt hur" lvl="30" direction="1" mana="100"  exhaustion="2000" needlearn="0" script="attack/Bolt Wave.lua">
        <vocation name="Paladin"/>
        <vocation name="Royal Paladin"/>
    </instant>

the effect is:
VnjWc

Imgur: The most awesome images on the Internet

Sends the bolt only on the first square in the front of player (red square on screen)

Would like to send bolt on every square of the definied AREA_WAVEBOLT
Try this:
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)

AREA_WAVEBOLT = {
{1,1,1, 1, 1, 1, 1, 1, 1},
{0,1,1, 1, 1, 1, 1, 1, 0},
{0,0,1, 1, 1, 1, 1, 0, 0},
{0,0,0, 1, 1, 1, 0, 0, 0},
{0,0,0, 0, 2, 0, 0, 0, 0} }

combat:setArea(createCombatArea(AREA_WAVEBOLT))
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_BOLT)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)



function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 1.2) + 7
    local max = (level / 5) + (maglevel * 2) + 12
    return -min, -max
end

function onTargetTile(creature, position)
    if creature then
        creature:getPosition():sendDistanceEffect(position, CONST_ANI_BOLT)
    end
end

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

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