Ir para conteúdo
  • Cadastre-se

Posts Recomendados

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)

-- 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())

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') 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

Link para o post
Compartilhar em outros sites

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())

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Conteúdo Similar

    • Por baiakuda
      Olá.
       
      Tibia versão: 8.60
      Executavel: TFS 4.0
      Script: .lua
      Dou rep+ pra quem ajudar.
       
      Gostaria que o player compra-se a promotion por 2 itens ao invés de comprar por 20k.
      ID DOS ITENS: (2157) e (2328)
      Obs: o player precisa ter 100 de cada item.
       
      Script do NPC.lua Abaixo.
       
    • Por baiakuda
      Boa noite.
       
      Estou com um erro, quando acaba a VIP o player não consegue logar.
       
      data/creaturescript/scripts/fimvip.lua:11: attempt to call field 'executeQuery' <a nil value>
       
      Obs: vendo vip pelo gesior e uso esse sistema vip\/
      http://www.tibiaking.com/forum/topic/20589-vip-system-by-mock-100/
       
      Fimvip.lua (abaixo):

      function onLogin(cid) local temple = { x = 160, y = 54, z = 7} if vip.hasVip(cid) == true then if getPlayerStorageValue(cid,55555) ~= 1 then setPlayerStorageValue(cid,55555,1) end else if getPlayerStorageValue(cid,55555) == 1 then doTeleportThing(cid, temple) doPlayerSendTextMessage(cid, 22, "Your VIP Time over!") db.executeQuery("UPDATE `accounts` SET `vip_time` = 0 WHERE `id` = ".. getAccountIdByName(getPlayerName(cid)) ..";") setPlayerPromotionLevel(cid, 1) setPlayerStorageValue(cid, 55555, 0) end end return true end
    • Por baiakuda
      Boa noite galera do TK.
       
      Estou com um erro no meu tfs (imagem abaixo) gostaria de saber o motivo desse erro e como arruma-lo.
      Obs: esse erro acontece com qualquer script que tenha a palavra "on" (exemplo: onTime, onUse, etc)
       
      ERRO.

       
      LINK DO TFS
      http://www.tibiaking.com/forum/topic/9350-86x-tfs-04-dev-rev3884/ CTFMax.lua
      --[[ Capture The Flag System Author: Fezao(FEZAO) Version: 2.0 Contact: [email protected] ]]     local CTF = CTF_LIB   local function sendEffect() if (getGlobalStorageValue(16505) > 0) then doSendAnimatedText(CTF.tppos, "CTF ON", math.random(180)) addEvent(sendEffect, 750) end end   function onTimer(interval) local time = os.date("*t")   if (isInArray(CTF.days, time.wday)) then doBroadcastMessage("[CTF] começou. Corram para o templo, em ".. CTF.timeclose .." minuto(s) não será mais possível entrar!") setGlobalStorageValue(16705, 1)   addEvent(CTF.start, CTF.timeclose * 60 * 1000)   local teelz = doCreateItem(1387, 1, CTF.tppos) doItemSetAttribute(teelz, "aid", 47521) sendEffect() end   return true end teleporteautomatico.lua
      local config = {         day = "Sunday",         pos = {x=151, y=56, z=7}, -- Posição aonde sera criado o teleport         topos = {x=284, y=516, z=5}, -- Posição pra onde o teleport ira levar o player         time = 5, -- tempo que o teleport ira sumir em minutos         msg_open = "Baiakuda Elemental Event iniciou. Corram para o templo pois o tp some daqui 5 min.", -- mensagem ao abrir o teleport         msg_close = "Baiakuda Elemental Event acabou." -- mensagem ao fechar o teleport }   local function DelTp()         local t = getTileItemById(config.pos, 1387)         if t then                 doRemoveItem(t.uid, 1)                 doSendMagicEffect(config.pos, CONST_ME_POFF)         end end   function onTimer()                 if (os.date("%A") == config.day) then                 doCreateTeleport(1387, config.topos, config.pos)                 doBroadcastMessage(config.msg_open)                 addEvent(DelTp, config.time*60*1000)                 addEvent(doBroadcastMessage, config.time*60*1000, config.msg_close)         end           return true end ontime.bmp
    • Por baiakuda
      Boa tarde,
       
       
      Gostaria de saber como faço para corrigir os erros abaixo:
      Obs: a posição onde apontam os erros de "spawn" é logo onde eu coloco o "respaw" para poder nascer os bixos.
       
      Erro que não faço ideia do que seja \/

       
      Erro dos SPAWNS \/

       
      LOCAL onde apontam os erros de SPAWN \/

       
       
    • Por baiakuda
      Boa noite.
       
      Galera notei que quando coloco meu server em PVP ENFORCED o char não pega PK (WHITE SKULL).
       
      Gostaria de saber se tem algum jeito para fazer eles pegarem PK.
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo