guidark21 18 Postado Fevereiro 20, 2013 Share Postado Fevereiro 20, 2013 Dessa vez vim pedir ajuda para colocar que o player so pode fazer a quest em determinando level ai ta o script base: 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 stg = 15333 -- storage para falar com o npc local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg, 'mission') then if getPlayerStorageValue(cid, stg) >= 1 then selfSay("Sorry, you already completed this mission!!", cid) talkState[talkUser] = 0 else selfSay("Ooooh good! I'm looking for some rare items... They are: 50 ruby, 50 water pendant e 150 water gem. Do you have these items?", cid) talkState[talkUser] = 1 end end --------------------------------------------------------- if (msgcontains(msg, "yes") or msgcontains(msg, "sim")) and talkState[talkUser] == 1 then if doPlayerRemoveItem(cid, 12188, 50) and doPlayerRemoveItem(cid, 12170, 50) and doPlayerRemoveItem(cid, 12161, 150) and doPlayerRemoveItem(cid, 8261, 1) == TRUE then selfSay("Thank you!", cid) setPlayerStorageValue(cid, 102, 1) -- storage para liberar outfit setPlayerStorageValue(cid, stg, 1) -- para ele nao fazer a missao novamente doPlayerAddExperience(cid,12000) -- experiencia local bags = getPlayerSlotItem(cid, 10) doAddContainerItem(bags.uid, 12247, 1) else selfSay("Sorry, but you don't have one of these items.", cid) talkState[talkUser] = 0 end elseif (msgcontains(msg, "no") or msgcontains(msg, "nao")) and talkState[talkUser] == 1 then selfSay("Good bye '..getCreatureName(cid)..'.", cid) talkState[talkUser] = 0 end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Se alguem poder me ajuda usando esse mesmo script obrigando e rep+ pra pessoal Link para o comentário https://xtibia.com/forum/topic/208177-encerrado-ajuda-em-npc-task-poketibia-como-por-que-so-level-tal-pode-fazer-a-quest/ Compartilhar em outros sites More sharing options...
Roksas 846 Postado Fevereiro 20, 2013 Share Postado Fevereiro 20, 2013 Aqui está, só substituir, e aonde eu marquei de vermelho é o level que poderá fazer! 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 stg = 15333 -- storage para falar com o npc local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg, 'mission') then if getPlayerLevel(cid) > 100 then selfSay("Sorry, you do not have a necessary level to make a task!", cid) if getPlayerStorageValue(cid, stg) >= 1 then selfSay("Sorry, you already completed this mission!!", cid) talkState[talkUser] = 0 else selfSay("Ooooh good! I'm looking for some rare items... They are: 50 ruby, 50 water pendant e 150 water gem. Do you have these items?", cid) talkState[talkUser] = 1 end end end --------------------------------------------------------- if (msgcontains(msg, "yes") or msgcontains(msg, "sim")) and talkState[talkUser] == 1 then if doPlayerRemoveItem(cid, 12188, 50) and doPlayerRemoveItem(cid, 12170, 50) and doPlayerRemoveItem(cid, 12161, 150) and doPlayerRemoveItem(cid, 8261, 1) == TRUE then selfSay("Thank you!", cid) setPlayerStorageValue(cid, 102, 1) -- storage para liberar outfit setPlayerStorageValue(cid, stg, 1) -- para ele nao fazer a missao novamente doPlayerAddExperience(cid,12000) -- experiencia local bags = getPlayerSlotItem(cid, 10) doAddContainerItem(bags.uid, 12247, 1) else selfSay("Sorry, but you don't have one of these items.", cid) talkState[talkUser] = 0 end elseif (msgcontains(msg, "no") or msgcontains(msg, "nao")) and talkState[talkUser] == 1 then selfSay("Good bye '..getCreatureName(cid)..'.", cid) talkState[talkUser] = 0 end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Link para o comentário https://xtibia.com/forum/topic/208177-encerrado-ajuda-em-npc-task-poketibia-como-por-que-so-level-tal-pode-fazer-a-quest/#findComment-1473460 Compartilhar em outros sites More sharing options...
guidark21 18 Postado Fevereiro 20, 2013 Autor Share Postado Fevereiro 20, 2013 Ocorreu um pequeno erro quadno o cara level 100- fala com ele o npc nao responde ja o 100+ responde porem fica aparecendo uma fala que era pro level 100 olha o erro: 18:34 Npc Task: Sorry, you do not have a necessary level to make a task! 18:34 Npc Task: Ooooh good! I'm looking for some rare items... They are: 50 ruby, 50 water pendant e 150 water gem. Do you have these items? Mesmo assim funcionou oq eu queria no basico so queria mesmo arruma esse erro Link para o comentário https://xtibia.com/forum/topic/208177-encerrado-ajuda-em-npc-task-poketibia-como-por-que-so-level-tal-pode-fazer-a-quest/#findComment-1473470 Compartilhar em outros sites More sharing options...
Roksas 846 Postado Fevereiro 20, 2013 Share Postado Fevereiro 20, 2013 Tenta 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 stg = 15333 -- storage para falar com o npc local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg, 'mission') then if getPlayerStorageValue(cid, stg) >= 1 or getPlayerLevel(cid) > 100 then selfSay("Sorry, you already completed this mission or not have the necessary level to make this task!", cid) talkState[talkUser] = 0 else selfSay("Ooooh good! I'm looking for some rare items... They are: 50 ruby, 50 water pendant e 150 water gem. Do you have these items?", cid) talkState[talkUser] = 1 end end --------------------------------------------------------- if (msgcontains(msg, "yes") or msgcontains(msg, "sim")) and talkState[talkUser] == 1 then if doPlayerRemoveItem(cid, 12188, 50) and doPlayerRemoveItem(cid, 12170, 50) and doPlayerRemoveItem(cid, 12161, 150) and doPlayerRemoveItem(cid, 8261, 1) == TRUE then selfSay("Thank you!", cid) setPlayerStorageValue(cid, 102, 1) -- storage para liberar outfit setPlayerStorageValue(cid, stg, 1) -- para ele nao fazer a missao novamente doPlayerAddExperience(cid,12000) -- experiencia local bags = getPlayerSlotItem(cid, 10) doAddContainerItem(bags.uid, 12247, 1) else selfSay("Sorry, but you don't have one of these items.", cid) talkState[talkUser] = 0 end elseif (msgcontains(msg, "no") or msgcontains(msg, "nao")) and talkState[talkUser] == 1 then selfSay("Good bye '..getCreatureName(cid)..'.", cid) talkState[talkUser] = 0 end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Link para o comentário https://xtibia.com/forum/topic/208177-encerrado-ajuda-em-npc-task-poketibia-como-por-que-so-level-tal-pode-fazer-a-quest/#findComment-1473475 Compartilhar em outros sites More sharing options...
guidark21 18 Postado Fevereiro 20, 2013 Autor Share Postado Fevereiro 20, 2013 Vlw agora foi o task Duvida sanada... Link para o comentário https://xtibia.com/forum/topic/208177-encerrado-ajuda-em-npc-task-poketibia-como-por-que-so-level-tal-pode-fazer-a-quest/#findComment-1473476 Compartilhar em outros sites More sharing options...
Roksas 846 Postado Fevereiro 20, 2013 Share Postado Fevereiro 20, 2013 Disponha, boa sorte com o OT ) Reported. Link para o comentário https://xtibia.com/forum/topic/208177-encerrado-ajuda-em-npc-task-poketibia-como-por-que-so-level-tal-pode-fazer-a-quest/#findComment-1473477 Compartilhar em outros sites More sharing options...
Demonbholder 420 Postado Fevereiro 20, 2013 Share Postado Fevereiro 20, 2013 Tópico movido para a seção de dúvidas e pedidos resolvidos. Link para o comentário https://xtibia.com/forum/topic/208177-encerrado-ajuda-em-npc-task-poketibia-como-por-que-so-level-tal-pode-fazer-a-quest/#findComment-1473508 Compartilhar em outros sites More sharing options...
Stigal 584 Postado Abril 21, 2018 Share Postado Abril 21, 2018 A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta. + Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda. * Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado. Link para o comentário https://xtibia.com/forum/topic/208177-encerrado-ajuda-em-npc-task-poketibia-como-por-que-so-level-tal-pode-fazer-a-quest/#findComment-1733920 Compartilhar em outros sites More sharing options...
Posts Recomendados