pirilampoo 0 Postado Janeiro 4, 2016 Share Postado Janeiro 4, 2016 Bom pessoal preciso da ajuda de voces. Preciso de um script assim. Npc. O player vai falar com o npc ai ele vai pedir 3 itens diferentes por exemplo. O npc fala para criar o mapa preciso dos seguintes itens. item 2020 qtd 30 item 2021 qtd 30 item 2022 qtd 30 ai se o player nao tiver os itens o npc fala voce nao tem todos itens necescessarios se tiver os itens corretos ele recebe a recompensa item 1010 qtd 1. obrigado pela ajuda. Link para o comentário https://xtibia.com/forum/topic/238633-pedido-quest-npc-que-pega-itens-diferentes-e-da-um-unico-item/ Compartilhar em outros sites More sharing options...
0 zipter98 1102 Postado Janeiro 8, 2016 Share Postado Janeiro 8, 2016 Troque: if getPlayerItemCount(cid, need[1].id) < need[1].qt then selfSay("Você não me trouxe os itens necessários...", cid) selfSay("Lembre-se, eu preciso de todos esses itens...", cid) talkState[talkUser] = 0 return true end por: for i = 1, #need do if getPlayerItemCount(cid, need[i].id) < need[i].qt then selfSay("Você não me trouxe os itens necessários...", cid) selfSay("Lembre-se, eu preciso de todos esses itens...", cid) talkState[talkUser] = 0 return true end end Troque: local stoFinish = {92121} por: local stoFinish = 92121 Troque: setPlayerStorageValue(cid, stoFinish, 0) por: setPlayerStorageValue(cid, stoFinish, 1) Link para o comentário https://xtibia.com/forum/topic/238633-pedido-quest-npc-que-pega-itens-diferentes-e-da-um-unico-item/#findComment-1680494 Compartilhar em outros sites More sharing options...
0 Bluester 206 Postado Janeiro 4, 2016 Share Postado Janeiro 4, 2016 (editado) Não testei. em data/npc crie um arquivo chamado Jax.xml e cole isso dentro: <?xml version="1.0" encoding="UTF-8"?> <npc name="Jax" script="Jax.lua" walkinterval="350000" floorchange="0" speed="0"> <health now="100" max="100"/> <look type="2097" head="20" body="100" legs="50" feet="0"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|.I need {help}...you help me?"/> </parameters> </npc> depois em data/npc/scripts crie um arquivo chamado Jax.lua e cole isso dentro: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} 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 local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid msg = string.lower(msg) --------- local need = { {id = 2020, qt = 30}, --item1 {id = 2021, qt = 30}, --item2 {id = 2022, qt = 30}, --item3 } local rewards = { {id = 1010, qt = 1}, --reward } local stoFinish = 92121 --------- if msgcontains(msg, 'help') or msgcontains(msg, 'ajuda') then if getPlayerStorageValue(cid, stoFinish) >= 1 then selfSay("Sorry, you already had done this quest.", cid) talkState[talkUser] = 0 return true end selfSay("Olá meu amigo, se voce tem os itens para criar o mapa, diga yes !",cid) talkState[talkUser] = 1 return true elseif msgcontains(msg, 'yes') or msgcontains(msg, 'sim') and talkState[talkUser] == 1 then if getPlayerItemCount(cid, need[1].id) < need[1].qt then selfSay("Você não me trouxe os itens necessários...", cid) selfSay("Lembre-se, eu preciso desses 3 itens...", cid) talkState[talkUser] = 0 return true end for i = 1, #need do doPlayerRemoveItem(cid, need.id, need.qt) end for i = 1, #rewards do doPlayerAddItem(cid, rewards.id, rewards.qt) doPlayerAddExperience(cid, 0) end selfSay("Obrigado, tchau!", cid) setPlayerStorageValue(cid, stoFinish, 1) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Janeiro 4, 2016 por Bluester Link para o comentário https://xtibia.com/forum/topic/238633-pedido-quest-npc-que-pega-itens-diferentes-e-da-um-unico-item/#findComment-1680029 Compartilhar em outros sites More sharing options...
0 pirilampoo 0 Postado Janeiro 4, 2016 Autor Share Postado Janeiro 4, 2016 Não testei. em data/npc crie um arquivo chamado Jax.xml e cole isso dentro: <?xml version="1.0" encoding="UTF-8"?> <npc name="Jax" script="Jax.lua" walkinterval="350000" floorchange="0" speed="0"> <health now="100" max="100"/> <look type="2097" head="20" body="100" legs="50" feet="0"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|.I need {help}...you help me?"/> </parameters> </npc> depois em data/npc/scripts crie um arquivo chamado Jax.lua e cole isso dentro: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} 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 local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid msg = string.lower(msg) --------- local need = { {id = 2020, qt = 30}, --item1 {id = 2021, qt = 30}, --item2 {id = 2022, qt = 30}, --item3 } local rewards = { {id = 1010, qt = 1}, --reward } local stoFinish = 92121 --------- if msgcontains(msg, 'help') or msgcontains(msg, 'ajuda') then if getPlayerStorageValue(cid, stoFinish) >= 1 then selfSay("Sorry, you already had done this quest.", cid) talkState[talkUser] = 0 return true end selfSay("Olá meu amigo, se voce tem os itens para criar o mapa, diga yes !",cid) talkState[talkUser] = 1 return true elseif msgcontains(msg, 'yes') or msgcontains(msg, 'sim') and talkState[talkUser] == 1 then if getPlayerItemCount(cid, need[1].id) < need[1].qt then selfSay("Você não me trouxe os itens necessários...", cid) selfSay("Lembre-se, eu preciso desses 3 itens...", cid) talkState[talkUser] = 0 return true end for i = 1, #need do doPlayerRemoveItem(cid, need.id, need.qt) end for i = 1, #rewards do doPlayerAddItem(cid, rewards.id, rewards.qt) doPlayerAddExperience(cid, 0) end selfSay("Obrigado, tchau!", cid) setPlayerStorageValue(cid, stoFinish, 1) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Mano fui testa aqui so que deu um erro assim error - luascript interface data/npc/scripts/jax.lua:28 'then' expected near '=' descobri era as { } como faço pra deixar sem o storage ?? para o player conseguir fazer sempre a quest? se tiver os itens ele consegue fazer a quest ja resolvi tbm so mudei o add sto para 0 Muito obrigado Bluester Link para o comentário https://xtibia.com/forum/topic/238633-pedido-quest-npc-que-pega-itens-diferentes-e-da-um-unico-item/#findComment-1680031 Compartilhar em outros sites More sharing options...
0 Bluester 206 Postado Janeiro 4, 2016 Share Postado Janeiro 4, 2016 Desculpe, tava off aí não deu pra responder... Mas fico feliz em poder ajudá-lo Link para o comentário https://xtibia.com/forum/topic/238633-pedido-quest-npc-que-pega-itens-diferentes-e-da-um-unico-item/#findComment-1680032 Compartilhar em outros sites More sharing options...
0 kaleudd 200 Postado Janeiro 4, 2016 Share Postado Janeiro 4, 2016 (editado) podia botar os créditos do criador néh blue.... Editado Janeiro 4, 2016 por kaleudd Link para o comentário https://xtibia.com/forum/topic/238633-pedido-quest-npc-que-pega-itens-diferentes-e-da-um-unico-item/#findComment-1680033 Compartilhar em outros sites More sharing options...
0 Bluester 206 Postado Janeiro 4, 2016 Share Postado Janeiro 4, 2016 podia botar os créditos do criador néh blue....Foi você quem fez o script ? Eu peguei ele da base Stage e só editei os IDs do item.Caso tenha sido você que tenha criado, créditos à você ! Link para o comentário https://xtibia.com/forum/topic/238633-pedido-quest-npc-que-pega-itens-diferentes-e-da-um-unico-item/#findComment-1680038 Compartilhar em outros sites More sharing options...
0 pirilampoo 0 Postado Janeiro 6, 2016 Autor Share Postado Janeiro 6, 2016 Vixi mano agora que eu vi ainda ta bugado so precisa do primeiro item ... coloquei la assim local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} 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 local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid msg = string.lower(msg) --------- local need = { {id = 12199, qt = 10}, --item1 {id = 12334, qt = 30}, --item2 {id = 12204, qt = 10}, --item3 {id = 12152, qt = 30}, --item4 {id = 14111, qt = 100}, --item5 } local rewards = { {id = 6087, qt = 1}, --reward } local stoFinish = {92121} --------- if msgcontains(msg, 'mapa') or msgcontains(msg, 'Mapa') then if getPlayerStorageValue(cid, stoFinish) >= 1 then selfSay("Voce ja fez a quest.", cid) talkState[talkUser] = 0 return true end selfSay("Fala Marujo, se voce tem os itens para criar o mapa, diga (sim) !",cid) talkState[talkUser] = 1 return true elseif msgcontains(msg, 'sim') or msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if getPlayerItemCount(cid, need[1].id) < need[1].qt then selfSay("Você não me trouxe os itens necessários...", cid) selfSay("Lembre-se, eu preciso de todos esses itens...", cid) talkState[talkUser] = 0 return true end for i = 1, #need do doPlayerRemoveItem(cid, need.id, need.qt) end for i = 1, #rewards do doPlayerAddItem(cid, rewards.id, rewards.qt) doPlayerAddExperience(cid, 0) end selfSay("Pronto, até mais!", cid) setPlayerStorageValue(cid, stoFinish, 0) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Ai tipo se o cara chegar somente com a quantidade do item 1 ele consegue fazer a quest =/ só precisa do primeiro item.. Se poder me ajuda ver o que falta ai.. so ta precisando do item e quantidade do item id1 o resto tanto faz... se eu tiver com os itens certos ele remove tudo e da certo. porem se eu tiver somente com os itens do id 1 ele da certo do mesmo jeito... Link para o comentário https://xtibia.com/forum/topic/238633-pedido-quest-npc-que-pega-itens-diferentes-e-da-um-unico-item/#findComment-1680213 Compartilhar em outros sites More sharing options...
0 kaleudd 200 Postado Janeiro 6, 2016 Share Postado Janeiro 6, 2016 não fui eu o criador '-',mais que eu lembre jax é da system :v Link para o comentário https://xtibia.com/forum/topic/238633-pedido-quest-npc-que-pega-itens-diferentes-e-da-um-unico-item/#findComment-1680231 Compartilhar em outros sites More sharing options...
0 pirilampoo 0 Postado Janeiro 7, 2016 Autor Share Postado Janeiro 7, 2016 Entao seis vao fica tretando ai ou vao ajudar? Link para o comentário https://xtibia.com/forum/topic/238633-pedido-quest-npc-que-pega-itens-diferentes-e-da-um-unico-item/#findComment-1680287 Compartilhar em outros sites More sharing options...
0 Bluester 206 Postado Janeiro 7, 2016 Share Postado Janeiro 7, 2016 no momento estou sem PC porque viajei, não vejo em que posso ajudar pois estou pelo celular. Link para o comentário https://xtibia.com/forum/topic/238633-pedido-quest-npc-que-pega-itens-diferentes-e-da-um-unico-item/#findComment-1680292 Compartilhar em outros sites More sharing options...
0 pirilampoo 0 Postado Janeiro 7, 2016 Autor Share Postado Janeiro 7, 2016 Blz se souber de algo ai agradeço se conseguiu entender o problema? Link para o comentário https://xtibia.com/forum/topic/238633-pedido-quest-npc-que-pega-itens-diferentes-e-da-um-unico-item/#findComment-1680294 Compartilhar em outros sites More sharing options...
0 Danihcv 335 Postado Janeiro 8, 2016 Share Postado Janeiro 8, 2016 Tópico movido para dúvidas / pedidos resolvidos. Link para o comentário https://xtibia.com/forum/topic/238633-pedido-quest-npc-que-pega-itens-diferentes-e-da-um-unico-item/#findComment-1680381 Compartilhar em outros sites More sharing options...
0 pirilampoo 0 Postado Janeiro 8, 2016 Autor Share Postado Janeiro 8, 2016 Tópico movido para dúvidas / pedidos resolvidos. NAO FOI RESOLVIDO NAO MAN.! Link para o comentário https://xtibia.com/forum/topic/238633-pedido-quest-npc-que-pega-itens-diferentes-e-da-um-unico-item/#findComment-1680435 Compartilhar em outros sites More sharing options...
0 Danihcv 335 Postado Janeiro 8, 2016 Share Postado Janeiro 8, 2016 (editado) @@pirilampoo, ah, ok. É porque "alguem" (dono do tópico ou algum membro da equipe) marcou como resolvido... sauhsahusa Tópico MovidoEste tópico foi movido de "OTServ → Scripting → Suporte Scripting → Pedidos e dúvidas resolvidos - Scripting"para "OTServ → Scripting → Suporte Scripting". Editado Janeiro 8, 2016 por Danihcv Link para o comentário https://xtibia.com/forum/topic/238633-pedido-quest-npc-que-pega-itens-diferentes-e-da-um-unico-item/#findComment-1680437 Compartilhar em outros sites More sharing options...
0 pirilampoo 0 Postado Janeiro 11, 2016 Autor Share Postado Janeiro 11, 2016 Troque: if getPlayerItemCount(cid, need[1].id) < need[1].qt then selfSay("Você não me trouxe os itens necessários...", cid) selfSay("Lembre-se, eu preciso de todos esses itens...", cid) talkState[talkUser] = 0 return true end por: for i = 1, #need do if getPlayerItemCount(cid, need[i].id) < need[i].qt then selfSay("Você não me trouxe os itens necessários...", cid) selfSay("Lembre-se, eu preciso de todos esses itens...", cid) talkState[talkUser] = 0 return true end end Troque: local stoFinish = {92121} por: local stoFinish = 92121 Troque: setPlayerStorageValue(cid, stoFinish, 0) por: setPlayerStorageValue(cid, stoFinish, 1) Aparentemente esta funcionando tudo certinho obrigado Link para o comentário https://xtibia.com/forum/topic/238633-pedido-quest-npc-que-pega-itens-diferentes-e-da-um-unico-item/#findComment-1680829 Compartilhar em outros sites More sharing options...
Pergunta
pirilampoo 0
Bom pessoal preciso da ajuda de voces.
Preciso de um script assim.
Npc.
O player vai falar com o npc ai ele vai pedir 3 itens diferentes por exemplo.
O npc fala para criar o mapa preciso dos seguintes itens.
item 2020 qtd 30
item 2021 qtd 30
item 2022 qtd 30
ai se o player nao tiver os itens o npc fala voce nao tem todos itens necescessarios
se tiver os itens corretos
ele recebe a recompensa
item 1010 qtd 1.
obrigado pela ajuda.
Link para o comentário
https://xtibia.com/forum/topic/238633-pedido-quest-npc-que-pega-itens-diferentes-e-da-um-unico-item/Compartilhar em outros sites
16 respostass a esta questão
Posts Recomendados