• 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.X+ How can update spell based direction? OnTargetTile

zippy

Member
Joined
Feb 1, 2011
Messages
233
Reaction score
8
Hi,

how can i update the direction of the the spell?
Lua:
function spellCallback(cid, position, count)
    if Creature(cid) then
        if count > 0 or math.random(0, 1) == 1 then
            position:sendMagicEffect(CONST_ME_HITBYFIRE)
            doAreaCombat(cid, COMBAT_FIREDAMAGE, position, 0, -100, -100, CONST_ME_EXPLOSIONHIT)
        end

        if count < 3 then
            count = count + 1
            addEvent(spellCallback, math.random(1000, 4000), cid, position, count)
        end
    end
end

function onTargetTile(creature, position)
    spellCallback(creature:getId(), position, 0)
end

local combat = Combat()
combat:setArea(createCombatArea(AREA_SQUAREWAVE5, AREADIAGONAL_SQUAREWAVE5))
combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")

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

Icaraii

Active Member
Joined
Jan 5, 2020
Messages
295
Solutions
1
Reaction score
37
Hi,

how can i update the direction of the the spell?
Lua:
function spellCallback(cid, position, count)
    if Creature(cid) then
        if count > 0 or math.random(0, 1) == 1 then
            position:sendMagicEffect(CONST_ME_HITBYFIRE)
            doAreaCombat(cid, COMBAT_FIREDAMAGE, position, 0, -100, -100, CONST_ME_EXPLOSIONHIT)
        end

        if count < 3 then
            count = count + 1
            addEvent(spellCallback, math.random(1000, 4000), cid, position, count)
        end
    end
end

function onTargetTile(creature, position)
    spellCallback(creature:getId(), position, 0)
end

local combat = Combat()
combat:setArea(createCombatArea(AREA_SQUAREWAVE5, AREADIAGONAL_SQUAREWAVE5))
combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")

function onCastSpell(creature, variant, isHotkey)
    return combat:execute(creature, variant)
end
What do you mean update the direction? You want to send effect in x,y,z? Or you want to send different effects appearing acording to player direction? Or the wave is not going to the direction of the player?
 
OP
OP
Z

zippy

Member
Joined
Feb 1, 2011
Messages
233
Reaction score
8
What do you mean update the direction? You want to send effect in x,y,z? Or you want to send different effects appearing acording to player direction? Or the wave is not going to the direction of the player?
The wave get stuck in the same direction first time i cast it
 
Top