it is possible to convert this part of the code to tfs 1.3?
Lua:
local function onCastSpell2(p)
if isPlayer(p.cid) == FALSE or isPlayer(p.alvo) == FALSE then -- interrompe a magia se cid ou o alvo morrer
return TRUE
end
alvoPos = getCreaturePosition(p.alvo)
cidPos = getCreaturePosition(p.cid)
if getDistanceBetween(cidPos, alvoPos) >= 9 or getCreatureTarget(p.cid) ~= p.alvo then -- se conseguir ficar a uma distância de 8 sqm do alvo, ou parar de atacar/trocar de alvo a magia é interrompida
return TRUE
end
doSendMagicEffect(alvoPos, CONST_ME_PURPLEENERGY)
doSendMagicEffect(cidPos, CONST_ME_PURPLEENERGY)
doSendDistanceShoot(cidPos, alvoPos, CONST_ANI_ENERGY)
doSendDistanceShoot(alvoPos, cidPos, CONST_ANI_ENERGY)
if p.contador == 17 then
if getPlayerStorageValue(p.alvo,30043) == TRUE then -- jogador que tem a aura do Gran Castle, năo é atingido pelo Change Corpse
doPlayerSendCancel(p.cid, "O alvo é protegido pela Gran Aura.")
return TRUE
end
doTeleportThing(p.cid, alvoPos, 0)
doTeleportThing(p.alvo, cidPos, 0)
doSendMagicEffect(alvoPos, CONST_ME_TELEPORT)
doSendMagicEffect(cidPos, CONST_ME_TELEPORT)
else
addEvent(onCastSpell2, 100, {cid = p.cid, alvo = p.alvo, contador = p.contador+1})
end
end
Last edited: