Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Estou aprendendo a construir npc de missão, mas estou tendo problemas com o NPC 2 e 3, eles não respondem ao 'sim'.
Alguém pode me ajudar? Desde já, obrigado.
Eles estão relacionados:
O NPC 1 diz para trazer coisas do NPC 2. E o NPC 2 diz que para fazer isso, precisa de itens do NPC3.

 

NPC 1:
 

Spoiler

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
local storage = 135001
function creatureSayCallback(cid, type, msg)
 
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    msg = msg:lower();
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
         if msg == "catacounbs" then
             if getPlayerStorageValue(cid, storage) == -1 then
                 selfSay("Hello! I think you are here to get acess to the entrance of The Catacounbs, right?", cid)
                 talkState[talkUser] = 1
             elseif getPlayerStorageValue(cid, storage) == 5 then
                 selfSay("Did you bring me the itens?", cid)
                 talkState[talkUser] = 1
             elseif getPlayerStorageValue(cid, storage) == 6 then
                 selfSay("Thanks for the help.", cid)
				else
					selfSay("Something is missing.", cid)
             end
             npcHandler:addFocus(cid)
         else
             return false
         end
 
     if msgcontains(msg, "yes") and talkState[talkUser] == 1 then
         if getPlayerStorageValue(cid, storage) == -1 then
             selfSay("For I give you the acess you need to make me a favor. Go to Nico and tell him that I want the {stuffs}. He'll know what is.", cid)
             setPlayerStorageValue(cid, storage, 1)
         elseif getPlayerStorageValue(cid, storage) == 5 then
             if doPlayerRemoveItem(cid, 2796, 1) then
                 selfSay("Well, now you can pass the door.", cid)
                 doPlayerAddItem(cid, 2160, 3)
                 doPlayerAddExp(cid, 5000)
                 setPlayerStorageValue(cid, storage, 6)
             else
                 selfSay("You don't have it.", cid)
             end
			 else
				selfSay("I think you've not talk with Nico yet", cid)
         end
         talkState[talkUser] = 0
     elseif msgcontains(msg, "no") and talkState[talkUser] == 1 then
         selfSay("Ok then.", cid)
         talkState[talkUser] = 0
     elseif msgcontains(msg, "bye") then
         selfSay("Bye.", cid)
         npcHandler:releaseFocus(cid)
     end
     return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

 

NPC 2:

Spoiler

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
local storage = 135001
function creatureSayCallback(cid, type, msg)
 
        if(not npcHandler:isFocused(cid)) then
        return false
    end
    msg = msg:lower();
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
         if msg == "stuffs" then
             if getPlayerStorageValue(cid, storage) == -1 then
                 selfSay("What you mean?", cid)
             elseif getPlayerStorageValue(cid, storage) == 1 then
                 selfSay("I think you come here for Tery. Well, to do what him want I need that you go to Lian and bring me some {mix herbs}, can you do it?", cid)
                 talkState[talkUser] = 1
			elseif getPlayerStorageValue(cid, storage) == 4 then
                 selfSay("Did you bring the mix herbs?", cid)
                 talkState[talkUser] = 1	 
             elseif getPlayerStorageValue(cid, storage) == 5 then
                 selfSay("Already done.", cid)
				else
                 selfSay("Something is missing.", cid)
             end
             npcHandler:addFocus(cid)
         else
             return false
         end
 
     if msgcontains(msg, "yes") and talkState[talkUser] == 1 then
         if getPlayerStorageValue(cid, storage) == 1 then
             selfSay("So be it. Come back when you have it.", cid)
             setPlayerStorageValue(cid, storage, 2)
         elseif getPlayerStorageValue(cid, storage) == 4 then
             if doPlayerRemoveItem(cid, 2801, 1) then
                 selfSay("Here are. Tell Tery to come visit me at any time.", cid)
                 doPlayerAddItem(cid, 2796, 1)
                 setPlayerStorageValue(cid, storage, 5)
             else
                 selfSay("You don't have it.", cid)
             end
			 else
				selfSay("I think you've not talk with Lian yet", cid)
         end
         talkState[talkUser] = 0
     elseif msgcontains(msg, "no") and talkState[talkUser] == 1 then
         selfSay("Ok then.", cid)
         talkState[talkUser] = 0
     elseif msgcontains(msg, "bye") then
         selfSay("Bye.", cid)
         npcHandler:releaseFocus(cid)
     end
     return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

NPC 3:

Spoiler

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
local storage = 135001
function creatureSayCallback(cid, type, msg)
 
        if(not npcHandler:isFocused(cid)) then
        return false
    end
    msg = msg:lower();
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
         if msg == "mix herbs" then
             if getPlayerStorageValue(cid, storage) <= 1 then
                 selfSay("What do you mean by that?", cid)
             elseif getPlayerStorageValue(cid, storage) == 2 then
                 selfSay("Hm...Ok then. Back with one of each item below: blood herb, stone herb, star herb, sling herb, powder herb and shadow herb. Ok?", cid)
                 talkState[talkUser] = 1
			elseif getPlayerStorageValue(cid, storage) == 3 then
                 selfSay("You bring the herbs?", cid)
                 talkState[talkUser] = 1	 
             elseif getPlayerStorageValue(cid, storage) == 6 then
                 selfSay("I already gave it to you. Have you memory loss?", cid)
				else
                 selfSay("Something is missing.", cid)
             end
             npcHandler:addFocus(cid)
         else
             return false
         end
 
     if msgcontains(msg, "yes") and talkState[talkUser] == 1 then
         if getPlayerStorageValue(cid, storage) == 2 then
             selfSay("Ok, come back when you have it.", cid)
             setPlayerStorageValue(cid, storage, 3)
         elseif getPlayerStorageValue(cid, storage) == 3 then
             if doPlayerRemoveItem(cid, 2798, 1) and doPlayerRemoveItem(cid, 2799, 1) and doPlayerRemoveItem(cid, 2800, 1) and doPlayerRemoveItem(cid, 2802, 1) and doPlayerRemoveItem(cid, 2803, 1) and doPlayerRemoveItem(cid, 2804, 1) then
                 selfSay("So done. Here are the mix herb", cid)
                 doPlayerAddItem(cid, 2801, 1)
                 setPlayerStorageValue(cid, storage, 4)
             else
                 selfSay("You don't have it.", cid)
             end
         end
         talkState[talkUser] = 0
     elseif msgcontains(msg, "no") and talkState[talkUser] == 1 then
         selfSay("Ok then.", cid)
         talkState[talkUser] = 0
     elseif msgcontains(msg, "bye") then
         selfSay("Bye.", cid)
         npcHandler:releaseFocus(cid)
     end
     return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

Link para o post
Compartilhar em outros sites

Rapais fiz uma cambiarra louca aqui vê se funfa ai.

NPC 1:

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
local storage = 135001
function creatureSayCallback(cid, type, msg)
 
if(not npcHandler:isFocused(cid)) then
return false
end

msg = msg:lower();
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msg == "catacounbs" then
if getPlayerStorageValue(cid, storage) == -1 then
selfSay("Hello! I think you are here to get acess to the entrance of The Catacounbs, right?", cid)
talkState[talkUser] = 1
elseif getPlayerStorageValue(cid, storage) == 5 then
selfSay("Did you bring me the itens?", cid)
talkState[talkUser] = 1
elseif getPlayerStorageValue(cid, storage) == 6 then
selfSay("Thanks for the help.", cid)
else
selfSay("Something is missing.", cid)
end
npcHandler:addFocus(cid)

elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
if getPlayerStorageValue(cid, storage) == -1 then
selfSay("For I give you the acess you need to make me a favor. Go to Nico and tell him that I want the {stuffs}. He'll know what is.", cid)
setPlayerStorageValue(cid, storage, 1)
elseif getPlayerStorageValue(cid, storage) == 5 then
if doPlayerRemoveItem(cid, 2796, 1) then
selfSay("Well, now you can pass the door.", cid)
doPlayerAddItem(cid, 2160, 3)
doPlayerAddExp(cid, 5000)
setPlayerStorageValue(cid, storage, 6)
else
selfSay("You don't have it.", cid)
end
else
selfSay("I think you've not talk with Nico yet", cid)
end
talkState[talkUser] = 0

elseif msg == "no" or msg == "nao" or msg == "n" and talkState[talkUser] >= 0 then
npcHandler:say("Ok then.", cid)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
elseif msgcontains(msg, "bye") then
npcHandler:say("bye.", cid)
npcHandler:releaseFocus(cid)
end

return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

NPC 2:

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
local storage = 135001
function creatureSayCallback(cid, type, msg)
 
if(not npcHandler:isFocused(cid)) then
return false
end

msg = msg:lower();
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msg == "stuffs" then
if getPlayerStorageValue(cid, storage) == -1 then
selfSay("What you mean?", cid)
elseif getPlayerStorageValue(cid, storage) == 1 then
selfSay("I think you come here for Tery. Well, to do what him want I need that you go to Lian and bring me some {mix herbs}, can you do it?", cid)
talkState[talkUser] = 1
elseif getPlayerStorageValue(cid, storage) == 4 then
selfSay("Did you bring the mix herbs?", cid)
talkState[talkUser] = 1	 
elseif getPlayerStorageValue(cid, storage) == 5 then
selfSay("Already done.", cid)
else
selfSay("Something is missing.", cid)
end
npcHandler:addFocus(cid)
			 
elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
if getPlayerStorageValue(cid, storage) == 1 then
selfSay("So be it. Come back when you have it.", cid)
setPlayerStorageValue(cid, storage, 2)
elseif getPlayerStorageValue(cid, storage) == 4 then
if doPlayerRemoveItem(cid, 2801, 1) then
selfSay("Here are. Tell Tery to come visit me at any time.", cid)
doPlayerAddItem(cid, 2796, 1)
setPlayerStorageValue(cid, storage, 5)
else
selfSay("You don't have it.", cid)
end
else
selfSay("I think you've not talk with Lian yet", cid)
end
talkState[talkUser] = 0

elseif msg == "no" or msg == "nao" or msg == "n" and talkState[talkUser] >= 0 then
npcHandler:say("Ok then.", cid)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
elseif msgcontains(msg, "bye") then
npcHandler:say("bye.", cid)
npcHandler:releaseFocus(cid)
end

return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

NPC 3:

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
local storage = 135001
function creatureSayCallback(cid, type, msg)
 
if(not npcHandler:isFocused(cid)) then
return false
end

msg = msg:lower();
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msg == "mix herbs" then
if getPlayerStorageValue(cid, storage) <= 1 then
selfSay("What do you mean by that?", cid)
elseif getPlayerStorageValue(cid, storage) == 2 then
selfSay("Hm...Ok then. Back with one of each item below: blood herb, stone herb, star herb, sling herb, powder herb and shadow herb. Ok?", cid)
talkState[talkUser] = 1
elseif getPlayerStorageValue(cid, storage) == 3 then
selfSay("You bring the herbs?", cid)
talkState[talkUser] = 1	 
elseif getPlayerStorageValue(cid, storage) == 6 then
selfSay("I already gave it to you. Have you memory loss?", cid)
else
selfSay("Something is missing.", cid)
end
npcHandler:addFocus(cid)
			 
elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
if getPlayerStorageValue(cid, storage) == 2 then
selfSay("Ok, come back when you have it.", cid)
setPlayerStorageValue(cid, storage, 3)
elseif getPlayerStorageValue(cid, storage) == 3 then
if doPlayerRemoveItem(cid, 2798, 1) and doPlayerRemoveItem(cid, 2799, 1) and doPlayerRemoveItem(cid, 2800, 1) and doPlayerRemoveItem(cid, 2802, 1) and doPlayerRemoveItem(cid, 2803, 1) and doPlayerRemoveItem(cid, 2804, 1) then
selfSay("So done. Here are the mix herb", cid)
doPlayerAddItem(cid, 2801, 1)
setPlayerStorageValue(cid, storage, 4)
else
selfSay("You don't have it.", cid)
end
else
selfSay("I think you've not talk with Lian yet", cid)
end
talkState[talkUser] = 0

elseif msg == "no" or msg == "nao" or msg == "n" and talkState[talkUser] >= 0 then
npcHandler:say("Ok then.", cid)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
elseif msgcontains(msg, "bye") then
npcHandler:say("bye.", cid)
npcHandler:releaseFocus(cid)
end

return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Perdão mas não sei deixar as paradas ocultas.

Link para o post
Compartilhar em outros sites
Em 21/01/2018 em 17:34, Roy disse:

Rapais fiz uma cambiarra louca aqui vê se funfa ai.

 

 

Eu não testei a script pois já consegui resolver o problema, mas te reputarei mesmo assim pela iniciativa de ajuda. :)

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Conteúdo Similar

    • Por Jaurez
      .
    • Por Cat
      Em alguns casos, o tibia 8.60 comum não abre de jeito nenhum no map editor, mesmo desmarcando check file signatures e configurando o path corretamente.
       
      Este é o client 8.60 adaptado para o Remere's Map Editor. Resolvi postar já que ele foi removido do site oficial do RME. (ficou apenas a versão para linux lá)
      Se estiver tendo problemas para abrir a versão 8.60, tente utilizar este.
                                                                                                                     
      Baixar o Tibia Client 8.60 que funciona no Remere’s Map Editor
      Essa versão do Tibia 8.60 client resolve o erro unsupported client version ou Could not locate tibia.dat and/or tibia.spr, please navigate to your tibia 8.60 installation folder.
       
      Downloads
      https://tibiaking.com/applications/core/interface/file/attachment.php?id=47333

      Scan: https://www.virustotal.com/gui/file/333e172ac49ba2028db9eb5889994509e7d2de28ebccfa428c04e86defbe15cc
       
    • Por danilo belato
      Fala Galera To Com um problema aki 
       
      quero exporta umas sprites de um server para colocar em outro 
       
      eu clico na sprites ai aparece tds a forma delas do lado de la >>
       
      ai eu clico nela e ponho a opiçao de export mais quando salvo a sprite ela n abri 
       
      aparece isso quando tento vê-la 
       
      visualização não disponível ( no formatos png e bitmap)
       
      Agora no formato idc fala que o paint n pode ler 
       
      me ajudem ae...
    • Por Vitor Bicaleto
      Galera to com o script do addon doll aqui, quando eu digito apenas "!addon" ele aparece assim: Digite novamente, algo está errado!"
      quando digito por exemplo: "!addon citizen" ele não funciona e não da nenhum erro
       
      mesma coisa acontece com o mount doll.. 
    • Por Ayron5
      Substitui uma stone no serve, deu tudo certo fora  esse  erro ajudem  Valendo  Rep+  Grato  

      Erro: data/actions/scripts/boost.lua:557: table index is nil
       [Warning - Event::loadScript] Cannot load script (data/actions/scripts/boost.lua)

      Script:
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo