• 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 Ignore target and effect appear in front of player TFS 1.3

Icaraii

Active Member
Joined
Jan 5, 2020
Messages
295
Solutions
1
Reaction score
37
Hello guys, I'm creating a animated spell, where effects appear in different sqm, in line, in diferent times. It is working fine when I got no target locked, it does appear the effect in order in front of the player, however, when I have a target, the effect starts to appear in the target. This might be a very easy thing to solve, but I'm having a hard time finding a way to achiev what I need.
So what I need is for the effect appear in front of the player even when has a target locked.
(I know that the script is not in TFS 1.3, but it works in TFS 1.3)
Lua:
-- SpellCreator generated.

-- =============== COMBAT VARS ===============
-- Areas/Combat for 0ms
local duration = 6 * 1000 -- 6 seconds
local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, 234)
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat0_Brush, COMBAT_PARAM_BLOCKARMOR, true)
setCombatParam(combat0_Brush, COMBAT_PARAM_BLOCKSHIELD, true)
setCombatArea(combat0_Brush,createCombatArea({
{0, 0, 1, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 2, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0}}))
function onGetFormulaValues(player, skill, attack)

    local playlvl = player:getLevel()

    if (playlvl<300) then
    local min = (player:getLevel()) + (skill * 3) + (attack * 3)
    local max = (player:getLevel()) + (skill * 3) + (attack * 3) * 1,5
    return -min, -max
    
    else
    local min = (300) + (skill * 3) + (attack * 3)
    local max = (300) + (skill * 3) + (attack * 3) * 1,5
    return -min, -max
    end   
end               
setCombatCallback(combat0_Brush, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
local dfcombat0_Brush = {40,0,1}

-- Areas/Combat for 200ms
local combat2_Brush = createCombatObject()
setCombatParam(combat2_Brush, COMBAT_PARAM_EFFECT, 234)
setCombatParam(combat2_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat2_Brush, COMBAT_PARAM_BLOCKARMOR, true)
setCombatParam(combat2_Brush, COMBAT_PARAM_BLOCKSHIELD, true)
setCombatArea(combat2_Brush,createCombatArea({
{0, 0, 0, 0, 0},
{0, 0, 1, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 2, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0}}))
function onGetFormulaValues(player, skill, attack)

    local playlvl = player:getLevel()

    if (playlvl<300) then
    local min = (player:getLevel()) + (skill * 3) + (attack * 3)
    local max = (player:getLevel()) + (skill * 3) + (attack * 3) * 1,5
    return -min, -max
    
    else
    local min = (300) + (skill * 3) + (attack * 3)
    local max = (300) + (skill * 3) + (attack * 3) * 1,5
    return -min, -max
    end   
end       
setCombatCallback(combat2_Brush, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
local dfcombat2_Brush = {40,0,2}

-- Areas/Combat for 400ms
local combat4_Brush = createCombatObject()
setCombatParam(combat4_Brush, COMBAT_PARAM_EFFECT, 234)
setCombatParam(combat4_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat4_Brush, COMBAT_PARAM_BLOCKARMOR, true)
setCombatParam(combat4_Brush, COMBAT_PARAM_BLOCKSHIELD, true)
setCombatArea(combat4_Brush,createCombatArea({
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 1, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 2, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0}}))
function onGetFormulaValues(player, skill, attack)

    local playlvl = player:getLevel()

    if (playlvl<300) then
    local min = (player:getLevel()) + (skill * 3) + (attack * 3)
    local max = (player:getLevel()) + (skill * 3) + (attack * 3) * 1,5
    return -min, -max
    
    else
    local min = (300) + (skill * 3) + (attack * 3)
    local max = (300) + (skill * 3) + (attack * 3) * 1,5
    return -min, -max
    end   
end       
setCombatCallback(combat4_Brush, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
local dfcombat4_Brush = {40,0,3}

-- Areas/Combat for 600ms
local combat6_Brush = createCombatObject()
setCombatParam(combat6_Brush, COMBAT_PARAM_EFFECT, 234)
setCombatParam(combat6_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat6_Brush, COMBAT_PARAM_BLOCKARMOR, true)
setCombatParam(combat6_Brush, COMBAT_PARAM_BLOCKSHIELD, true)
setCombatArea(combat6_Brush,createCombatArea({
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 1, 0, 0},
{0, 0, 2, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0}}))
function onGetFormulaValues(player, skill, attack)

    local playlvl = player:getLevel()

    if (playlvl<300) then
    local min = (player:getLevel()) + (skill * 3) + (attack * 3)
    local max = (player:getLevel()) + (skill * 3) + (attack * 3) * 1,5
    return -min, -max
    
    else
    local min = (300) + (skill * 3) + (attack * 3)
    local max = (300) + (skill * 3) + (attack * 3) * 1,5
    return -min, -max
    end   
end       
setCombatCallback(combat6_Brush, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
local dfcombat6_Brush = {40,0,4}

-- Areas/Combat for 800ms
local combat8_Brush = createCombatObject()
setCombatParam(combat8_Brush, COMBAT_PARAM_EFFECT, 234)
setCombatParam(combat8_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat8_Brush, COMBAT_PARAM_BLOCKARMOR, true)
setCombatParam(combat8_Brush, COMBAT_PARAM_BLOCKSHIELD, true)
setCombatArea(combat8_Brush,createCombatArea({
{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}}))
function onGetFormulaValues(player, skill, attack)

    local playlvl = player:getLevel()

    if (playlvl<300) then
    local min = (player:getLevel()) + (skill * 3) + (attack * 3)
    local max = (player:getLevel()) + (skill * 3) + (attack * 3) * 1,5
    return -min, -max
    
    else
    local min = (300) + (skill * 3) + (attack * 3)
    local max = (300) + (skill * 3) + (attack * 3) * 1,5
    return -min, -max
    end   
end       
setCombatCallback(combat8_Brush, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
local dfcombat8_Brush = {40,0,5}

-- =============== CORE FUNCTIONS ===============
local function RunPart(c,cid,var,dirList,dirEmitPos) -- Part
    if (isCreature(cid)) then
        doCombat(cid, c, var)
        if (dirList ~= nil) then -- Emit distance effects
            local i = 2;
            while (i < #dirList) do
                doSendDistanceShoot(dirEmitPos,{x=dirEmitPos.x-dirList[i],y=dirEmitPos.y-dirList[i+1],z=dirEmitPos.z},dirList[1])
                i = i + 2
            end       
        end
    end
end

function onCastSpell(cid, var)
     local startPos = getCreaturePosition(cid)
    RunPart(combat0_Brush,cid.uid,var,dfcombat0_Brush,startPos)
    addEvent(RunPart,200,combat2_Brush,cid.uid,var,dfcombat2_Brush,startPos)
    addEvent(RunPart,400,combat4_Brush,cid.uid,var,dfcombat4_Brush,startPos)
    addEvent(RunPart,600,combat6_Brush,cid.uid,var,dfcombat6_Brush,startPos)
    addEvent(RunPart,800,combat8_Brush,cid.uid,var,dfcombat8_Brush,startPos)
    return true
end

XML:
    <instant group="attack" spellid="190" name="line of arrow" words="Arrow line" level="1" mana="10" casterTargetOrDirection="1" blockwalls="1" cooldown="2000" groupcooldown="2000" needlearn="0" script="attack/bow/arrowline.lua">
        <vocation name="Paladin" />
    </instant>




Animação.gif
 
OP
OP
I

Icaraii

Active Member
Joined
Jan 5, 2020
Messages
295
Solutions
1
Reaction score
37
XML: remove casterTargetOrDirection, use only on target spell

ex: search 'exori frigo' and see
That doesn't work, as you can see in the script, the area need to use caster direction, otherwise it would appear always south of the player, no matter his direction. The goal here is to make it always appear in front of the player.
 
Top