Postado Junho 27, 2018 7 anos Olá, eu tenho aqui um npc e preciso que ele cheque X storage da pessoa para libera-la para fazer suas missões (é um nto então a pessoa precisa da storage de genin para poder falar com o npc) STORAGE QUE O NPC PRECISA CHECAR: (só terá a storage quem tiver feito a missão Genin, fazendo a missão você ganha o storage.. ganhando o storage ganha o direito de falar com o npc para fazer suas missões) Spoiler 89745 NPC: Spoiler <?xml version="1.0" encoding="UTF-8"?> <npc name="Kakashi Sensei" script="data/npc/scripts/npcquest/kakashisensei.lua" walkinterval="2000" speed="0" floorchange="0"> <health now="100" max="100"/> <look type="744" head="19" body="113" legs="95" feet="115" addons="0"/> <parameters> <parameter key="message_greet" value="Ola shinobi, por favor, tenho {missoes} rank a para voce fazer." /> <parameter key="message_farewell" value="Ola shinobi, voce pode upar na cave abaixo, boa sorte." /> </parameters> </npc> SCRIPT DO NPC: 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 if(msgcontains(msg, 'missoes')) then selfSay('Ok, Para começar vamos fazer a {primeira missao}?', cid) end --------------------------------------------------------- if(msgcontains(msg, 'primeira missao')) then selfSay('Va até o local 06 do MAPA, mate uns nekenins e me traga 10 Nukenin {talisma}', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'talisma') and talkState[talkUser] == 1) then if (getPlayerStorageValue(cid,111) > 0) then selfSay('Voce ja terminou essa missao.', cid) else if(doPlayerRemoveItem(cid, 10551, 10) == TRUE) then setPlayerStorageValue(cid,111,1) doPlayerAddExperience(cid,1000) doPlayerAddItem(cid,10136,1) selfSay('Obrigado! Se quiser ja podes fazer a {segunda missao}.. (ganhou um livro do kakashi de presete e ganhou 1000 de exp por ler)', cid) else selfSay('Voce não tens os 10 nukenins talisma ainda..', cid) end end return true end --------------------------------------------------------- if(msgcontains(msg, 'segunda missao')) then selfSay('Va ate a Florest Renegade, quero que me tragas 25 renegade {essence}', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'essence') and talkState[talkUser] == 1) then if (getPlayerStorageValue(cid,112) > 0) then selfSay('Voce ja acabou essa missao.', cid) else if(doPlayerRemoveItem(cid, 6500, 25) == TRUE) then setPlayerStorageValue(cid,112,1) doPlayerAddExperience(cid,1000) doPlayerAddItem(cid,10136,1) selfSay('Obrigado! Se quiser ja podes fazer a {terceira missao}.. (ganhou um livro do kakashi de presete e ganhou 1000 de exp por ler)', cid) else selfSay('Voce não tens os 25 renegade essence ainda', cid) end end return true end --------------------------------------------------------- if(msgcontains(msg, 'terceira missao')) then selfSay('Va ate o Local 05 do mapa que fica na Floresta Renegade, Tens um Shinobi de graduação Jounin la que roubou 1 saco de {dinheiro} de um aldeão, pegue e traga para mim.', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'dinheiro') and talkState[talkUser] == 1) then if (getPlayerStorageValue(cid,13608) > 0) then selfSay('Você ja terminou essa missão e ainda não tenho uma quarta missão para lhe dar.', cid) else if(doPlayerRemoveItem(cid, 2690, 1) == TRUE) then setPlayerStorageValue(cid,13608,1) doPlayerAddExperience(cid,1000) doPlayerAddItem(cid,10136,1) selfSay('Obrigado! Voce ja terminou 3 missões minhas, ja é digno de fazer o exame Jounin. (ganhou um livro do kakashi de presete e ganhou 1000 de exp por ler)', cid) else selfSay('Voce não pegou o Saco de Dinheiro ainda', cid) end end return true end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Junho 27, 2018 7 anos por King Laker (veja o histórico de edições) Olá, que tal dar uma olhada no meu projeto? https://discord.gg/bsNkbsyJ3W
Postado Junho 27, 2018 7 anos Autor @Vodkart Olá, que tal dar uma olhada no meu projeto? https://discord.gg/bsNkbsyJ3W
Postado Junho 28, 2018 7 anos Solução n testei 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,msg = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid, msg:lower() local storage1,storage2 = 15754,89745 local tabble = { ["primeira"] = {10551,10,0, "Va até o local 06 do MAPA, mate uns nekenins e me traga 10 Nukenin talisma!"}, ["segunda"] = {6500,25,1,"Va ate a Florest Renegade, quero que me tragas 25 renegade essence!"}, ["terceira"] = {2690,1,2,"Va ate o Local 05 do mapa que fica na Floresta Renegade, Tens um Shinobi de graduação Jounin la que roubou 1 saco de dinheiro de um aldeão, pegue e traga para mim"} } if isInArray({'missao','mission', 'missoes', 'tarefa', 'missions'}, msg) then if getPlayerStorageValue(cid,storage2) <= 0 then npcHandler:say("voce nao eh um gennin entao nao pode fazer missao aqui!", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) return true end npcHandler:say("qual missão deseja fazer agora, lembre-se de terminar uma para começar a outra, eu tenho disponivel {primeira}, {segunda} ou {terceira} missao!", cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if tabble[msg] then local t = tabble[msg] local var = getPlayerStorageValue(cid,storage1) <= 0 and 0 or getPlayerStorageValue(cid,storage1) if var ~= t[3] then npcHandler:say('Voce ainda nao pode fazer ou ja terminou essa missao.', cid) return true elseif not doPlayerRemoveItem(cid, t[1], t[2]) then npcHandler:say(t[4], cid) return true end doPlayerAddExperience(cid,1000) doPlayerAddItem(cid,10136,1) setPlayerStorageValue(cid,storage1,var+1) npcHandler:say(getPlayerStorageValue(cid,storage1) > 2 and "Obrigado! Voce ja terminou 3 missões minhas, ja é digno de fazer o exame Jounin." or "Obrigado! ganhou um livro do kakashi de presete e ganhou 1000 de exp por ler!! agora ja podes fazer outra missao!", cid) return true end elseif msg == "no" then selfSay("Then not", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) ----------------------- editado arrumei uma coisa agora [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Postado Junho 28, 2018 7 anos Autor @Vodkart Tenho outro npc como faço para ele checar a storage que ganha quando faz a akatsuki? --> 89785 <-- STORAGE (se possivel com uma mensagem "voce ainda nao fez a saga Akatsuki.") Script: Spoiler local tab = { pos = {x = 2145, y = 1454, z = 7}, -- posição x, y, z do local a teleportar o player item = {11462,1}, -- {itemID, count} price = 500 } 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, 'quest kage')) then talkState[talkUser] = 1 selfSay('tem certeza que quer entrar?', cid) selfSay('Lembre-se.. voce precisa de '..tab.item[2]..' '..getItemNameById(tab.item[1])..' e '..tab.price..' gold bar e level {600} para poder receber o premio, para entrar diga {yes}.', cid) elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 10000)) then doTeleportThing(cid, tab.pos) doPlayerRemoveItem(cid, tab.item[1], tab.item[2]) doPlayerRemoveMoney(cid, tab.price * 10000) doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT) selfSay('Boa Sorte!.', cid) else talkState[talkUser] = 0 selfSay('Voce ainda nao tem o Pergaminho Kage ou 500 gold bar, volte quando tiver.', cid) end elseif (msgcontains(msg, 'no') and talkState[talkUser] == 1) then talkState[talkUser] = 0 selfSay('Okay, maybe another time.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Junho 28, 2018 7 anos por King Laker (veja o histórico de edições) Olá, que tal dar uma olhada no meu projeto? https://discord.gg/bsNkbsyJ3W
Postado Junho 28, 2018 7 anos @King Laker Spoiler local tab = { pos = {x = 2145, y = 1454, z = 7}, -- posição x, y, z do local a teleportar o player item = {11462,1}, -- {itemID, count} price = 500 } 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 sto_saga_akatsuki = 0000 -- Storage da saga akatsuki. local value_sto_saga = 1 -- Valor referente a saga da akatsuki. Talvez você use a mesma storage para ranks, gennin, chunnin e etc... então coloque o valor que ganha quando vira akatsuki. 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, 'quest kage')) then if getPlayerStorageValue(cid, sto_saga_akatsuki) >= value_sto_saga then talkState[talkUser] = 1 selfSay('tem certeza que quer entrar?', cid) selfSay('Lembre-se.. voce precisa de '..tab.item[2]..' '..getItemNameById(tab.item[1])..' e '..tab.price..' gold bar e level {600} para poder receber o premio, para entrar diga {yes}.', cid) else selfSay('Você ainda não fez a saga da akatsuki.', cid) talkState[talkUser] = 0 end elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 10000)) then doTeleportThing(cid, tab.pos) doPlayerRemoveItem(cid, tab.item[1], tab.item[2]) doPlayerRemoveMoney(cid, tab.price * 10000) doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT) selfSay('Boa Sorte!.', cid) else talkState[talkUser] = 0 selfSay('Voce ainda nao tem o Pergaminho Kage ou 500 gold bar, volte quando tiver.', cid) end elseif (msgcontains(msg, 'no') and talkState[talkUser] == 1) then talkState[talkUser] = 0 selfSay('Okay, maybe another time.', 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.