romeu23 0 Postado Julho 25, 2012 Share Postado Julho 25, 2012 Presciso de um script que o Npc teleporta apenas players que tiverem uma das 2 Storages (7714 e 7715) Valendo REP+ Link para o comentário https://xtibia.com/forum/topic/190438-npc-npc-teleporter-por-storage/ Compartilhar em outros sites More sharing options...
0 lukas13on 4 Postado Julho 25, 2012 Share Postado Julho 25, 2012 (editado) Pronto di update agora ele vai teleportar quando tiver o storage. Va em npc/scripts e crie um arquivo itemtravel.lua e bote isto dentro: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local pos = {x=152,y=58,z=7} -------------- Pos para onde o player sera levado local storageid = 2468 ----------------- Id do storage function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end if msgcontains(msg, "offer") or msgcontains(msg, "help") then selfSay("Eu posso te levar a TAL lugar por um "..getstorageNameById(storageid).." item, fale {travel} se quizer viajar.", cid) talkState[cid] = 0 elseif msgcontains(msg, 'travel') then if doPlayerStorageid(cid, storageid, 1) then selfSay("Boa viagem.", cid) doTeleportThing(cid, pos) else selfSay("Voce nao tem acesso.", cid) end end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Depois crie um arquivo NOMEDONPC.lua e bote isto dentro: <npc name="NOMEDONPC" script="data/npc/scripts/itemtravel.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="134" head="78" body="88" legs="0" feet="88" addons="3"/> <parameters> <parameter key="message_greet" value="Ola. Para mais informacoes de meus servicos diga {offer}." /> <parameter key="message_farewell" value="Tchau." /> <parameter key="message_walkaway" value="Tchau." /> </parameters> </npc> NÃO ESQUEÇA DE CONFIGURAR! FONTE: LINK Editado Julho 25, 2012 por HarpiaLOOK Link para o comentário https://xtibia.com/forum/topic/190438-npc-npc-teleporter-por-storage/#findComment-1300304 Compartilhar em outros sites More sharing options...
0 SkyLigh 453 Postado Julho 25, 2012 Share Postado Julho 25, 2012 (editado) Editei aki pra você nao testei pq to sem ot em casa local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local pos = {x=921,y=714,z=7} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if (not npcHandler:isFocused(cid)) then return false end if msgcontains(msg, "quest") or msgcontains(msg, "help") then selfSay("Eu posso te levar a um lugar por um "..getItemNameById(itemid).." fale {travel} se quiser viajar.", cid) talkState[cid] = 0 elseif msgcontains(msg, 'travel') then selfSay("Boa viagem.", cid) doTeleportThing(cid, pos) end getPlayerStorageValue(cid,7714) getPlayerStorageValue(cid,7715) selfSay("Voce Nao Tem As storage 7714 e 7715.", cid) return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Bem eu nao sabia se era pra viajar e tirar o item ou se era pra viajar so se voce tivesse o item mas nao removesse, caso nao seja isso que voce queira me fale que eu tiro. Va em npc/scripts e crie um arquivo itemtravel.lua e bote isto dentro: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local pos = {x=152,y=58,z=7} -------------- Pos para onde o player sera levado local itemid = 2468 ----------------- Id do item que vai ser removido do player function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end if msgcontains(msg, "offer") or msgcontains(msg, "help") then selfSay("Eu posso te levar a TAL lugar por um "..getItemNameById(itemid).." item, fale {travel} se quizer viajar.", cid) talkState[cid] = 0 elseif msgcontains(msg, 'travel') then if doPlayerRemoveItem(cid, itemid, 1) then selfSay("Boa viagem.", cid) doTeleportThing(cid, pos) else selfSay("Voce nao tem o item nescessario.", cid) end end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Depois crie um arquivo NOMEDONPC.lua e bote isto dentro: <npc name="NOMEDONPC" script="data/npc/scripts/itemtravel.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="134" head="78" body="88" legs="0" feet="88" addons="3"/> <parameters> <parameter key="message_greet" value="Ola. Para mais informacoes de meus servicos diga {offer}." /> <parameter key="message_farewell" value="Tchau." /> <parameter key="message_walkaway" value="Tchau." /> </parameters> </npc> NAO SE ESQUEÇA DE CONFIGURAR O LOCAL E O ITEMID NO SCRIPT.... FONTE: LINK Desculpe. mas ele quer um que que o player tenha storage nao de remover item Editado Julho 25, 2012 por SkyLigh Link para o comentário https://xtibia.com/forum/topic/190438-npc-npc-teleporter-por-storage/#findComment-1300306 Compartilhar em outros sites More sharing options...
0 lukas13on 4 Postado Julho 25, 2012 Share Postado Julho 25, 2012 (editado) Troque o itemID por STORAGEID ----------------------------------------- pode pega a script, ajeitei para você Editado Julho 25, 2012 por HarpiaLOOK Link para o comentário https://xtibia.com/forum/topic/190438-npc-npc-teleporter-por-storage/#findComment-1300312 Compartilhar em outros sites More sharing options...
0 romeu23 0 Postado Julho 25, 2012 Autor Share Postado Julho 25, 2012 estou testando os scripts aqui e ja edito o post@@ nao esta dando , o player nao tem a storage e está sendo teleportado do mesmo jeito ! EDIT nos dois scripts! Link para o comentário https://xtibia.com/forum/topic/190438-npc-npc-teleporter-por-storage/#findComment-1300355 Compartilhar em outros sites More sharing options...
0 lukas13on 4 Postado Julho 25, 2012 Share Postado Julho 25, 2012 Okay agora editei tente agora. Link para o comentário https://xtibia.com/forum/topic/190438-npc-npc-teleporter-por-storage/#findComment-1300369 Compartilhar em outros sites More sharing options...
0 SkyLigh 453 Postado Julho 25, 2012 Share Postado Julho 25, 2012 editei o meu era um erro técnico desculpe. Link para o comentário https://xtibia.com/forum/topic/190438-npc-npc-teleporter-por-storage/#findComment-1300383 Compartilhar em outros sites More sharing options...
0 romeu23 0 Postado Julho 25, 2012 Autor Share Postado Julho 25, 2012 Tipo @harpialok , eu queria que fosse 2 storages e @Skylight , o player tem a storage e tal, mas na hora que ele fala pra ir o npc nao teleporta ;s local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local pos = {x=160,y=54,z=7} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if (not npcHandler:isFocused(cid)) then return false end if msgcontains(msg, "") or msgcontains(msg, "help") then talkState[cid] = 0 elseif msgcontains(msg, '') then selfSay("Good luck in war!", cid) doTeleportThing(cid, pos) end getPlayerStorageValue(cid,13540) getPlayerStorageValue(cid,13540) selfSay("Sorry, but your guild does not have access to a private area of war.", cid) return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) to usando este script ai e nao ta dando certo ;s Link para o comentário https://xtibia.com/forum/topic/190438-npc-npc-teleporter-por-storage/#findComment-1300391 Compartilhar em outros sites More sharing options...
0 SkyLigh 453 Postado Julho 25, 2012 Share Postado Julho 25, 2012 agora eu acho que vai se n for amanha eu vo testar primeiro que vou baixar algum otserv local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local pos = {x=160,y=54,z=7} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if (not npcHandler:isFocused(cid)) then return false end if msgcontains(msg, "") or msgcontains(msg, "help") then talkState[cid] = 0 elseif msgcontains(msg, '') then selfSay("Good luck in war!", cid) doTeleportThing(cid, pos) end getPlayerStorageValue(cid,7714) getPlayerStorageValue(cid,7715) selfSay("Sorry, but your guild does not have access to a private area of war.", cid) return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Link para o comentário https://xtibia.com/forum/topic/190438-npc-npc-teleporter-por-storage/#findComment-1300394 Compartilhar em outros sites More sharing options...
0 romeu23 0 Postado Julho 25, 2012 Autor Share Postado Julho 25, 2012 nao quer dar , tava prescisando pra agora é urgente ! :S Link para o comentário https://xtibia.com/forum/topic/190438-npc-npc-teleporter-por-storage/#findComment-1300395 Compartilhar em outros sites More sharing options...
0 lukas13on 4 Postado Julho 25, 2012 Share Postado Julho 25, 2012 Valeu por ajeita minha script sou meio novatinho de vez enquando nos erra, mas aprendemos com nossos erros Link para o comentário https://xtibia.com/forum/topic/190438-npc-npc-teleporter-por-storage/#findComment-1300398 Compartilhar em outros sites More sharing options...
0 romeu23 0 Postado Julho 25, 2012 Autor Share Postado Julho 25, 2012 nada ? ;s Link para o comentário https://xtibia.com/forum/topic/190438-npc-npc-teleporter-por-storage/#findComment-1300404 Compartilhar em outros sites More sharing options...
0 lukas13on 4 Postado Julho 25, 2012 Share Postado Julho 25, 2012 tente esse local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) -- OTServ event handling functions start function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end -- OTServ event handling functions end -- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions! local travelNode = keywordHandler:addKeyword({'teleports'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to travel to Teleports of City for 10 gold coins?'}) travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, StorageIDcost=XXXX, destination = {x=117, y=53, z=7} }) travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'}) -- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions! local travelNode = keywordHandler:addKeyword({'depot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to travel to Depot of City for 10 gold coins?'}) travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, StorageIDcost=XXXX, destination = {x=131, y=54, z=7} }) travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'}) keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to \'Teleports\', \'Depot\' for just a small fee.'}) -- Makes sure the npc reacts when you say hi, bye etc. npcHandler:addModule(FocusModule:new()) Link para o comentário https://xtibia.com/forum/topic/190438-npc-npc-teleporter-por-storage/#findComment-1300408 Compartilhar em outros sites More sharing options...
0 romeu23 0 Postado Julho 25, 2012 Autor Share Postado Julho 25, 2012 @ HarpiaLook , agora deu , mas mesmo sem storage ele é teleportado Link para o comentário https://xtibia.com/forum/topic/190438-npc-npc-teleporter-por-storage/#findComment-1300410 Compartilhar em outros sites More sharing options...
0 lukas13on 4 Postado Julho 25, 2012 Share Postado Julho 25, 2012 (editado) Tente agora assim: troque os XXX local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) -- OTServ event handling functions start function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end -- OTServ event handling functions end -- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions! local travelNode = keywordHandler:addKeyword({'teleports'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to travel to Teleports of City for 10 gold coins?'}) travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, IfgetstorageID(XXXX), destination = {x=117, y=53, z=7} }) travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'}) -- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions! local travelNode = keywordHandler:addKeyword({'depot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to travel to Depot of City for 10 gold coins?'}) travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, IfgetstorageID(XXXX), destination = {x=131, y=54, z=7} }) travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'}) keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to \'Teleports\', \'Depot\' for just a small fee.'}) -- Makes sure the npc reacts when you say hi, bye etc. npcHandler:addModule(FocusModule:new()) Editado Julho 25, 2012 por HarpiaLOOK Link para o comentário https://xtibia.com/forum/topic/190438-npc-npc-teleporter-por-storage/#findComment-1300412 Compartilhar em outros sites More sharing options...
0 romeu23 0 Postado Julho 25, 2012 Autor Share Postado Julho 25, 2012 nao quer da @Harpia Look , nao é melhor editar encima desse: local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local pos = {x=160,y=54,z=7} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if (not npcHandler:isFocused(cid)) then return false end if msgcontains(msg, "") or msgcontains(msg, "help") then talkState[cid] = 0 elseif msgcontains(msg, '') then selfSay("Good luck in war!", cid) doTeleportThing(cid, pos) end getPlayerStorageValue(cid,13540) getPlayerStorageValue(cid,7715) selfSay("Sorry, but your guild does not have access to a private area of war.", cid) return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Link para o comentário https://xtibia.com/forum/topic/190438-npc-npc-teleporter-por-storage/#findComment-1300416 Compartilhar em outros sites More sharing options...
Pergunta
romeu23 0
Presciso de um script que o Npc teleporta apenas players que tiverem uma das 2 Storages (7714 e 7715)
Valendo REP+
Link para o comentário
https://xtibia.com/forum/topic/190438-npc-npc-teleporter-por-storage/Compartilhar em outros sites
25 respostass a esta questão
Posts Recomendados