Postado Junho 15, 2019 5 anos 2 horas atrás, Maniaco disse: 0.4 esqueci de colocar !!! é um item que o npc pede e recebe mana e vida? Editado Junho 15, 2019 5 anos por ZikaLord (veja o histórico de edições)
Postado Junho 15, 2019 5 anos Autor 1 hora atrás, ZikaLord disse: é um item que o npc pede e recebe mana e vida? sim
Postado Junho 15, 2019 5 anos 13 horas atrás, Maniaco disse: sim cara eu fiz um item storage = 211100 -- storage checada local level = 100 -- level desejado local item = 2545 -- item 1 function onUse(cid, item) -- função e parametros if getPlayerLevel(cid) < level then -- level que ira verificar doPlayerSendTextMessage(cid, "Você não tem o level 100") -- mensagem caso não tenha o level necessario elseif item == 2545 then -- verificando os item das variaveis (item e item2) doCreatureAddHealth(cid, 1000 * 1000) -- vida adicionda doCreatureAddMana(cid, 1000 * 1000) -- mana adicionada doPlayerSendTextMessage(cid, "Foi adicionado mana e vida a você") -- se não querer que essa msg apareca apague elseif storage ~= 211100 then -- checando a storage doPlayerSendTextMessage(cid, "você não completou a missão dos buffs") -- mensagem caso não tenha end -- finaliza if return true end -- finaliza function vou ver se consigo fazer o npc para você
Postado Junho 15, 2019 5 anos Autor Agora, ZikaLord disse: cara eu fiz um item storage = 211100 -- storage checada local level = 100 -- level desejado local item = 2545 -- item 1 function onUse(cid, item) -- função e parametros if getPlayerLevel(cid) < level then -- level que ira verificar doPlayerSendTextMessage(cid, "Você não tem o level 100") -- mensagem caso não tenha o level necessario elseif item == 2545 then -- verificando os item das variaveis (item e item2) doCreatureAddHealth(cid, 1000 * 1000) -- vida adicionda doCreatureAddMana(cid, 1000 * 1000) -- mana adicionada doPlayerSendTextMessage(cid, "Foi adicionado mana e vida a você") -- se não querer que essa msg apareca apague elseif storage ~= 211100 then -- checando a storage doPlayerSendTextMessage(cid, "você não completou a missão dos buffs") -- mensagem caso não tenha end -- finaliza if return true end -- finaliza function vou ver se consigo fazer o npc para você ótima ideia do item mais preciso mesmo o npc Obrigado!
Postado Junho 16, 2019 5 anos Solução @Maniaco Me desculpe se esqueci de alguma verificação hahaha. Npc.lua 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 = { -- 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 Spoiler <?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>
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.