Ir para conteúdo

Featured Replies

Postado

Olá,

 

O erro estava nessa linha

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, "creatureSayCallback")

O callback do Jiddo NPC System deve ser chamado como função e não como string, corrija para:

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  • Respostas 22
  • Visualizações 1.3k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Pronto, já testei e está funcional.   Incrementei o diálogo do NPC também e arrumei o inglês, tive que usar uma tabela para as frases para não precisar toda hora de if e elseif para a linguagem do N

  • Tentei compreender o que tu tava tentando fazer no script e fiz esse : local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHand

  • local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:on

Postado
  • Autor

 

Olá,

 

O erro estava nessa linha

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, "creatureSayCallback")

O callback do Jiddo NPC System deve ser chamado como função e não como string, corrija para:

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

 

 

Substituir

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

 

por

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, "creatureSayCallback")

 

?

 

Pq no final do meu cod já tá como função (EU ACHO)

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

Editado por oliverarrow (veja o histórico de edições)

Postado

 

Olá,

 

O erro estava nessa linha

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, "creatureSayCallback")

O callback do Jiddo NPC System deve ser chamado como função e não como string, corrija para:

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

 

Verdade. Tinha me esquecido que minha libs é modificada.

 

 

@Topic

Tenta usar o script que eu editei logo antes do post do Garou, mas deixa como função o callback.

Postado
  • Autor

Verdade. Tinha me esquecido que minha libs é modificada.

 

 

@Topic

Tenta usar o script que eu editei logo antes do post do Garou, mas deixa como função o callback.

 

Desculpe cara, não vi tua resposta, vim direto pra segunda pagina achando que na primeira era a minha, vou testar e edito aqui!

 

O seu eu tentei assim, mas sem erros no console, mas o npc não responde qnd eu falo task

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local config = {
strg1 = 200201, -- storage começando a task
strg2 = 91001, -- storage finalizou a task (ganha qnd matar os monstros)
idiom = 8971
}
 
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)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(not npcHandler:isFocused(cid)) then
return false
end
 
if(msgcontains(msg:lower(), "task")) then
if(getPlayerStorageValue(cid, config.strg2) < 1) then
if(getPlayerStorageValue(cid, config.strg1) < 1) then
if(getPlayerStorageValue(cid, config.idiom) == 1 or getPlayerStorageValue(cid, config.idiom) == 0 ) then
selfSay("That good, one more soul coming from the {portal}! Welcome, I hope you can help.", cid)
elseif(getPlayerStorageValue(cid, config.idiom) == 2) then
selfSay("Que bom, mais uma alma vinda do {portal}! Seja bem vindo, espero que possa nos ajudar.", cid)
end
talkState[talkUser] = 1
else
if(getPlayerStorageValue(cid, config.idiom) == 1 or getPlayerStorageValue(cid, config.idiom) == 0 ) then
selfSay("you have to finish the task.", cid)
elseif(getPlayerStorageValue(cid, config.idiom) == 2) then
selfSay("Você tem que terminar a missão.", cid)
end
talkState[talkUser] = 0
end
else
if(getPlayerStorageValue(cid, config.strg2) == 1) then
if(getPlayerStorageValue(cid, config.idiom) == 1 or getPlayerStorageValue(cid, config.idiom) == 0 ) then
selfSay("You have finished the mission! Take it a Sabre, use it until you reach on level 8 and talk with Oracle in the temple.", cid)
selfSay("He will send you to Aurea, there talk with  !", cid)
elseif(getPlayerStorageValue(cid, config.idiom) == 2) then
selfSay("Você concluiu a missão! Tome aqui um Sabre, use ele ate chegar no nivel 8 e fale com o Oraculo no templo.", cid)
selfSay("Ele ira te mandar para Aurea, la fale com !", cid)
end
doPlayerAddItem(cid, 2385, 1)
else
if(getPlayerStorageValue(cid, config.idiom) == 1 or getPlayerStorageValue(cid, config.idiom) == 0 ) then
selfSay("You already finished this task.", cid)
elseif(getPlayerStorageValue(cid, config.idiom) == 2) then
selfSay("Você já terminou essa task.", cid)
end
end
talkState[talkUser] = 0
end
 
elseif(msgcontains(msg:lower(), "portal") and talkState[talkUser] == 1) then
if(getPlayerStorageValue(cid, config.idiom) == 1 or getPlayerStorageValue(cid, config.idiom) == 0 ) then
selfSay("Crystal, a angel come down here and in Aurea and opened a portal of humans who comes from another dimension for us {save}.", cid)
elseif(getPlayerStorageValue(cid, config.idiom) == 2) then
selfSay("Crystal, uma anja desceu até aqui e em Aurea e abriu um portal de humanos que vem de outra dimensão para nos {salvar}.", cid)
end
talkState[talkUser] = 2
 
elseif(msgcontains(msg:lower(), "salvar") or msgcontains(msg:lower(), "save") and talkState[talkUser] == 2) then
if(getPlayerStorageValue(cid, config.idiom) == 1 or getPlayerStorageValue(cid, config.idiom) == 0 ) then
selfSay("We are in an apocalyptic world, at war with several races. And you can be {the chosen}!", cid)
elseif(getPlayerStorageValue(cid, config.idiom) == 2) then
selfSay("Estamos em um mundo apocalíptico, em guerra com varias raças. E você pode ser o {escolhido}!", cid)
end
talkState[talkUser] = 3
 
elseif(msgcontains(msg:lower(), "escolhido") or msgcontains(msg:lower(), "the chosen") and talkState[talkUser] == 3) then
if(getPlayerStorageValue(cid, config.idiom) == 1 or getPlayerStorageValue(cid, config.idiom) == 0 ) then
selfSay("Calm down, first we need to train, you have to help us with simple things until you are trained!", cid)
selfSay("As for example our plague of {rats} in the city that are rising by storm drains!", cid)
elseif(getPlayerStorageValue(cid, config.idiom) == 2) then
selfSay("Calma, primeiro precisamos treinar, você deve nos ajudar com coisas simples, até estar bem treinado!", cid)
selfSay("Como por exemplo a nossa praga de {rats} na cidade que estão subindo pelos bueiros!", cid)
end
talkState[talkUser] = 4
 
elseif(msgcontains(msg:lower(), "rats") and talkState[talkUser] == 4) then
if(getPlayerStorageValue(cid, config.idiom) == 1 or getPlayerStorageValue(cid, config.idiom) == 0 ) then
selfSay("Okay, so help us get this over with and kill 10 rats in the storm drain in front here.", cid)
elseif(getPlayerStorageValue(cid, config.idiom) == 2) then
selfSay("Ok, então ajude-nos a acabar com isso e mate 10 ratos no bueiro aqui na frente.", cid)
end
setPlayerStorageValue(cid, strg1, 1)
talkState[talkUser] = 0
end
return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Editado por oliverarrow (veja o histórico de edições)

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo