Ja tentou tirar esse codigos ?
3
1k
info
Grupo: Artesão
Registrado: 18/12/12
Posts: 112
Reputação: +13

26 de dezembro de 2012 às 18:57
26 de dezembro de 2012 às 19:41
não sei o que eu fiz mas acho que arrumei, agora ta com outro problema, depois de falar ajudar o player recebe a quest só que quando ele vai entregar os itens ele recebe a quest novamente, mesmo tendo o storage pra ir pra proxima parte da quest
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
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
shopModule:addBuyableItem({'lemonade', 'lemondrink', 'limonada'}, 2006, 2, 5, 'lemonade')
shopModule:addBuyableItem({'beer', 'cerveja'}, 2006, 3, 3, 'beer')
shopModule:addBuyableItem({'milk', 'leite'}, 2006, 2, 6, 'milk')
shopModule:addBuyableItem({'rum'}, 2006, 3, 27, 'rum')
shopModule:addBuyableItem({'bread'}, 2689, 3)
shopModule:addBuyableItem({'ham'}, 2671, 5)
shopModule:addBuyableItem({'meat'}, 2666, 5)
shopModule:addBuyableItem({'grapes'}, 2681, 3)
shopModule:addBuyableItem({'red apple'}, 2674, 3)
npcHandler:addModule(FocusModule:new())
local boromir = 6000
local boromir2 = 6001
local boromir3 = 61254
text = "5 Meat 5 Bread 10 Blueberries" -- Texto do papel
lid = 1954 -- ID do Papel
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, 'ajudar')) and (getPlayerStorageValue(cid, 61254) == 1) then
selfSay('Você pode conseguir um pouco de comida para mim? Estou muito ocupado e não tenho tempo para ir procurar.',cid)
talkState[talkUser] = 0
elseif (msgcontains(msg, 'yes')) or (msgcontains(msg, 'sim')) and (getPlayerStorageValue(cid, 61254) == 1) then
setPlayerStorageValue(cid, boromir, 1)
setPlayerStorageValue(cid, boromir3, 2)
setPlayerStorageValue(cid, boromir2, 1)
letter = doPlayerAddItem(cid, lid)
doSetItemText(letter, text)
doPlayerPopupFYI(cid, "Nova quest iniciada! Quest Log atualizado: Ajudando Zio")
selfSay('Tudo que preciso está escrito neste papel.', cid)
talkState[talkUser] = 0
elseif (msgcontains(msg, 'ajudar')) and (getPlayerStorageValue(cid, 61254) == 2) then
selfSay('Você conseguiu todos os itens da lista?', cid)
talkState[talkUser] = 0
elseif (msgcontains(msg, 'yes')) or (msgcontains(msg, 'sim')) and (getPlayerStorageValue(cid, 61254) == 2) and getPlayerItemCount(cid,2666)>=5 and getPlayerItemCount(cid,2689)>=5 and getPlayerItemCount(cid,2677)>=10 then
selfSay('Muito obrigado, aqui está sua recompensa.', cid)
doPlayerRemoveItem(cid,2666,5)
doPlayerRemoveItem(cid,2689,5)
doPlayerRemoveItem(cid,2677,10)
doPlayerAddItem(cid,2148,10)
setPlayerStorageValue(cid, boromir2, 2)
setPlayerStorageValue(cid, boromir3, -1)
talkState[talkUser] = 0
else
selfSay('fgbht.', cid)
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


info
Grupo: Artesão
Registrado: 08/10/12
Posts: 114
Reputação: 0
quando falo com o npc e digo ajudar, ele não responde, mas abre o shop
to fazendo um npc que vende itens e que da quest, alguém pode ajudar?
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler)[/size][/font][/color] [color=#5A5A5A][font=tahoma, helvetica, arial, sans-serif][size=3]-- 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 local shopModule = ShopModule:new() npcHandler:addModule(shopModule) shopModule:addBuyableItem({'lemonade', 'lemondrink', 'limonada'}, 2006, 2, 5, 'lemonade') shopModule:addBuyableItem({'beer', 'cerveja'}, 2006, 3, 3, 'beer') shopModule:addBuyableItem({'milk', 'leite'}, 2006, 2, 6, 'milk') shopModule:addBuyableItem({'rum'}, 2006, 3, 27, 'rum') shopModule:addBuyableItem({'bread'}, 2689, 3) shopModule:addBuyableItem({'ham'}, 2671, 5) shopModule:addBuyableItem({'meat'}, 2666, 5) shopModule:addBuyableItem({'grapes'}, 2681, 3) shopModule:addBuyableItem({'red apple'}, 2674, 3) npcHandler:addModule(FocusModule:new()) [/size][/font][/color] [color=#5A5A5A][font=tahoma, helvetica, arial, sans-serif][size=3]local boromir = 6000 local boromir2 = 6001 local boromir3 = 61254 text = "5 Meat 5 Bread 10 Blueberries" -- Texto do papel lid = 1954 -- ID do Papel function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end[/size][/font][/color] [color=#5A5A5A][font=tahoma, helvetica, arial, sans-serif][size=3]local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if(msgcontains(msg, 'ajudar') and (getPlayerStorageValue(cid, 61254) == 1) then selfSay('Você pode conseguir um pouco de comida para mim? Estou muito ocupado e não tenho tempo para ir procurar.',cid) talkState[talkUser] = 0 elseif msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then setPlayerStorageValue(cid, boromir, 1) setPlayerStorageValue(cid, boromir3, 2) setPlayerStorageValue(cid, boromir2, 1) letter = doPlayerAddItem(cid, lid) doSetItemText(letter, text) doPlayerPopupFYI(cid, "Nova quest iniciada! Quest Log atualizado: Ajudando Zio") selfSay('Tudo que preciso está escrito neste papel.', cid) talkState[talkUser] = 0 elseif msgcontains(msg, 'ajudar') and (getPlayerStorageValue(cid, 61254) == 2) then selfSay('Você conseguiu todos os itens da lista?', cid) talkState[talkUser] = 0 elseif msgcontains(msg, 'yes') or msgcontains(msg, 'sim') and (getPlayerStorageValue(cid, 61254) == 2) and getPlayerItemCount(cid,2666)>=5 and getPlayerItemCount(cid,2689)>=5 and getPlayerItemCount(cid,2677)>=10 then npcHandler:say("Muito obrigado, aqui está sua recompensa.", cid) doPlayerRemoveItem(cid,2666,5) doPlayerRemoveItem(cid,2689,5) doPlayerRemoveItem(cid,2677,10) doPlayerAddItem(cid,2148,10) setPlayerStorageValue(cid, boromir2, 2) setPlayerStorageValue(cid, boromir3, -1) talkState[talkUser] = 0 end return TRUE end