Alguém sabe como resolver esse problema? o erro é o seguinte, ao executar a magia e trocar de target o effect acompanha o novo target, meu pedido para resolução seria que o effect só pudesse ir ao novo target com o fim da spell ou que o dano acompanhasse o effect.
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_HITCOLOR, 205)
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, 1)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -99.0, 0, -190.5, 0)
local function onCastSpell1(parameters)
doCombat(parameters.cid, parameters.combat1, parameters.var)
end
function KiBullet(cid)
if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
local position = {x=getThingPosition(getCreatureTarget(cid)).x+1, y=getThingPosition(getCreatureTarget(cid)).y+1, z=getThingPosition(getCreatureTarget(cid)).z}
doSendMagicEffect(position, 329)
end
end
function onCastSpell(cid, var)
local waittime = 9
local storage = 99
if exhaustion.check(cid, storage) then
doPlayerSendCancel(cid, "You are exhausted.")
doSendMagicEffect(getCreaturePosition(cid), 2)
return false
end
local parameters = {cid = cid, var = var, combat1 = combat1}
for i = 1, 10 do
addEvent(function()
if isCreature(cid) then
addEvent(onCastSpell1, 100, parameters)
addEvent(KiBullet,100,cid)
end
end, 1 + ((i-1) * 300))
end
exhaustion.set(cid, storage, waittime)
return true
end