• 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!

convert function spell to tfs 1.3

f0lpz

New Member
Joined
May 24, 2020
Messages
7
Reaction score
0
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:
Back
Top