DI

[Encerrado] [Duvida] NPC - Catcher by Slicer? ;o

Por didogunner, 04 de fev. de 2013 em Tópicos Sem Resposta

[duvida] npc - catcher
11
863
didogunnerD
04 de fevereiro de 2013 às 06:33

Bom o NpC é perfeito! ou quase o.O

 

só tem um probleminha...

 

Ele te da a "missão" quando vc completa o catch e vai falar com ele, ele não responde nada o.O

 

você tem que falar yes ele responde "You haven't caught 100 pokemons yet, come back when you do that..."

 

Gostaria que ele falasse algo como "você terminou a sua missão?" você fala-se yes

 

Ai sim ele entrega-se o premio ou fala-se "You haven't caught 100 pokemons yet, come back when you do that..."

 

;X

 

Catcher.lua

 

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local talkState = {}

 

function doBuyPokemonWithCasinoCoins(cid, poke) npcHandler:onSellpokemon(cid) end

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

 

local stoQuest = 9873242 --storage para n pegar o premio 2x

local stoOut = 181644 --storage da roupa

 

if (msgcontains(msg, 'mission') or msgcontains(msg, 'help')) and (not talkState[talkUser] or talkState[talkUser] == 0) then

if getPlayerStorageValue(cid, stoQuest) >= 1 then

selfSay("You already did this quest!", cid)

talkState[talkUser] = 0

return true

end

selfSay("You need catch atleast 100 pokemons to win the reward, can you do it?", cid)

talkState[talkUser] = 1

elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and talkState[talkUser] == 1 then

if getPlayerStorageValue(cid, stoQuest) >= 1 then

selfSay("You already did this quest!", cid)

talkState[talkUser] = 0

return true

end

local list = getCatchList(cid)

if #list >= 2 then

selfSay("Thank you very much, take you reward...", cid)

setPlayerStorageValue(cid, stoOut, 1)

setPlayerStorageValue(cid, stoQuest, 1)

 

doPlayerAddItem(cid, 11638, 1) --box 4

talkState[talkUser] = 0

return true

else

selfSay("You haven't caught 100 pokemons yet, come back when you do that...", cid)

talkState[cid] = 0

return true

end

elseif (msgcontains(msg, 'no') or msgcontains(msg, 'nao')) then

selfSay("So good bye...", cid)

talkState[cid] = 0

return true

end

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

Editado Fevereiro 4 por DidoGunner

SlicerS
04 de fevereiro de 2013 às 10:37

ta ligado q aki deveriia tar 100 neh?

if #list >= 2 then

didogunnerD
04 de fevereiro de 2013 às 13:13

sim o.O" eu não ia por 100 catch pra testar ;o AHUHUEhuehe

 

mas o problema é esse? ;X

 

não esta faltando função pra ele responder na volta? ;o

StyloMaldosoS
04 de fevereiro de 2013 às 13:18

assim ? ;/

 

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

function doBuyPokemonWithCasinoCoins(cid, poke) npcHandler:onSellpokemon(cid) end
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

local stoQuest = 9873242 --storage para n pegar o premio 2x
local stoOut = 181644 --storage da roupa

if (msgcontains(msg, 'mission') or msgcontains(msg, 'help')) and (not talkState[talkUser] or talkState[talkUser] == 0) then
if getPlayerStorageValue(cid, stoQuest) >= 1 then
selfSay("You already did this quest!", cid)
talkState[talkUser] = 1
return true
end
selfSay("You need catch atleast 100 pokemons to win the reward, can you do it?", cid)
talkState[talkUser] = 1
elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and talkState[talkUser] == 1 then
if getPlayerStorageValue(cid, stoQuest) >= 1 then
selfSay("You already did this quest!", cid)
talkState[talkUser] = 0
return true
end
local list = getCatchList(cid)
if #list >= 2 then
selfSay("Thank you very much, take you reward...", cid)
setPlayerStorageValue(cid, stoOut, 1)
setPlayerStorageValue(cid, stoQuest, 1)

doPlayerAddItem(cid, 11638, 1) --box 4
talkState[talkUser] = 0
return true
else
selfSay("You haven't caught 100 pokemons yet, come back when you do that...", cid)
talkState[cid] = 0
return true
end
elseif (msgcontains(msg, 'no') or msgcontains(msg, 'nao')) then
selfSay("So good bye...", cid)
talkState[cid] = 0
return true
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

eu acho q o talkUser tava errado e não tava ligando com a outra fala do player.. testa ai ;/

didogunnerD
04 de fevereiro de 2013 às 13:29

Não foi ;/

 

Xenty não ta faltando voltar pro (msgcontains(msg, 'misson') pro player poder falar? Player: Mission e ele responder "não você não acabou" e se ele acabou Player: Mission " Sim muito bem ai esta seu premio".

 

Conversa - ele faz isso com YES ;X

 

 

13:29 Catcher: Welcome Ghost, what you want?

13:30 Ghost [20]: yes

13:30 Catcher: You haven't caught 100 pokemons yet, come back when you do that...

 

Editado Fevereiro 4 por DidoGunner

StyloMaldosoS
04 de fevereiro de 2013 às 13:45

você catou 100 pokemons ? o.O

ele ta dizendo que voce n tem os 100 pokemons catados

didogunnerD
04 de fevereiro de 2013 às 13:58

não né man o.O" eu coloquei na conf

 

if #list >= 2 then

;O somente 2 catchs... mas é ai que ta o que eu falei o.O

ele fala que eu n catei eu falando hi, yes

a logica certa seria pro hi, mission ( ai ele falar se eu terminei ou não )

SlicerS
04 de fevereiro de 2013 às 15:10

tente assim...

 

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

function doBuyPokemonWithCasinoCoins(cid, poke) npcHandler:onSellpokemon(cid) end
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

local stoQuest = 9873242 --storage para n pegar o premio 2x
local stoOut = 181644 --storage da roupa

if (msgcontains(msg, 'mission') or msgcontains(msg, 'help')) and (not talkState[talkUser] or talkState[talkUser] == 0) then
  if getPlayerStorageValue(cid, stoQuest) >= 1 then
  selfSay("You already did this quest!", cid)
  talkState[talkUser] = 0
  return true
  end
  selfSay("You need catch atleast 100 pokemons to win the reward, can you do it?", cid)
  talkState[talkUser] = 1
elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and talkState[talkUser] == 1 then
  if getPlayerStorageValue(cid, stoQuest) >= 1 then
  selfSay("You already did this quest!", cid)
  talkState[talkUser] = 0
  return true
  end
  local list = getCatchList(cid)
  if #list >= 2 then
  selfSay("Thank you very much, take you reward...", cid)
  setPlayerStorageValue(cid, stoOut, 1)
  setPlayerStorageValue(cid, stoQuest, 1)

  doPlayerAddItem(cid, 11638, 1) --box 4
  talkState[talkUser] = 0
  return true
  else
  selfSay("You haven't caught 100 pokemons yet, come back when you do that...", cid)
  talkState[talkUser] = 0
  return true
  end
elseif (msgcontains(msg, 'no') or msgcontains(msg, 'nao')) then
  selfSay("So good bye...", cid)
  talkState[talkUser] = 0
  return true
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

mas nem era pra tu poder flar 'yes' direto o.O

didogunnerD
04 de fevereiro de 2013 às 15:29

UHAHUahuau né

 

bom perfeito! como to devendo um rep+ pro stylo a próxima pra variar é sua huauhhuaa

 

vlw duvida sanada! ;X

SlicerS
04 de fevereiro de 2013 às 16:15

sanado, movido

5 anos depois...
StigalS
20 de abril de 2018 às 00:52
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.