julhinhuu 26 Postado Fevereiro 3, 2016 Share Postado Fevereiro 3, 2016 Olá galera do xt; Gostaria de pedir a vocês uma spell que quando player a usar ele sera teleportado 3 sqms na direção que ele está, porém ele não poderá atravessar paredes, rios e etc. Agradeço desde já... estarei tentando fazer também, mais comecei agora com tfs 1x. Abraços e me ajudem por favor. :* Link para o comentário https://xtibia.com/forum/topic/239254-spell-para-tfs-1x-teleporta-tile/ Compartilhar em outros sites More sharing options...
0 julhinhuu 26 Postado Fevereiro 10, 2016 Autor Share Postado Fevereiro 10, 2016 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) for i = 1, times do playerPos = getPosByDir(playerPos, getCreatureLookDirection(cid)) if not isWalkable(playerPos, i == times, i == times, i == times) then doPlayerSendCancel(cid, "Sorry, destination not possible.") return false end end doTeleportThing(cid, playerPos) return true end vê assim Erro em getPosByDir Link para o comentário https://xtibia.com/forum/topic/239254-spell-para-tfs-1x-teleporta-tile/page/2/#findComment-1685441 Compartilhar em outros sites More sharing options...
0 Lucas CP 21 Postado Fevereiro 10, 2016 Share Postado Fevereiro 10, 2016 Tenta assim: local steps = 3 -- quantos tiles anda? local function block(player, position, passo) position:getNextPosition(player:getDirection(), passo) position = player:getClosestFreePosition(position, false) if position.x == 0 then player:sendCancelMessage("You cannot teleport there.") return true end local tile = Tile(position) if not tile then return true end local ground = tile:getGround() if not ground then return true end if tile:hasProperty(CONST_PROP_BLOCKSOLID) then return true end if tile:hasFlag(TILESTATE_HOUSE) or tile:hasFlag(TILESTATE_PROTECTIONZONE) then return true end local items = tile:getItems() for i = 1, #items do local item = items[i] local itemType = item:getType() if itemType:getType() == ITEM_TYPE_MAGICFIELD and not itemType:isMovable() then return true end end if passo == (steps -1) then local creature = Creature(getTopCreature(position).uid) if creature then return true end end end function onCastSpell(cid, var) local player = Player(cid) if not player then return false end local position = player:getPosition() for passo = 1, (steps-1) do if block(player, position, passo) == true then player:sendCancelMessage('Sorry, not possible.') player:getPosition():sendMagicEffect(CONST_ME_POFF) return false end end player:teleportTo(position,false) return true end perdão a gambiarra Link para o comentário https://xtibia.com/forum/topic/239254-spell-para-tfs-1x-teleporta-tile/page/2/#findComment-1685458 Compartilhar em outros sites More sharing options...
0 julhinhuu 26 Postado Fevereiro 10, 2016 Autor Share Postado Fevereiro 10, 2016 Vlw @@Night Wolf, muito obrigado pela persistência Vlw @@Lucas CP, muito obrigado por ajudar também. obs Lucas: Quiser me ajudar em outra Spell vou criar um Tópico, e você tambem night. Funcionou os 2, mais marquei so 1 como melhor resposta. Link para o comentário https://xtibia.com/forum/topic/239254-spell-para-tfs-1x-teleporta-tile/page/2/#findComment-1685489 Compartilhar em outros sites More sharing options...
0 Furabio 258 Postado Fevereiro 16, 2016 Share Postado Fevereiro 16, 2016 Tópico Movido Este tópico foi movido de "OTServ → Scripting → Suporte Scripting" para "OTServ → Scripting → Suporte Scripting → Pedidos e dúvidas resolvidos - Scripting". Link para o comentário https://xtibia.com/forum/topic/239254-spell-para-tfs-1x-teleporta-tile/page/2/#findComment-1686148 Compartilhar em outros sites More sharing options...
Pergunta
julhinhuu 26
Olá galera do xt;
Gostaria de pedir a vocês uma spell que quando player a usar ele sera teleportado 3 sqms na direção que ele está, porém ele não poderá atravessar paredes, rios e etc.
Agradeço desde já... estarei tentando fazer também, mais comecei agora com tfs 1x.
Abraços e me ajudem por favor. :*
Link para o comentário
https://xtibia.com/forum/topic/239254-spell-para-tfs-1x-teleporta-tile/Compartilhar em outros sites
19 respostass a esta questão
Posts Recomendados