Ir para conteúdo
  • 0

Spell Teleport diferente


julhinhuu

Pergunta

Olá galerinha do Xtibia, Boa tarde.

 

Venho aqui pedir-lhes mais 1 spell (Já está ficando clichê) rs, essa spell e para teleportar player em sqms.

 

- O player que usa a magia deverá se teleportar nos sqms, quantidade configurável ou exatamente 3 sqms, se os mesmos estiverem livres sem paredes, players ou outros obstáculos em seu caminho.

 

Bem é isso, obrigado desde já :D


UP ?
Up
Link para o comentário
Compartilhar em outros sites

9 respostass a esta questão

Posts Recomendados

  • 0

Ah, eu tinha entendido errado a explicação da spell. Falha minha, desculpe.

Use este código:

 

local times = 3       --Quantos SQMs o jogador irá se mover.
 
function isWalkable(pos, creature, proj, pz)-- by Nord
    if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
    if getTopCreature(pos).uid > 0 and creature then return false end
    if getTileInfo(pos).protection and pz then return false, true end
    local n = not proj and 2 or 2
    for i = 0, 255 do
        pos.stackpos = i
        local tile = getTileThingByPos(pos)
        if tile.itemid ~= 0 and not isCreature(tile.uid) then
            if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                return false
            end
        end
    end
    return true
end
 
function onCastSpell(cid)
    local playerPos = getThingPos(cid)
    local toPos = {
        [0] = {x = playerPos.x, y = playerPos.y - times, z = playerPos.z},
        [1] = {x = playerPos.x + times, y = playerPos.y, z = playerPos.z},
        [2] = {x = playerPos.x, y = playerPos.y + times, z = playerPos.z},
        [3] = {x = playerPos.x - times, y = playerPos.y, z = playerPos.z}
    }
    
    local spellToPos = toPos[getCreatureLookDirection(cid)]
    if isWalkable(spellToPos) then
        doTeleportThing(cid, spellToPos)
    else
        doPlayerSendCancel(cid, "Sorry, destination not possible.")
    end
    return true
end
Link para o comentário
Compartilhar em outros sites

  • 0


local times = 3 --Quantos SQMs o jogador irá se mover.

 

function isWalkable(pos, creature, proj, pz)-- by Nord

if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end

if getTopCreature(pos).uid > 0 and creature then return false end

if getTileInfo(pos).protection and pz then return false, true end

local n = not proj and 2 or 2

for i = 0, 255 do

pos.stackpos = i

local tile = getTileThingByPos(pos)

if tile.itemid ~= 0 and not isCreature(tile.uid) then

if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then

return false

end

end

end

return true

end

 

function move_creature(cid, i, direction)

if not isPlayer(cid) then

return true

elseif i <= 0 or not isWalkable(getPosByDir(getThingPos(cid), direction)) then

return doCreatureSetNoMove(cid, false)

end

 

doMoveCreature(cid, direction)

addEvent(move_creature, 400, cid, i - 1, direction) --400 = intervalo de tempo entre cada movimento

end

 

function onCastSpell(cid)

doCreatureSetNoMove(cid, true)

move_creature(cid, times, getCreatureLookDirection(cid))

return true

end

 

Editado por zipter98
Link para o comentário
Compartilhar em outros sites

  • 0

Agradeço o interesse pelos meus serviços, mas assuntos relacionados à comercialização de produtos de OTServ são proibidos aqui no fórum.

Basicamente, me limito a ajudar na área de suporte.

Link para o comentário
Compartilhar em outros sites

  • 0

A ta bom é que estou precisando de um scripter, me desculpe pela pergunta, foi uma pergunta inocente.

 

Obrigado novamente pela spell chegar em casa eu vou testar.

local times = 3       --Quantos SQMs o jogador irá se mover.

function isWalkable(pos, creature, proj, pz)-- by Nord
    if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
    if getTopCreature(pos).uid > 0 and creature then return false end
    if getTileInfo(pos).protection and pz then return false, true end
    local n = not proj and 2 or 2
    for i = 0, 255 do
        pos.stackpos = i
        local tile = getTileThingByPos(pos)
        if tile.itemid ~= 0 and not isCreature(tile.uid) then
            if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                return false
            end
        end
    end
    return true
end

function move_creature(cid, i, direction)
    if not isPlayer(cid) then
        return true
    elseif i <= 0 or not isWalkable(getPosByDir(getThingPos(cid), direction)) then
        doCreatureSetNoMove(cid, false)
    end
    
    doMoveCreature(cid, direction)
    addEvent(move_creature, 400, cid, i - 1, direction)     --400 = intervalo de tempo entre cada movimento
end

function onCastSpell(cid)
    doCreatureSetNoMove(cid, true)
    move_creature(cid, times, getCreatureLookDirection(cid))
    return true
end

 

até funciona zipter mais ele não para de andar e ainda atravessa as paredes e tudo mais.

Link para o comentário
Compartilhar em outros sites

  • 0
Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...