Ir para conteúdo

[Resolvido] [Npc] Problemas Nos Store Values


gorno

Posts Recomendados

Eu criei esse NPC, mas ele está dand um erro, quando chega ao final da quest, ele não libera a porta, mas sim manda o player fazê-la novamente. Alguem pode me ajudar?

Ele é o npc da inquisition do meu server. Vou Transcrever as falas dele em ordempra voê etender.

Código:

 

Player: Hi
Henricus: Greetings, fellow believer |PLAYERNAME|! I'm a {Inquisitor}.
Player: Inquisitor
Henricus: The churches of the gods entrusted me with the enormous and responsible task to lead the inquisition. I leave the field work to inquisitors who I recruit from fitting people that cross my way. If you wanna {join} in the inquisition, ask me why!
Player: join
Henricus: Do you want to join the inquisition?
Player: yes
Henricus: So be it. Now you are a member of the inquisition. You might ask me for a {mission} to raise in my esteem.
Player: mission
Henricus: Your mission is simple, you must enter in the retreat and destruct the Shadow Nexus. Then report to me about your mission.
Player: mission
Henricus: Did you destructed the shadow nexus?
Player: yes
Henricus: Congratulations! Now you can get your reward in the room to the north, in addition you can use the Demonhunter Outfit.

 

Mas o problema eh que depois do ultimo yes o NPC diz: Your mission is simple,You must enter in the retreat and destruct the Shadow Nexus. Then report to me about your mission.

 

 

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


   if msgcontains(msg, 'inquisitor') then
       selfSay('The churches of the gods entrusted me with the enormous and responsible task to lead the inquisition. I leave the field work to inquisitors who I recruit from fitting people that cross my way. If you wanna {join} in the inquisition, ask me why!' ,cid)
       talkState[talkUser] = 1

   elseif talkState[talkUser] == 1 then
       if msgcontains(msg, 'join') then
       selfSay('Do you want to join the inquisition?', cid)
       talkState[talkUser] = 2
       end

   elseif msgcontains(msg, 'mission') then
       if getPlayerStorageValue(cid,20000) == 1 then
           selfSay('Your mission is simple,You must enter in the retreat and destruct the Shadow Nexus. Then report to me about your mission.', cid)
           setPlayerStorageValue(cid,20000,2)
           setPlayerStorageValue(cid,15202,1)
       elseif getPlayerStorageValue(cid,20000) == 2 then
           selfSay('Are you so crazy? You don\'t have finished this mission.', cid)
       elseif getPlayerStorageValue(cid,20000) == 3 then
           selfSay('Did you destructed the shadow nexus?', cid)
           setPlayerStorageValue(cid,20000,4)
       elseif getPlayerStorageValue(cid,20000) == 5 then
           selfSay('Sorry, no missions yet!', cid)
       end

       elseif msgcontains(msg, 'yes') then
           if talkState[talkUser] == 2 then
           selfSay('So be it. Now you are a member of the inquisition. You might ask me for a {mission} to raise in my esteem.', cid)
           setPlayerStorageValue(cid,20000,1)
       elseif getPlayerStorageValue(cid,20000) == 4 then
           selfSay('Congratulations! Now you can get your reward in the room to the north, in addition you can use the Demonhunter Outfit.', cid)
           doPlayerAddExp(cid,1500000)
                   doPlayerAddOutfitId(cid,20,0)
           setPlayerStorageValue(cid,20000,5)
           setPlayerStorageValue(cid,15203,1)
       elseif talkState[talkUser] == 5 then
           selfSay('Ok, Good Looky. Then report to me about your mission.', cid)
           setPlayerStorageValue(cid,15201,4)
       end

   end

   return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Editado por gorno
Link para o comentário
Compartilhar em outros sites

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


   if msgcontains(msg, 'inquisitor') then
       selfSay('The churches of the gods entrusted me with the enormous and responsible task to lead the inquisition. I leave the field work to inquisitors who I recruit from fitting people that cross my way. If you wanna {join} in the inquisition, ask me why!' ,cid)
       talkState[talkUser] = 1

   elseif talkState[talkUser] == 1 then
       if msgcontains(msg, 'join') then
       selfSay('Do you want to join the inquisition?', cid)
       talkState[talkUser] = 2
       end

   elseif msgcontains(msg, 'mission') then
       if getPlayerStorageValue(cid,20000) == 1 then
           selfSay('Your mission is simple,You must enter in the retreat and destruct the Shadow Nexus. Then report to me about your mission.', cid)
           setPlayerStorageValue(cid,20000,2)
           setPlayerStorageValue(cid,15202,1)
       elseif getPlayerStorageValue(cid,20000) == 2 then
           selfSay('Are you so crazy? You don\'t have finished this mission.', cid)
       elseif getPlayerStorageValue(cid,20000) == 3 then
           selfSay('Did you destructed the shadow nexus?', cid)
           talkState[talkUser] = 3
       elseif getPlayerStorageValue(cid,20000) == 4 then
           selfSay('Sorry, no missions yet!', cid)
       end

       elseif msgcontains(msg, 'yes') then
           if talkState[talkUser] == 2 then
           selfSay('So be it. Now you are a member of the inquisition. You might ask me for a {mission} to raise in my esteem.', cid)
           setPlayerStorageValue(cid,20000,1)
       elseif msgcontains(msg, 'yes') and talkState[talkUser] = 3 then
           selfSay('Congratulations! Now you can get your reward in the room to the north, in addition you can use the Demonhunter Outfit.', cid)
           doPlayerAddExp(cid,1500000)
           doPlayerAddOutfitId(cid,20,0)
           setPlayerStorageValue(cid,20000,4)
           setPlayerStorageValue(cid,15203,1)
       elseif talkState[talkUser] == 5 then
           selfSay('Ok, Good Looky. Then report to me about your mission.', cid)
           setPlayerStorageValue(cid,15201,4)
       end

   end

   return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Editado por Oneshot
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...