Roksas 846 Postado Março 18, 2013 Share Postado Março 18, 2013 (editado) Positioner [v1] Iaaaae Galera, como vão? Hoje vim lhes apresentar o meu Action. É o Positioner, oque ele faz? O Positioner é um item (ID:1956 - MAPA), ao dar USE, ele grava suas coordenadas, ai você pode ir para aonde quiser. Pode até morrer, dando USE novamente, voltará para aquelas coordenadas (posição) que salvou. Legal né? Eu adaptei alguns códigos que achei para fazê-lo, vamos lá. Vá em data/lib, abra o arquivo 050-function.lua, as vezes pode estar só com o nome function.lua. Lá, na última linha de todas, dê um enter, pule uma linha e acrescente isso: function savePosition(cid) RETORNAR = {x = getPlayerStorageValue(cid, 20000), y = getPlayerStorageValue(cid, 20001), z = getPlayerStorageValue(cid, 20002)} local PLAYER = getPlayerGUID(cid) addEvent(function() if isCreature(cid) then setPlayerStorageValue(PLAYER, 20003, 0) else db.executeQuery("DELETE FROM `player_storage` WHERE `key` = 20003 AND `player_id` = " .. getPlayerGUID(cid) .. ";") end end) end Essa é a nossa função para salvar a position, usei a do SkyMagnum (talkaction) e adaptei para action. No caso, vá em data/actions/scripts, copie algum arquivo dessa pasta e cole. Renomeie para positioner.lua,abra com o bloco de notas, apague oque estiver dentro e cole: function onUse(cid, item, frompos, item2, topos) if getPlayerStorageValue(cid, 20003) <= 0 then setPlayerStorageValue(cid, 20000, getCreaturePosition(cid).x) setPlayerStorageValue(cid, 20001, getCreaturePosition(cid).y) setPlayerStorageValue(cid, 20002, getCreaturePosition(cid).z) doSendMagicEffect(getCreaturePosition(cid), 28) doPlayerSendTextMessage(cid,27,"You have saved your position, use the Positoner again to be sent to the starting position.") setPlayerStorageValue(cid, 20003, 1) savePosition(cid) return true end if getPlayerStorageValue(cid, 20003) > 0 then doTeleportThing(cid, RETORNAR) doSendMagicEffect(RETORNAR,28) doSendAnimatedText(RETORNAR,"Returned!",math.random(1,255)) doPlayerSendTextMessage(cid, 27, "You returned to its initial position. To save again, simply use the Positioner.") setPlayerStorageValue(cid, 20000, 0) setPlayerStorageValue(cid, 20001, 0) setPlayerStorageValue(cid, 20002, 0) setPlayerStorageValue(cid, 20003, 0) end return true end Agora no arquivo actions.xml, adicione essa tag: <action itemid="1956" event="script" value="positioner.lua"/> No caso é o item ID 1956 que é um mapa, basta dar USE nele para salvar e dar USE novamente para retornar á position! Se quiser trocar o ID do item na tag pode, mas esse item não pode ser do tipo "Use With..." Beeeeijo grande galera, aguardem por breves versões Editado Março 18, 2013 por Roksas Link para o comentário https://xtibia.com/forum/topic/210074-positioner-v1/ Compartilhar em outros sites More sharing options...
Faelzdanil 102 Postado Março 18, 2013 Share Postado Março 18, 2013 Pode ser de muita utilidade em quest e tal... Parabens ! REP++ Link para o comentário https://xtibia.com/forum/topic/210074-positioner-v1/#findComment-1489103 Compartilhar em outros sites More sharing options...
Slicer 1070 Postado Março 18, 2013 Share Postado Março 18, 2013 seria bom identizar esse codigo... o sky eh lokin kkk Link para o comentário https://xtibia.com/forum/topic/210074-positioner-v1/#findComment-1489104 Compartilhar em outros sites More sharing options...
Roksas 846 Postado Março 18, 2013 Autor Share Postado Março 18, 2013 @fael Obrigado. @Slicer Oi? Como assim identizar cara? Link para o comentário https://xtibia.com/forum/topic/210074-positioner-v1/#findComment-1489106 Compartilhar em outros sites More sharing options...
Slicer 1070 Postado Março 18, 2013 Share Postado Março 18, 2013 assim.. function onUse(cid, item, frompos, item2, topos) if getPlayerStorageValue(cid, 20003) <= 0 then setPlayerStorageValue(cid, 20000, getCreaturePosition(cid).x) setPlayerStorageValue(cid, 20001, getCreaturePosition(cid).y) setPlayerStorageValue(cid, 20002, getCreaturePosition(cid).z) doSendMagicEffect(getCreaturePosition(cid), 28) doPlayerSendTextMessage(cid,27,"You have saved your position, use the Positoner again to be sent to the starting position.") setPlayerStorageValue(cid, 20003, 1) savePosition(cid) return true end if getPlayerStorageValue(cid, 20003) > 0 then doTeleportThing(cid, RETORNAR) doSendMagicEffect(RETORNAR,28) doSendAnimatedText(RETORNAR,"Returned!",math.random(1,255)) doPlayerSendTextMessage(cid, 27, "You returned to its initial position. To save again, simply use the Positioner.") setPlayerStorageValue(cid, 20000, 0) setPlayerStorageValue(cid, 20001, 0) setPlayerStorageValue(cid, 20002, 0) setPlayerStorageValue(cid, 20003, 0) end return true end Link para o comentário https://xtibia.com/forum/topic/210074-positioner-v1/#findComment-1489107 Compartilhar em outros sites More sharing options...
Roksas 846 Postado Março 18, 2013 Autor Share Postado Março 18, 2013 Ah, obrigado Slicer. O que tava de graça, rsrs.Não tive essa ideia de utilizar ele dentro do spoiler. Obrigado! Link para o comentário https://xtibia.com/forum/topic/210074-positioner-v1/#findComment-1489110 Compartilhar em outros sites More sharing options...
Vinc 101 Postado Março 18, 2013 Share Postado Março 18, 2013 identizar??? se quis dizer identar? se foi sua indetação ta errada(a do rokas tbm) @roksas porra cara,porra. como se fais uma coisa dessas local PLAYER = getPlayerGUID(cid) getPlayerGUID(PLAYER) Link para o comentário https://xtibia.com/forum/topic/210074-positioner-v1/#findComment-1489133 Compartilhar em outros sites More sharing options...
Roksas 846 Postado Março 18, 2013 Autor Share Postado Março 18, 2013 (editado) Perdão, fiz meio relaxado rsrs. Obrigado por lembrar getPlayerGUID(getPlayerGUID(cid)) lol eauuhea A identação eu tinha feito certinho no NOTEPAD++ só que o quebrou ela ;s Editado Março 18, 2013 por Roksas Link para o comentário https://xtibia.com/forum/topic/210074-positioner-v1/#findComment-1489141 Compartilhar em outros sites More sharing options...
ZeNit91 11 Postado Março 18, 2013 Share Postado Março 18, 2013 Slicer me add no skype to querendo sua ajuda se possivel. skype: alucardnit Link para o comentário https://xtibia.com/forum/topic/210074-positioner-v1/#findComment-1489153 Compartilhar em outros sites More sharing options...
Roksas 846 Postado Março 18, 2013 Autor Share Postado Março 18, 2013 Zerons, isso é considerado flood. Não desvie o assunto do tópico por favor. Fale isso pelo fórum Barzinho do Éks! Link para o comentário https://xtibia.com/forum/topic/210074-positioner-v1/#findComment-1489154 Compartilhar em outros sites More sharing options...
comedinhasss 234 Postado Março 18, 2013 Share Postado Março 18, 2013 (editado) Muito bom, gostei bastante da ideia. Estava trocando umas ideias com o Roksas e vendo algumas funções até que saiu isso: function onUse(cid, item, frompos, item2, topos) local pos = getCreaturePosition(cid) local player = getPlayerGUID(cid) local point = getWaypointPosition(savetp+player) if getPlayerStorageValue(cid, 20003) == -1 then doWaypointAddTemporial(savetp+player, pos) doSendMagicEffect(pos, 28) doPlayerSendTextMessage(cid,27,"You have saved your position, use the Positoner again to be sent to the starting position.") setPlayerStorageValue(cid, 20003, 1) elseif getPlayerStorageValue(cid, 20003) == 1 then doTeleportThing(cid, point) doSendMagicEffect(point,28) doSendAnimatedText(point,"Returned!",math.random(1,255)) doPlayerSendTextMessage(cid, 27, "You returned to its initial position. To save again, simply use the Positioner.") setPlayerStorageValue(cid, 20003, -1) end return true end Alguém tem uma ideia de como melhora-lo? Editado Março 18, 2013 por BrunoCarvalho Link para o comentário https://xtibia.com/forum/topic/210074-positioner-v1/#findComment-1489236 Compartilhar em outros sites More sharing options...
Slicer 1070 Postado Março 19, 2013 Share Postado Março 19, 2013 (editado) @bruno interessante essa funçao... ja tinha passado o olho por ela mas nunca parei para ver oq fazia ^^ uma pergunta.. da onde ta vindo isso.. savetp edit: essa eh minha versao ^^ function onUse(cid, item, frompos, item2, topos) if getPlayerStorageValue(cid, 21001) == -1 then local p = getThingPos(cid) local save_pos = "x:"..p.x..";y:"..p.y..";z:"..p.z..";" doPlayerSendTextMessage(cid, 27, "You have saved your position!") doSendMagicEffect(p, 21) setPlayerStorageValue(cid, 21000, save_pos) setPlayerStorageValue(cid, 21001, 1) elseif getPlayerStorageValue(cid, 21001) == 1 then local x,y,z = getPlayerStorageValue(cid, 21000):match("x:(.-);y:(.-);z:(.-);") doTeleportThing(cid, {x=tonumber(x), y=tonumber(y), z=tonumber(z)}, false) doPlayerSendTextMessage(cid, 27, "You have returned to the saved position. Use this item again to save a new position!") doSendMagicEffect(getThingPos(cid), 21) setPlayerStorageValue(cid, 21000, -1) setPlayerStorageValue(cid, 21001, -1) end return true end no jogo WYD tem um sistema assim... soh q eh uma gema e um perg... usando a gema tu salva a pos e com o perg tu vai ate essa pos, nesse caso, a pos n reseta quando tu vai ate ela... eh um sistema bem lgl e util... ^^ Editado Março 19, 2013 por Slicer Link para o comentário https://xtibia.com/forum/topic/210074-positioner-v1/#findComment-1489349 Compartilhar em outros sites More sharing options...
comedinhasss 234 Postado Março 24, 2013 Share Postado Março 24, 2013 @bruno interessante essa funçao... ja tinha passado o olho por ela mas nunca parei para ver oq fazia ^^ uma pergunta.. da onde ta vindo isso.. savetp edit: essa eh minha versao ^^ function onUse(cid, item, frompos, item2, topos) if getPlayerStorageValue(cid, 21001) == -1 then local p = getThingPos(cid) local save_pos = "x:"..p.x..";y:"..p.y..";z:"..p.z..";" doPlayerSendTextMessage(cid, 27, "You have saved your position!") doSendMagicEffect(p, 21) setPlayerStorageValue(cid, 21000, save_pos) setPlayerStorageValue(cid, 21001, 1) elseif getPlayerStorageValue(cid, 21001) == 1 then local x,y,z = getPlayerStorageValue(cid, 21000):match("x:(.-);y:(.-);z:(.-);") doTeleportThing(cid, {x=tonumber(x), y=tonumber(y), z=tonumber(z)}, false) doPlayerSendTextMessage(cid, 27, "You have returned to the saved position. Use this item again to save a new position!") doSendMagicEffect(getThingPos(cid), 21) setPlayerStorageValue(cid, 21000, -1) setPlayerStorageValue(cid, 21001, -1) end return true end no jogo WYD tem um sistema assim... soh q eh uma gema e um perg... usando a gema tu salva a pos e com o perg tu vai ate essa pos, nesse caso, a pos n reseta quando tu vai ate ela... eh um sistema bem lgl e util... ^^ O "savetp" e o nome que eu coloquei para a função, após ler o script eu vi que ele seria o que iria salvar, mas ainda não tenho certeza disso... Link para o comentário https://xtibia.com/forum/topic/210074-positioner-v1/#findComment-1492423 Compartilhar em outros sites More sharing options...
fadkkiler 0 Postado Março 25, 2013 Share Postado Março 25, 2013 vo usar nas houses nas camas, quando o cara durmir ele vai dar como se fosse um "chek point" igual ao minecraft, dai quando ele entrar dinovo, se morrer vai dar returne la xD Link para o comentário https://xtibia.com/forum/topic/210074-positioner-v1/#findComment-1493050 Compartilhar em outros sites More sharing options...
Roksas 846 Postado Março 25, 2013 Autor Share Postado Março 25, 2013 Boa escolha, haha. Link para o comentário https://xtibia.com/forum/topic/210074-positioner-v1/#findComment-1493059 Compartilhar em outros sites More sharing options...
Posts Recomendados