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 Night Wolf 285 Postado Fevereiro 10, 2016 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:getNextPosition(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 Link para o comentário https://xtibia.com/forum/topic/239254-spell-para-tfs-1x-teleporta-tile/#findComment-1685447 Compartilhar em outros sites More sharing options...
0 Night Wolf 285 Postado Fevereiro 4, 2016 Share Postado Fevereiro 4, 2016 Vamos pras seguintes situações.p = playerx = sqmz = obstáculo.pxxz (antes da spell)Ao castar ele ficariaxxpz (anda só 2 sqm) OU pxxz (não casta e diz que tem obstaculo?)No caso de pxzx ele não atravessaria mas no caso de pzxx ele atravessa? Link para o comentário https://xtibia.com/forum/topic/239254-spell-para-tfs-1x-teleporta-tile/#findComment-1684749 Compartilhar em outros sites More sharing options...
0 julhinhuu 26 Postado Fevereiro 4, 2016 Autor Share Postado Fevereiro 4, 2016 Mds, me perdi hahaha, mais tipo assim... ele teleporta 3 sqms de uma só vez.. se tiver espaço de 2 ele vai da sorry not possible. Então é isso, a sim e ele não atravessará paredes igual gms. Link para o comentário https://xtibia.com/forum/topic/239254-spell-para-tfs-1x-teleporta-tile/#findComment-1684750 Compartilhar em outros sites More sharing options...
0 julhinhuu 26 Postado Fevereiro 10, 2016 Autor Share Postado Fevereiro 10, 2016 Up Link para o comentário https://xtibia.com/forum/topic/239254-spell-para-tfs-1x-teleporta-tile/#findComment-1685421 Compartilhar em outros sites More sharing options...
0 Night Wolf 285 Postado Fevereiro 10, 2016 Share Postado Fevereiro 10, 2016 tenta assim.. local function isWalkable(position, pz) local tile = Tile(position) if not tile then return false end if pz and Tile(position):hasFlag(TILESTATE_PROTECTIONZONE) then return false end local ground = tile:getGround() if not ground or ground:hasProperty(CONST_PROP_BLOCKSOLID) then return false 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() and item:hasProperty(CONST_PROP_BLOCKSOLID) then return false end end return true end function onCastSpell(cid, var) local nextPosition = cid:getPosition() for i = 1, 3 do nextPosition = nextPosition:getNextPosition(cid:getDirection()) if not isWalkable(nextPosition, i == 3) then cid:sendCancelMessage("Sorry not possible.") return false end end self:teleportTo(nextPosition, true) return true end se não for tenta assim local function isWalkable(position, pz) local tile = Tile(position) if not tile then return false end if pz and Tile(position):hasFlag(TILESTATE_PROTECTIONZONE) then return false end local ground = tile:getGround() if not ground or ground:hasProperty(CONST_PROP_BLOCKSOLID) then return false 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() and item:hasProperty(CONST_PROP_BLOCKSOLID) then return false end end return true end function onCastSpell(player, var) cid = Player(player) local nextPosition = cid:getPosition() for i = 1, 3 do nextPosition = nextPosition:getNextPosition(cid:getDirection()) if not isWalkable(nextPosition, i == 3) then cid:sendCancelMessage("Sorry not possible.") return false end end self:teleportTo(nextPosition, true) return true end Se algum dos dois funcionar me diz qual que foi... Link para o comentário https://xtibia.com/forum/topic/239254-spell-para-tfs-1x-teleporta-tile/#findComment-1685423 Compartilhar em outros sites More sharing options...
0 julhinhuu 26 Postado Fevereiro 10, 2016 Autor Share Postado Fevereiro 10, 2016 tenta assim.. local function isWalkable(position, pz) local tile = Tile(position) if not tile then return false end if pz and Tile(position):hasFlag(TILESTATE_PROTECTIONZONE) then return false end local ground = tile:getGround() if not ground or ground:hasProperty(CONST_PROP_BLOCKSOLID) then return false 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() and item:hasProperty(CONST_PROP_BLOCKSOLID) then return false end end return true end function onCastSpell(cid, var) local nextPosition = cid:getPosition() for i = 1, 3 do nextPosition = nextPosition:getNextPosition(cid:getDirection()) if not isWalkable(nextPosition, i == 3) then cid:sendCancelMessage("Sorry not possible.") return false end end self:teleportTo(nextPosition, true) return true end se não for tenta assim local function isWalkable(position, pz) local tile = Tile(position) if not tile then return false end if pz and Tile(position):hasFlag(TILESTATE_PROTECTIONZONE) then return false end local ground = tile:getGround() if not ground or ground:hasProperty(CONST_PROP_BLOCKSOLID) then return false 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() and item:hasProperty(CONST_PROP_BLOCKSOLID) then return false end end return true end function onCastSpell(player, var) cid = Player(player) local nextPosition = cid:getPosition() for i = 1, 3 do nextPosition = nextPosition:getNextPosition(cid:getDirection()) if not isWalkable(nextPosition, i == 3) then cid:sendCancelMessage("Sorry not possible.") return false end end self:teleportTo(nextPosition, true) return true end Se algum dos dois funcionar me diz qual que foi... Não da nenhum erro nos dois, so aparece 'Sorry not possible' e não teleporta de forma alguma. Link para o comentário https://xtibia.com/forum/topic/239254-spell-para-tfs-1x-teleporta-tile/#findComment-1685425 Compartilhar em outros sites More sharing options...
0 Night Wolf 285 Postado Fevereiro 10, 2016 Share Postado Fevereiro 10, 2016 troca essa linha aqui:nextPosition = nextPosition:getNextPosition(cid:getDirection())pornextPosition:getNextPosition(cid:getDirection())Testa numa area aberta Link para o comentário https://xtibia.com/forum/topic/239254-spell-para-tfs-1x-teleporta-tile/#findComment-1685426 Compartilhar em outros sites More sharing options...
0 julhinhuu 26 Postado Fevereiro 10, 2016 Autor Share Postado Fevereiro 10, 2016 troca essa linha aqui: nextPosition = nextPosition:getNextPosition(cid:getDirection()) por nextPosition:getNextPosition(cid:getDirection()) Testa numa area aberta Deu esso erro: Link para o comentário https://xtibia.com/forum/topic/239254-spell-para-tfs-1x-teleporta-tile/#findComment-1685427 Compartilhar em outros sites More sharing options...
0 Night Wolf 285 Postado Fevereiro 10, 2016 Share Postado Fevereiro 10, 2016 tenta assim: local function Position.isWalkable(position, playerBlock, pz) local tile = Tile(position) if not tile then return false end if playerBlock and tile:getCreatureCount() ~= 0 then return false end if pz and Tile(position):hasFlag(TILESTATE_PROTECTIONZONE) then return false end local ground = tile:getGround() if not ground or ground:hasProperty(CONST_PROP_BLOCKSOLID) then return false end local items = tile:getItems() for i = 1, tile:getItemCount() do local item = items[i] local itemType = item:getType() if itemType:getType() ~= ITEM_TYPE_MAGICFIELD and not itemType:isMovable() and item:hasProperty(CONST_PROP_BLOCKSOLID) then return false end end return true end function onCastSpell(creature, var, isHotkey) local nextPosition = creature:getPosition() for i = 1, 3 do nextPosition:getNextPosition(creature:getDirection()) if not nextPosition:isWalkable(i == 3, i == 3) then creature:sendCancelMessage("Sorry not possible.") return false end end creature:teleportTo(nextPosition, true) return true end Link para o comentário https://xtibia.com/forum/topic/239254-spell-para-tfs-1x-teleporta-tile/#findComment-1685431 Compartilhar em outros sites More sharing options...
0 julhinhuu 26 Postado Fevereiro 10, 2016 Autor Share Postado Fevereiro 10, 2016 tenta assim: local function Position.isWalkable(position, playerBlock, pz) local tile = Tile(position) if not tile then return false end if playerBlock and tile:getCreatureCount() ~= 0 then return false end if pz and Tile(position):hasFlag(TILESTATE_PROTECTIONZONE) then return false end local ground = tile:getGround() if not ground or ground:hasProperty(CONST_PROP_BLOCKSOLID) then return false end local items = tile:getItems() for i = 1, tile:getItemCount() do local item = items[i] local itemType = item:getType() if itemType:getType() ~= ITEM_TYPE_MAGICFIELD and not itemType:isMovable() and item:hasProperty(CONST_PROP_BLOCKSOLID) then return false end end return true end function onCastSpell(creature, var, isHotkey) local nextPosition = creature:getPosition() for i = 1, 3 do nextPosition:getNextPosition(creature:getDirection()) if not nextPosition:isWalkable(i == 3, i == 3) then creature:sendCancelMessage("Sorry not possible.") return false end end creature:teleportTo(nextPosition, true) return true end ta dando esse erro e não teleporta: Link para o comentário https://xtibia.com/forum/topic/239254-spell-para-tfs-1x-teleporta-tile/#findComment-1685432 Compartilhar em outros sites More sharing options...
0 Night Wolf 285 Postado Fevereiro 10, 2016 Share Postado Fevereiro 10, 2016 eita, n era pra dar esse erro... tenta assim:no lugar de Position.isWalkableusa Position:isWalkable Link para o comentário https://xtibia.com/forum/topic/239254-spell-para-tfs-1x-teleporta-tile/#findComment-1685433 Compartilhar em outros sites More sharing options...
0 julhinhuu 26 Postado Fevereiro 10, 2016 Autor Share Postado Fevereiro 10, 2016 eita, n era pra dar esse erro... tenta assim: no lugar de Position.isWalkable usa Position:isWalkable Ja havia tentado, esta dando erro no ':' Link para o comentário https://xtibia.com/forum/topic/239254-spell-para-tfs-1x-teleporta-tile/#findComment-1685435 Compartilhar em outros sites More sharing options...
0 Night Wolf 285 Postado Fevereiro 10, 2016 Share Postado Fevereiro 10, 2016 é com . mesmo, engraçado estar dando erro :// remove a linha e reescreve ela manualmente (sem ctrl + v).. as vezes pode ser erro pelo editor, tá no notepad++? se tiver clica em formatar -> converter para ansii Link para o comentário https://xtibia.com/forum/topic/239254-spell-para-tfs-1x-teleporta-tile/#findComment-1685438 Compartilhar em outros sites More sharing options...
0 julhinhuu 26 Postado Fevereiro 10, 2016 Autor Share Postado Fevereiro 10, 2016 é com . mesmo, engraçado estar dando erro :// remove a linha e reescreve ela manualmente (sem ctrl + v).. as vezes pode ser erro pelo editor, tá no notepad++? se tiver clica em formatar -> converter para ansii Então ja fiz, não estava usando o Notepad mais coloquei lá também e nada, tenho um script aqui que funciona so que ele atravessa parede Segue ai: 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 ver se esse ajudar em alguma coisas ^^ Link para o comentário https://xtibia.com/forum/topic/239254-spell-para-tfs-1x-teleporta-tile/#findComment-1685439 Compartilhar em outros sites More sharing options...
0 Night Wolf 285 Postado Fevereiro 10, 2016 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 Link para o comentário https://xtibia.com/forum/topic/239254-spell-para-tfs-1x-teleporta-tile/#findComment-1685440 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