if(msgcontains(msg, 'help')) then
if getPlayerStorageValue(cid,8002312) == -1 then
selfSay('Você pode entregar essa carta ao Professor Oak?', cid)
setPlayerStorageValue(cid,8002312,1)
doPlayerAddItem(cid,8370,1)
elseif getPlayerStorageValue(cid,8002312) == 2 then
selfSay('Obrigado. Você foi de grande ajuda! Receba sua recompensa!!!', cid)
setPlayerStorageValue(cid,8002312,3)
doPlayerAddItem(cid,2152,5)
elseif getPlayerStorageValue(cid,8002312) == 3 then
selfSay('vá embora. Você já sua recompensa!!!', cid)
else
selfSay('Eu ja te dei a carta, aguardo resposta', cid)
end
end
- Forums
- xTibia - Notícias e Suporte
- Soluções
- Archived
- [Duvida] O Que Há De Errado?
5
720
info
Group: Herói
Joined: 20/05/10
Posts: 3.4k
Reputation: +1.5k
Gender: Masculino

13 de abril de 2012 às 09:40
13 de abril de 2012 às 10:37
tipo o erro é na hora que eu vou falar com o Professor Oak, eu o entrego a carta só que ele n me manda ir falar dnv falar com o NPC para concluir a missão. A carta fica na minha bag, ela some e mesmo assim ele diz que eu n teno ela. Script 2 o do Professor Oak.
info
Group: Herói
Joined: 20/05/10
Posts: 3.4k
Reputation: +1.5k
Gender: Masculino

13 de abril de 2012 às 10:58
agr que eu vi
try this
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
npcHandler:setMessage(MESSAGE_GREET, "Olá, sou um grande pesquisador de Pokemóns..")
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, 'help') then
if getPlayerStorageValue(cid,8002312) == 1 then
selfSay('Obrigado, amanhã entrarei em contato com ela.', cid)
talkState[talkUser] = 1
else
selfSay('Não tenho nada pra falar com você', cid)
end
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then
if doPlayerRemoveItem(cid,8370,1) then
setPlayerStorageValue(cid,8002312,2)
selfSay('Muito Obrigado', cid)
talkState[talkUser] = 1
else
selfSay('Você não tem a carta dela', cid)
end
elseif msg == "no" then
selfSay("ok então", cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


info
Group: Cavaleiro
Joined: 14/02/11
Posts: 164
Reputation: +12
Meu NPC ta dando problema, a quest é dividida em 3 partes.
1ª parte:
vou até 1 NPC e falo "hi,help,yes" ele me da uma carta e me manda ir falar com outro NPC. (essa parte funcionando perfeitamente)
2ª parte:
vou no NPC 2 e falo "hi,help,yes" ele pega a carta e me manda ir ao NPC1 (da 1ª parte) dizer que só vai amanhã.
agr que da o erro. Quando eu entrego a carta a ele e ele a pega, a carta some do meu slot, POREM ele diz que eu n estou com ela (a carta), assim não podendo completar a missão.
3ª parte:
Volto no NPC 1 digo que o NPC 2 só irá amanhã e recebo a recompensa.
--------
Script NPC 1ª parte:
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
npcHandler:setMessage(MESSAGE_GREET, "Olá Mr.Mime.")
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if getCreatureOutfit(cid).lookType ~= 597 then npcHandler:say('Você não é o Mr.Mime!', cid) return true end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'help')) then
if getPlayerStorageValue(cid,8002312) == -1 then
selfSay('Você pode entregar essa carta ao Professor Oak?', cid)
setPlayerStorageValue(cid,8002312,1)
doPlayerAddItem(cid,8370,1)
else
selfSay('Eu ja te dei a carta, aguardo resposta', cid)
end
elseif getPlayerStorageValue(cid,8002312) == 2 then
selfSay('Obrigado. Você foi de grande ajuda! Receba sua recompensa!!!', cid)
setPlayerStorageValue(cid,8002312,3)
doPlayerAddItem(cid,2152,5)
else
selfSay('Até mais!')
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Script NPC 2ª parte:
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
npcHandler:setMessage(MESSAGE_GREET, "Olá, sou um grande pesquisador de Pokemóns..")
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, 'help') then
if getPlayerStorageValue(cid,8002312) == 1 then
selfSay('Obrigado, amanhã entrarei em contato com ela.', cid)
talkState[talkUser] = 1
else
selfSay('Não tenho nada pra falar com você', cid)
end
elseif talkState[talkUser] == 1 then
if msgcontains(msg, 'yes') then
if doPlayerRemoveItem(cid,8370,1) == 1 then
setPlayerStorageValue(cid,8002312,2)
selfSay('Muito Obrigado', cid)
talkState[talkUser] = 1
else
selfSay('Você não tem a carta dela', cid)
end
else
selfSay('Então porque veio aqui ?', cid)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Edited Abril 13 by MaatheeuusYuurii