Postado Agosto 27, 2013 11 anos Blz galera to aqui com um problema e preciso da ajuda de vcs... eu mesmo editei o nome de alguns itens, to dizendo isso para vcs não se confundirem. é um npc de missão, nem vo explicar pq o arquivo ja mostra o que eu quero... NPC1 STORAGE = 100010 -- Não Mecha ITEM = 5956 -- Item a ser adicionado para completar a quest QUANT = 1 -- Quantidade de items a ser adicionado local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) 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 santaNPC(cid, message, keywords, parameters, node) if(not npcHandler:isFocused(cid)) then return false end if (parameters.present == true) then if (getPlayerStorageValue(cid, STORAGE) < 1) then doPlayerAddItem(cid, ITEM, QUANT) setPlayerStorageValue(cid, STORAGE, 1) npcHandler:say('Vlw camarada e boa sorte!!!', cid) else npcHandler:say('voce ja pegou sua missao.', cid) end end npcHandler:resetNpc() return true end npcHandler:setMessage(MESSAGE_GREET, "Iae |PLAYERNAME|. Voce poderia me {ajudar} com uma coisa?") local noNode = KeywordNode:new({'nao'}, santaNPC, {present = false}) local yesNode = KeywordNode:new({'sim'}, santaNPC, {present = true}) local node = keywordHandler:addKeyword({'ajudar'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Voce so tem que entregar este ARQUIVO para meu amigo que esta perto do templo. Aceita?'}) node:addChildKeywordNode(yesNode) node:addChildKeywordNode(noNode) npcHandler:addModule(FocusModule:new()) NPC2 STORAGE = 100010 -- Não Mecha ITEM = 5956 -- Item a ser Removido , dado pelo primeiro NPC QUANT = 0 -- Quantidade de item a ser removido dado pelo primeiro npc PREMIO = 9808 -- Premio do NPC PQUANT = 1 -- Quantidade de premio local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) 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 santaNPC(cid, message, keywords, parameters, node) if(not npcHandler:isFocused(cid)) then return false end if (parameters.present == true) then if getPlayerStorageValue(cid,STORAGE) == 1 and getPlayerItemCount(cid,2330) >= 1 then doPlayerRemoveItem(cid,ITEM,QUANT) doPlayerAddItem(cid,PREMIO,PQUANT) setPlayerStorageValue(cid, STORAGE, 2) npcHandler:say('Vlw camarada!!!', cid) elseif getPlayerStorageValue(cid,STORAGE) >= 2 then npcHandler:say('voce ja terminou esta missao.', cid) elseif getPlayerStorageValue(cid,STORAGE) < 1 then npcHandler:say('Voce nem falou com o noob ¬¬.', cid) elseif getPlayerItemCount(cid,2330) <= 0 then npcHandler:say('Voce nao tem nenhum arquivo...', cid) end end npcHandler:resetNpc() return true end npcHandler:setMessage(MESSAGE_GREET, "Iae |PLAYERNAME|.fale {arquivo} se voce esta aqui pela missao! ") local noNode = KeywordNode:new({'nao'}, santaNPC, {present = false}) local yesNode = KeywordNode:new({'sim'}, santaNPC, {present = true}) local node = keywordHandler:addKeyword({'arquivo'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Noob que te mandou aqui?'}) node:addChildKeywordNode(yesNode) node:addChildKeywordNode(noNode) npcHandler:addModule(FocusModule:new()) o erro é esse: pego o item com o npc1 e levo ate o npc2 e ele pergunta se foi npc1 que me mandou, la eu digo que sim e ele fala que eu não tenho o item, mais o item ja ta na minha bolsa. pfv me ajudem queria muito essa missão no meu ot!!!
Postado Agosto 27, 2013 11 anos O tópico foi movido para a área correta, preste mais atenção da próxima vez! Leia as regras do fórum: http://tibiaking.com/forum/topic/1281-regras-gerais/?p=7680 Este tópico foi movido: De: "OTServ → Scripting → Monsters e NPCs" Para: "OTServ → Suporte OTServ"
Postado Agosto 29, 2013 11 anos Olá amigo, tente isso. NPC 1: --------------------------------- ------- NPC Missão 1 --------- --------------------------------- -------------- --- Config --- -------------- -- item necessário para fazer a busca local i_required = 5956 -- contagem de item necessário para fazer a busca local i_required_count = 1 -- recompensa padrão id item local i_reward = 5956 -- contagem de recompensa id padrão local i_reward_count = 1 -- -- local storage = 100010 -- -- local questname = "ESCOLHA O NOME" -- NPC Messages -- local npc_message ={ "I need some item to complete this mission, procced?", "You dont have any items to this mission.", "Thank You for Help me, {take it.}", "You have Already done this {mission}.", "The Mission {"..questname.."} is, really serius, i need your help to complete it, if you help me i can give some items to you?" } ------------------- --- End Confing --- ------------------- 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 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, 'mission')) then selfSay(npc_message[5], cid) end if(msgcontains(msg, questname)) then selfSay(npc_message[1], cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if (getPlayerStorageValue(cid,storage) > 0) then selfSay(npc_message[4], cid) else if(doPlayerRemoveItem(cid,i_required,i_required_count)) then setPlayerStorageValue(cid,storage,1) doPlayerAddItem(cid,i_reward,i_reward_count) selfSay(npc_message[3], cid) doSendMagicEffect(getCreaturePosition(cid), 10) doCreatureSay(cid, "Quest Completada!", TALKTYPE_ORANGE_1) else selfSay(npc_message[2], cid) end end return true end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) NPC 2: --------------------------------- ------- NPC Missão 2 --------- --------------------------------- -------------- --- Config --- -------------- -- item necessário para fazer a busca local i_required = 5956 -- contagem de item necessário para fazer a busca local i_required_count = 1 -- recompensa padrão id item local i_reward = 9808 -- contagem de recompensa id padrão local i_reward_count = 1 -- -- local storage = 100010 -- -- local questname = "ESCOLHA O NOME" -- NPC Messages -- local npc_message ={ "I need some item to complete this mission, procced?", "You dont have any items to this mission.", "Thank You for Help me, {take it.}", "You have Already done this {mission}.", "The Mission {"..questname.."} is, really serius, i need your help to complete it, if you help me i can give some items to you?" } ------------------- --- End Confing --- ------------------- 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 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, 'mission')) then selfSay(npc_message[5], cid) end if(msgcontains(msg, questname)) then selfSay(npc_message[1], cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if (getPlayerStorageValue(cid,storage) > 0) then selfSay(npc_message[4], cid) else if(doPlayerRemoveItem(cid,i_required,i_required_count)) then setPlayerStorageValue(cid,storage,1) doPlayerAddItem(cid,i_reward,i_reward_count) selfSay(npc_message[3], cid) doSendMagicEffect(getCreaturePosition(cid), 10) doCreatureSay(cid, "Quest Completada!", TALKTYPE_ORANGE_1) else selfSay(npc_message[2], cid) end end return true end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Faça as modificações que achar necessário. Atenciosamente, Stigal.
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.