Postado Junho 16, 2019 5 anos Autor 2 horas atrás, JoviM disse: @Maniaco Me desculpe se esqueci de alguma verificação hahaha. Npc.lua Mostrar conteúdo oculto 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 local buff_str = 211100 -- Storage da missao dos buffs local buff = { -- Configurações [1] = { health = 100, -- Vida mana = 100, -- Mana req_lvl = 10, -- Level necessário req_item = 2160, -- Item necessário storage = 23123123 -- Storage do buff }, [2] = { health = 100, mana = 100, req_lvl = 10, req_item = 2160, storage = 123123123 }, [3] = { health = 100, mana = 100, req_lvl = 10, req_item = 2160, storage = 123123123 }, [3] = { health = 100, mana = 100, req_lvl = 10, req_item = 2160, storage = 123123123 }, [4] = { health = 100, mana = 100, req_lvl = 10, req_item = 2160, storage = 123123123 }, [5] = { health = 100, mana = 100, req_lvl = 10, req_item = 2160, storage = 123123123 }, [6] = { health = 100, mana = 100, req_lvl = 10, req_item = 2160, storage = 123123123 }, [7] = { health = 100, mana = 100, req_lvl = 10, req_item = 2160, storage = 123123123 }, [8] = { health = 100, mana = 100, req_lvl = 10, req_item = 2160, storage = 123123123 }, [9] = { health = 100, mana = 100, req_lvl = 10, req_item = 2160, storage = 123123123 }, [10] = { health = 100, mana = 100, req_lvl = 10, req_item = 2160, storage = 123123123 }, [11] = { health = 100, mana = 100, req_lvl = 10, req_item = 2160, storage = 123123123 }, [12] = { health = 100, mana = 100, req_lvl = 10, req_item = 2160, storage = 123123123 } } -- -- Não modifique NADA abaixo -- local b1 = { health = buff[1].health, mana = buff[1].mana, lvl = buff[1].req_lvl, item = buff[1].req_item, str = buff[1].storage } local b2 = { health = buff[2].health, mana = buff[2].mana, lvl = buff[2].req_lvl, item = buff[2].req_item, str = buff[2].storage } local b3 = { health = buff[3].health, mana = buff[3].mana, lvl = buff[3].req_lvl, item = buff[3].req_item, str = buff[3].storage } local b4 = { health = buff[4].health, mana = buff[4].mana, lvl = buff[4].req_lvl, item = buff[4].req_item, str = buff[4].storage } local b5 = { health = buff[5].health, mana = buff[5].mana, lvl = buff[5].req_lvl, item = buff[5].req_item, str = buff[5].storage } local b6 = { health = buff[6].health, mana = buff[6].mana, lvl = buff[6].req_lvl, item = buff[6].req_item, str = buff[6].storage } local b7 = { health = buff[7].health, mana = buff[7].mana, lvl = buff[7].req_lvl, item = buff[7].req_item, str = buff[7].storage } local b8 = { health = buff[8].health, mana = buff[8].mana, lvl = buff[8].req_lvl, item = buff[8].req_item, str = buff[8].storage } local b9 = { health = buff[9].health, mana = buff[9].mana, lvl = buff[9].req_lvl, item = buff[9].req_item, str = buff[9].storage } local b10 = { health = buff[10].health, mana = buff[10].mana, lvl = buff[10].req_lvl, item = buff[10].req_item, str = buff[10].storage } local b11 = { health = buff[11].health, mana = buff[11].mana, lvl = buff[11].req_lvl, item = buff[11].req_item, str = buff[11].storage } local b12= { health = buff[12].health, mana = buff[12].mana, lvl = buff[12].req_lvl, item = buff[12].req_item, str = buff[12].storage } if (msgcontains(msg, "buffs")) then selfSay("Muito bem, escolha um dos buffs.", cid) selfSay("{Buff um}, {buff dois},{buff tres}, {buff cinco}, {buff seis}, {buff sete}, {buff oito}, {buff nove}, {buff dez}, {buff onze}, {buff doze}.", cid) end if (msgcontains(msg, "buff um")) then if getPlayerStorageValue(cid, buff_str) >= 1 then if getPlayerStorageValue(cid, b1.str) <= 0 then if getPlayerItemCount(cid, b1.item) >= 1 then if getPlayerLevel(cid) >= b1.lvl then setCreatureMaxHealth(cid, b1.health) setCreatureMaxMana(cid, b1.mana) doPlayerRemoveItem(cid, b1.item, 1) setPlayerStorageValue(cid, b1.str, 1) selfSay("Voce recebeu o buff um.", cid) else selfSay("Voce precisa de no minimo level "..b1.lvl..".", cid) end else selfSay("Voce nao possui 1 "..getItemNameById(b1.item)..".", cid) end else selfSay("Voce ja adquiriu este buff uma vez.", cid) end else selfSay("Voce precisa completar a missao dos buffs.", cid) end elseif (msgcontains(msg, "buff dois")) then if getPlayerStorageValue(cid, buff_str) >= 1 then if getPlayerStorageValue(cid, b1.str) >= 1 then if getPlayerStorageValue(cid, b2.str) <= 0 then if getPlayerItemCount(cid, b2.item) >= 1 then if getPlayerLevel(cid) >= b2.lvl then setCreatureMaxHealth(cid, b2.health) setCreatureMaxMana(cid, b2.mana) doPlayerRemoveItem(cid, b2.item, 1) setPlayerStorageValue(cid, b2.str, 1) selfSay("Voce recebeu o buff dois.", cid) else selfSay("Voce precisa de no minimo level "..b2.lvl..".", cid) end else selfSay("Voce nao possui 1 "..getItemNameById(b2.item)..".", cid) end else selfSay("Voce ja adquiriu este buff uma vez.", cid) end else selfSay("Voce precisa adquirir o buff anterior.", cid) end else selfSay("Voce precisa completar a missao dos buffs.", cid) end elseif (msgcontains(msg, "buff tres")) then if getPlayerStorageValue(cid, buff_str) >= 1 then if getPlayerStorageValue(cid, b2.str) >= 1 then if getPlayerStorageValue(cid, b3.str) <= 0 then if getPlayerItemCount(cid, b3.item) >= 1 then if getPlayerLevel(cid) >= b3.lvl then setCreatureMaxHealth(cid, b3.health) setCreatureMaxMana(cid, b3.mana) doPlayerRemoveItem(cid, b3.item, 1) setPlayerStorageValue(cid, b3.str, 1) selfSay("Voce recebeu o buff tres.", cid) else selfSay("Voce precisa de no minimo level "..b3.lvl..".", cid) end else selfSay("Voce nao possui 1 "..getItemNameById(b3.item)..".", cid) end else selfSay("Voce ja adquiriu este buff uma vez.", cid) end else selfSay("Voce precisa adquirir o buff anterior.", cid) end else selfSay("Voce precisa completar a missao dos buffs.", cid) end elseif (msgcontains(msg, "buff quatro")) then if getPlayerStorageValue(cid, buff_str) >= 1 then if getPlayerStorageValue(cid, b3.str) >= 1 then if getPlayerStorageValue(cid, b4.str) <= 0 then if getPlayerItemCount(cid, b4.item) >= 1 then if getPlayerLevel(cid) >= b4.lvl then setCreatureMaxHealth(cid, b4.health) setCreatureMaxMana(cid, b4.mana) doPlayerRemoveItem(cid, b4.item, 1) setPlayerStorageValue(cid, b4.str, 1) selfSay("Voce recebeu o buff quatro.", cid) else selfSay("Voce precisa de no minimo level "..b4.lvl..".", cid) end else selfSay("Voce nao possui 1 "..getItemNameById(b4.item)..".", cid) end else selfSay("Voce ja adquiriu este buff uma vez.", cid) end else selfSay("Voce precisa adquirir o buff anterior.", cid) end else selfSay("Voce precisa completar a missao dos buffs.", cid) end elseif (msgcontains(msg, "buff cinco")) then if getPlayerStorageValue(cid, buff_str) >= 1 then if getPlayerStorageValue(cid, b4.str) >= 1 then if getPlayerStorageValue(cid, b5.str) <= 0 then if getPlayerItemCount(cid, b5.item) >= 1 then if getPlayerLevel(cid) >= b5.lvl then setCreatureMaxHealth(cid, b5.health) setCreatureMaxMana(cid, b5.mana) doPlayerRemoveItem(cid, b5.item, 1) setPlayerStorageValue(cid, b5.str, 1) selfSay("Voce recebeu o buff cinco.", cid) else selfSay("Voce precisa de no minimo level "..b5.lvl..".", cid) end else selfSay("Voce nao possui 1 "..getItemNameById(b5.item)..".", cid) end else selfSay("Voce ja adquiriu este buff uma vez.", cid) end else selfSay("Voce precisa adquirir o buff anterior.", cid) end else selfSay("Voce precisa completar a missao dos buffs.", cid) end elseif (msgcontains(msg, "buff seis")) then if getPlayerStorageValue(cid, buff_str) >= 1 then if getPlayerStorageValue(cid, b5.str) >= 1 then if getPlayerStorageValue(cid, b6.str) <= 0 then if getPlayerItemCount(cid, b6.item) >= 1 then if getPlayerLevel(cid) >= b6.lvl then setCreatureMaxHealth(cid, b6.health) setCreatureMaxMana(cid, b6.mana) doPlayerRemoveItem(cid, b6.item, 1) setPlayerStorageValue(cid, b6.str, 1) selfSay("Voce recebeu o buff seis.", cid) else selfSay("Voce precisa de no minimo level "..b6.lvl..".", cid) end else selfSay("Voce nao possui 1 "..getItemNameById(b6.item)..".", cid) end else selfSay("Voce ja adquiriu este buff uma vez.", cid) end else selfSay("Voce precisa adquirir o buff anterior.", cid) end else selfSay("Voce precisa completar a missao dos buffs.", cid) end elseif (msgcontains(msg, "buff sete")) then if getPlayerStorageValue(cid, buff_str) >= 1 then if getPlayerStorageValue(cid, b6.str) >= 1 then if getPlayerStorageValue(cid, b7.str) <= 0 then if getPlayerItemCount(cid, b7.item) >= 1 then if getPlayerLevel(cid) >= b7.lvl then setCreatureMaxHealth(cid, b7.health) setCreatureMaxMana(cid, b7.mana) doPlayerRemoveItem(cid, b7.item, 1) setPlayerStorageValue(cid, b7.str, 1) selfSay("Voce recebeu o buff sete.", cid) else selfSay("Voce precisa de no minimo level "..b7.lvl..".", cid) end else selfSay("Voce nao possui 1 "..getItemNameById(b7.item)..".", cid) end else selfSay("Voce ja adquiriu este buff uma vez.", cid) end else selfSay("Voce precisa adquirir o buff anterior.", cid) end else selfSay("Voce precisa completar a missao dos buffs.", cid) end elseif (msgcontains(msg, "buff oito")) then if getPlayerStorageValue(cid, buff_str) >= 1 then if getPlayerStorageValue(cid, b7.str) >= 1 then if getPlayerStorageValue(cid, b8.str) <= 0 then if getPlayerItemCount(cid, b8.item) >= 1 then if getPlayerLevel(cid) >= b8.lvl then setCreatureMaxHealth(cid, b8.health) setCreatureMaxMana(cid, b8.mana) doPlayerRemoveItem(cid, b8.item, 1) setPlayerStorageValue(cid, b8.str, 1) selfSay("Voce recebeu o buff oito.", cid) else selfSay("Voce precisa de no minimo level "..b8.lvl..".", cid) end else selfSay("Voce nao possui 1 "..getItemNameById(b8.item)..".", cid) end else selfSay("Voce ja adquiriu este buff uma vez.", cid) end else selfSay("Voce precisa adquirir o buff anterior.", cid) end else selfSay("Voce precisa completar a missao dos buffs.", cid) end elseif (msgcontains(msg, "buff nove")) then if getPlayerStorageValue(cid, buff_str) >= 1 then if getPlayerStorageValue(cid, b8.str) >= 1 then if getPlayerStorageValue(cid, b9.str) <= 0 then if getPlayerItemCount(cid, b9.item) >= 1 then if getPlayerLevel(cid) >= b9.lvl then setCreatureMaxHealth(cid, b9.health) setCreatureMaxMana(cid, b9.mana) doPlayerRemoveItem(cid, b9.item, 1) setPlayerStorageValue(cid, b9.str, 1) selfSay("Voce recebeu o buff nove.", cid) else selfSay("Voce precisa de no minimo level "..b9.lvl..".", cid) end else selfSay("Voce nao possui 1 "..getItemNameById(b9.item)..".", cid) end else selfSay("Voce ja adquiriu este buff uma vez.", cid) end else selfSay("Voce precisa adquirir o buff anterior.", cid) end else selfSay("Voce precisa completar a missao dos buffs.", cid) end elseif (msgcontains(msg, "buff dez")) then if getPlayerStorageValue(cid, buff_str) >= 1 then if getPlayerStorageValue(cid, b9.str) >= 1 then if getPlayerStorageValue(cid, b10.str) <= 0 then if getPlayerItemCount(cid, b10.item) >= 1 then if getPlayerLevel(cid) >= b10.lvl then setCreatureMaxHealth(cid, b10.health) setCreatureMaxMana(cid, b10.mana) doPlayerRemoveItem(cid, b10.item, 1) setPlayerStorageValue(cid, b10.str, 1) selfSay("Voce recebeu o buff dez.", cid) else selfSay("Voce precisa de no minimo level "..b10.lvl..".", cid) end else selfSay("Voce nao possui 1 "..getItemNameById(b10.item)..".", cid) end else selfSay("Voce ja adquiriu este buff uma vez.", cid) end else selfSay("Voce precisa adquirir o buff anterior.", cid) end else selfSay("Voce precisa completar a missao dos buffs.", cid) end elseif (msgcontains(msg, "buff onze")) then if getPlayerStorageValue(cid, buff_str) >= 1 then if getPlayerStorageValue(cid, b10.str) >= 1 then if getPlayerStorageValue(cid, b11.str) <= 0 then if getPlayerItemCount(cid, b11.item) >= 1 then if getPlayerLevel(cid) >= b11.lvl then setCreatureMaxHealth(cid, b11.health) setCreatureMaxMana(cid, b11.mana) doPlayerRemoveItem(cid, b11.item, 1) setPlayerStorageValue(cid, b11.str, 1) selfSay("Voce recebeu o buff onze.", cid) else selfSay("Voce precisa de no minimo level "..b11.lvl..".", cid) end else selfSay("Voce nao possui 1 "..getItemNameById(b11.item)..".", cid) end else selfSay("Voce ja adquiriu este buff uma vez.", cid) end else selfSay("Voce precisa adquirir o buff anterior.", cid) end else selfSay("Voce precisa completar a missao dos buffs.", cid) end elseif (msgcontains(msg, "buff doze")) then if getPlayerStorageValue(cid, buff_str) >= 1 then if getPlayerStorageValue(cid, b11.str) >= 1 then if getPlayerStorageValue(cid, b12.str) <= 0 then if getPlayerItemCount(cid, b12.item) >= 1 then if getPlayerLevel(cid) >= b12.lvl then setCreatureMaxHealth(cid, b12.health) setCreatureMaxMana(cid, b12.mana) doPlayerRemoveItem(cid, b12.item, 1) setPlayerStorageValue(cid, b12.str, 1) selfSay("Voce recebeu o buff doze.", cid) else selfSay("Voce precisa de no minimo level "..b12.lvl..".", cid) end else selfSay("Voce nao possui 1 "..getItemNameById(b12.item)..".", cid) end else selfSay("Voce ja adquiriu este buff uma vez.", cid) end else selfSay("Voce precisa adquirir o buff anterior.", cid) end else selfSay("Voce precisa completar a missao dos buffs.", cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Npc.xml Ocultar conteúdo <?xml version="1.0" encoding="UTF-8"?> <npc name="NOME DO NPC" script="SEU ARQUIVO.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="128" head="17" body="54" legs="114" feet="0" addons="2"/> <parameters> <parameter key="message_greet" value="Ola |PLAYERNAME|. Se veio ate mim deve estar atras de {buffs}, nao?"/> </parameters> </npc> Bom Primeiramente gostaria de agradecer pelo trabalho todo que você teve para fazer o script do npc! (Tá enorme) desculpa ter dado todo esse trabalho! então se n for muito difícil tem como colocar script nesse link ? https://pastebin.com/ Pois copiar diretamente do Fórum sempre vem um symbol indesejado! Obrigado mesmo vou fazer bom uso!
Postado Junho 16, 2019 5 anos @Maniaco Relaxa mano, faço isso por que gosto... Tenho até conta no pastebin mas não costumo usar AHSUAHS. Tá aqui: https://pastebin.com/RV89Jmer
Postado Junho 16, 2019 5 anos Autor 3 horas atrás, JoviM disse: @Maniaco Relaxa mano, faço isso por que gosto... Tenho até conta no pastebin mas não costumo usar AHSUAHS. Tá aqui: https://pastebin.com/RV89Jmer Perfeito Mano Funcionando certinho!!!! Muito Obrigado e desculpa pelo trabalho todo!
Postado Agosto 22, 2019 5 anos JoviM poderia deixar o script para da apenas um buff? seria de grande ajuda! Editado Agosto 22, 2019 5 anos por hiquezerah (veja o histórico de edições)
Postado Agosto 23, 2019 5 anos @hiquezerah Qualquer erro ou dúvida só marcar. Spoiler 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 local buff_str = 211100 -- Storage da missao dos buffs local buff = { health = 100, -- Vida mana = 100, -- Mana req_lvl = 10, -- Level necessário req_item = 2160, -- Item necessário storage = 23123123 -- Storage do buff } if (msgcontains(msg, "buff")) then if getPlayerStorageValue(cid, buff_str) >= 1 then if getPlayerStorageValue(cid, buff.storage) <= 0 then if getPlayerItemCount(cid, buff.req_item) >= 1 then if getPlayerLevel(cid) >= buff.req_lvl then setCreatureMaxHealth(cid, buffbuff.health) setCreatureMaxMana(cid, buffbuff.mana) doPlayerRemoveItem(cid, buffbuff.req_item, 1) setPlayerStorageValue(cid, buffbuff.storage, 1) selfSay("Voce recebeu o buff um.", cid) else selfSay("Voce precisa de no minimo level "..buff.req_lvl..".", cid) end else selfSay("Voce nao possui 1 "..getItemNameById(buff.req_item)..".", cid) end else selfSay("Voce ja adquiriu este buff uma vez.", cid) end else selfSay("Voce precisa completar a missao dos buffs.", cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
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.