• 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 area is moving with the caster

Fadu

New Member
Joined
Sep 28, 2010
Messages
13
Reaction score
0
Hello!

I made this spell, but I am needing to use mayNotMove, because without it, if I move to another direction, the last part of the spell goes also to another direction.

I want the spell to keep on the initial point and direction without using mayNotMove, how can I do that?

tfs 0.3.7

Here is the script:

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ICETORNADO)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 4.5, 9)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_ICETORNADO)
setAttackFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 4.5, 9)

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, CONST_ME_ICETORNADO)
setAttackFormula(combat3, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 4.5, 9)

local area = createCombatArea(tor1)
setCombatArea(combat, area)
local area2 = createCombatArea(tor2)
setCombatArea(combat2, area2)
local area3 = createCombatArea(tor3)
setCombatArea(combat3, area3)

local function onCastSpell1(parameters)
    --mayNotMove(parameters.cid, TRUE)
    doCombat(parameters.cid, combat, parameters.var)
end

local function onCastSpell2(parameters)
    doCombat(parameters.cid, combat2, parameters.var)
end

local function onCastSpell3(parameters)
    --mayNotMove(parameters.cid, FALSE)
    doCombat(parameters.cid, combat3, parameters.var)
end

function onCastSpell(cid, var)
    local parameters = { cid = cid, var = var, combat1 = combat1, combat2 = combat2, combat3 = combat3 }

    addEvent(onCastSpell1, 1, parameters)
    addEvent(onCastSpell2, 500, parameters)
    addEvent(onCastSpell3, 1000, parameters)

    return true
end
 
Hello!

I made this spell, but I am needing to use mayNotMove, because without it, if I move to another direction, the last part of the spell goes also to another direction.

I want the spell to keep on the initial point and direction without using mayNotMove, how can I do that?

tfs 0.3.7

Here is the script:

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ICETORNADO)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 4.5, 9)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_ICETORNADO)
setAttackFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 4.5, 9)

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, CONST_ME_ICETORNADO)
setAttackFormula(combat3, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 4.5, 9)

local area = createCombatArea(tor1)
setCombatArea(combat, area)
local area2 = createCombatArea(tor2)
setCombatArea(combat2, area2)
local area3 = createCombatArea(tor3)
setCombatArea(combat3, area3)

local function onCastSpell1(parameters)
    --mayNotMove(parameters.cid, TRUE)
    doCombat(parameters.cid, combat, parameters.var)
end

local function onCastSpell2(parameters)
    doCombat(parameters.cid, combat2, parameters.var)
end

local function onCastSpell3(parameters)
    --mayNotMove(parameters.cid, FALSE)
    doCombat(parameters.cid, combat3, parameters.var)
end

function onCastSpell(cid, var)
    local parameters = { cid = cid, var = var, combat1 = combat1, combat2 = combat2, combat3 = combat3 }

    addEvent(onCastSpell1, 1, parameters)
    addEvent(onCastSpell2, 500, parameters)
    addEvent(onCastSpell3, 1000, parameters)

    return true
end
Use onTargetTile and put the addEvent there with a single sqm combat
 
Use onTargetTile and put the addEvent there with a single sqm combat

What do you mean with a single sqm combat?

I added this:

Code:
local thecombat = createCombatObject()
setCombatParam(thecombat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)

function onTargetTile(cid, pos)
    doCombat(cid,thecombat,positionToVariant(pos))
    addEvent(onCastSpell1, 1, parameters)
    addEvent(onCastSpell2, 500, parameters)
    addEvent(onCastSpell3, 1000, parameters)
end

setCombatCallback(thecombat, CALLBACK_PARAM_TARGETTILE, "onTargetTile")

But I don't think I did right or know how to use this function. Can you help me?
 
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ICETORNADO)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 4.5, 9)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_ICETORNADO)
setAttackFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 4.5, 9)

local combat = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, CONST_ME_ICETORNADO)
setAttackFormula(combat3, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 4.5, 9)

local area = createCombatArea(tor1)
setCombatArea(combat, area)
local area2 = createCombatArea(tor2)
setCombatArea(combat2, area2)
local area3 = createCombatArea(tor3)
setCombatArea(combat3, area3)


function onCastSpell(cid, var)
    doCombat(cid, combat, var)
    addEvent(doCombat, 500, cid, combat2, var)
    addEvent(doCombat, 1000, cid, combat3, var)
    return true
end
something like this maybe?
this should do the same combat on the selected tile with a delay
 
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ICETORNADO)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 4.5, 9)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_ICETORNADO)
setAttackFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 4.5, 9)

local combat = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, CONST_ME_ICETORNADO)
setAttackFormula(combat3, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 4.5, 9)

local area = createCombatArea(tor1)
setCombatArea(combat, area)
local area2 = createCombatArea(tor2)
setCombatArea(combat2, area2)
local area3 = createCombatArea(tor3)
setCombatArea(combat3, area3)


function onCastSpell(cid, var)
    doCombat(cid, combat, var)
    addEvent(doCombat, 500, cid, combat2, var)
    addEvent(doCombat, 1000, cid, combat3, var)
    return true
end
something like this maybe?
this should do the same combat on the selected tile with a delay


Doesnt work, happens the same as mine script..

A SS to show:
mCL4bdh.png

my32dNE.png
 
you want it to move WITH the user?
mkalo told me you wanted it to stay, blame him, will fix in a bit
can you paste tor1-tor3?
 
you want it to move WITH the user?
mkalo told me you wanted it to stay, blame him, will fix in a bit
can you paste tor1-tor3?

No, I want to stay, but as you can see, it is moving..

Edit:

The tor1-tor3

Code:
tor1 = {
    {0, 0, 0, 0, 0},
    {0, 1, 3, 1, 0}
}

tor2 = {
    {0, 1, 1, 1, 0},
    {0, 1, 1, 1, 0},
    {0, 0, 2, 0, 0}
}

tor3 = {
    {0, 1, 1, 1, 0},
    {0, 1, 1, 1, 0},
    {0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0},
    {0, 0, 2, 0, 0}
}
 
after testing my code does work, you need
Code:
    <instant name="test beam" words="exevo vis lux" lvl="23" mana="40" direction="1" exhaustion="2000" needlearn="0" event="script" value="attack/testbeam.lua">
        <vocation id="1"/>
        <vocation id="5"/>
    </instant>
in your spells.xml
 
after testing my code does work, you need
Code:
    <instant name="test beam" words="exevo vis lux" lvl="23" mana="40" direction="1" exhaustion="2000" needlearn="0" event="script" value="attack/testbeam.lua">
        <vocation id="1"/>
        <vocation id="5"/>
    </instant>
in your spells.xml

Still dosent work here.. You tried move while mid-cast? beucase that is when bugs. When standing still it works
 
..g when you move the directon you shoot, but not otherwise...
im not sure entirely how to solve it, but youd probably have to do addEvents with set positions for effect / doAreaCombatHealth/mana instead of regular combats
 
Can someone explain what "var" means and does?
"var" means Variant. It's the way the info about the spell (in xml) is passed to lua, It's a table and it's type is one of those:
(Set in var.type):
Code:
VARIANT_NONE = 0,
VARIANT_NUMBER = 1,
VARIANT_POSITION = 2,
VARIANT_TARGETPOSITION = 3,
VARIANT_STRING = 4

You can check source code to know more about them, only VARIANT_NUMBER and VARIANT_POSITION is used in onCastSpell.

Basically if the type is number, then var.number = targetId. If the type is position then var.pos is the targeted position.
 
Back
Top