Ir para conteúdo

Posts Recomendados

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({'voltar'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Tem certeza que quer voltar para o Templo?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 1, cost = 0, destination = {x=1010, y=1025, z=7} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Quando precisar voltar ao Templo, fale comigo!'})

keywordHandler:addKeyword({'BOSS'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Tem certeza que quer enfrentar o BOSS?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 1, cost = 0, destination = {x=1052, y=1144, z=8} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Quando precisar voltar ao Templo, fale comigo!'})

keywordHandler:addKeyword({'templo'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Eu só sirvo para leva-lo ao templo..'})

-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())

 

Então, ele não reconhece, ao falar "BOSS". Ele não vai ao boss. Somente ao voltar!

Alguém pode me ajudar? Grato!

Link para o comentário
https://xtibia.com/forum/topic/143522-ajuda-o-que-h%C3%A1-de-errado-com-meu-script/
Compartilhar em outros sites

Tente assim:

 

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({'voltar'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Tem certeza que quer voltar para o Templo?'})
       travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 1, cost = 0, destination = {x=1010, y=1025, z=7} })
       travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Quando precisar voltar ao Templo, fale comigo!'})

local travelNode2 = keywordHandler:addKeyword({'BOSS'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Tem certeza que quer enfrentar o BOSS?'})
       travelNode2:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 1, cost = 0, destination = {x=1052, y=1144, z=8} })
       travelNode2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Quando precisar voltar ao Templo, fale comigo!'})

keywordHandler:addKeyword({'templo'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Eu só sirvo para leva-lo ao templo..'})

-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())

 

 

 

flw

Link para o comentário
https://xtibia.com/forum/topic/143522-ajuda-o-que-h%C3%A1-de-errado-com-meu-script/#findComment-949329
Compartilhar em outros sites

×
×
  • Criar Novo...