Ir para conteúdo

Featured Replies

Postado
  • Administrador

Galera tenho esse scripts de task,e ele funciona como default se eu adiciona novos monstros ele para de funcionar simplesmente quando eu peço a task ele não conta os monstros que estou matando,no caso eu queria que a recompensa fossem 3 items diferentes.

Scripts:

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 tasks = {
["blastoise"] = {["Dailly"] = {{"Blastoise", 300}}},
["electabuzz"] = {["Daily"] = {{"Electabuzz", 300}}},
["venusaur"] = {["Dailly"] = {{"Venusaur", 300}}},
["charizard"] = {["Dailly"] = {{"Charizard", 300}}},
}
local msg = msg:lower() --eh sempre bom por isso.. pra deixar a msg soh em letras minusculas


if msgcontains(msg, "task") then
   if isMyTaskComplete(cid, getNpcCid()) then
          selfSay("Wow you have already complete my task! Ok then, take your reward!", cid)
          doPlayerAddExperience(cid, 1500000) --premio
          doPlayerAddItem(cid, 2160, 25)

          local sto = getMyTaskSto(cid, getNpcCid())
          setPlayerStorageValue(cid, sto, -1) --nunca esqueça disso...
          setPlayerStorageValue(cid, 25566, os.time() + 24*60*60)
              setPlayerStorageValue(cid, 181601, 1) --storage da outfit
              setPlayerStorageValue(cid, 181602, 1) --storage da outfit
          talkState[talkUser] = 0
          return true
   elseif getPlayerStorageValue(cid, 25566) > os.time() then
          selfSay("You have to wait 24h to do my task again!", cid)
          talkState[talkUser] = 0
          return true
   elseif getMyTaskSto(cid, getNpcCid()) ~= -1 then
          selfSay("You are already doing my task! Go end it!", cid)
          talkState[talkUser] = 0
          return true
   end
   selfSay("What task do you want? {Gengar}, {electabuzz}, {venusaur}, {charizard}", cid)
   talkState[talkUser] = 1
   return true
elseif isInArray({"Gengar", "electabuzz", "venusaur", "charizard"}, msg) and talkState[talkUser] == 1 then
   task = tasks[msg] --modifiquei aki tb
   selfSay("Are you sure?", cid)
   talkState[talkUser] = 2
   return true
elseif msgcontains(msg, "yes") and talkState[talkUser] == 2 then
   local sto = getFreeTaskStorage(cid)
   if sto == -1 then
          selfSay("You can't catch more tasks! You are already with the maximum of "..(maxTasks).." tasks!", cid)
          talkState[talkUser] = 0
          return true
   end
   selfSay("OK kill 300, good luck!", cid)
   setStorageArray(cid, sto, task)
   talkState[talkUser] = 0
   return true
end

return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Editado por Erimyth (veja o histórico de edições)

Resolvido por LeoTK

Ir para solução
  • Respostas 5
  • Visualizações 542
  • Created
  • Última resposta

Top Posters In This Topic

Postado

amigo eu adicionei um pikachu na task teste e me fale se deu certo

 

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 tasks = {
["blastoise"] = {["Dailly"] = {{"Blastoise", 300}}},
["electabuzz"] = {["Daily"] = {{"Electabuzz", 300}}},
["venusaur"] = {["Dailly"] = {{"Venusaur", 300}}},
["charizard"] = {["Dailly"] = {{"Charizard", 300}}},
["pikachu"] = {["Dailly"] = {{"Pikachu", 300}}},
}
local msg = msg:lower() --eh sempre bom por isso.. pra deixar a msg soh em letras minusculas


if msgcontains(msg, "task") then
if isMyTaskComplete(cid, getNpcCid()) then
selfSay("Wow you have already complete my task! Ok then, take your reward!", cid)
doPlayerAddExperience(cid, 1500000) --premio
doPlayerAddItem(cid, 2160, 25)

local sto = getMyTaskSto(cid, getNpcCid())
setPlayerStorageValue(cid, sto, -1) --nunca esqueça disso...
setPlayerStorageValue(cid, 25566, os.time() + 24*60*60)
setPlayerStorageValue(cid, 181601, 1) --storage da outfit
setPlayerStorageValue(cid, 181602, 1) --storage da outfit
talkState[talkUser] = 0
return true
elseif getPlayerStorageValue(cid, 25566) > os.time() then
selfSay("You have to wait 24h to do my task again!", cid)
talkState[talkUser] = 0
return true
elseif getMyTaskSto(cid, getNpcCid()) ~= -1 then
selfSay("You are already doing my task! Go end it!", cid)
talkState[talkUser] = 0
return true
end
selfSay("What task do you want? {blastoise}, {electabuzz}, {venusaur}, {charizard}, {pikachu}", cid)
talkState[talkUser] = 1
return true
elseif isInArray({"blastoise", "electabuzz", "venusaur", "charizard", "pikachu"}, msg) and talkState[talkUser] == 1 then
task = tasks[msg] --modifiquei aki tb
selfSay("Are you sure?", cid)
talkState[talkUser] = 2
return true
elseif msgcontains(msg, "yes") and talkState[talkUser] == 2 then
local sto = getFreeTaskStorage(cid)
if sto == -1 then
selfSay("You can't catch more tasks! You are already with the maximum of "..(maxTasks).." tasks!", cid)
talkState[talkUser] = 0
return true
end
selfSay("OK kill 300, good luck!", cid)
setStorageArray(cid, sto, task)
talkState[talkUser] = 0
return true
end

return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Postado
  • Solução

Bom, primeiramente vou deixar está dica sempre se baseia no que já tem na script e duplique.

 

vamos lá nessa primeira imagem na parte vermelha

 

JUpEn93.png

 

nesta área vermelha vou colocar oque deve ser editado.

 

["pikachu"] = {["Dailly"] = {{"Pikachu", 300}}},

 

No pikachu coloque o nome do pokemon tudo minusculo isso será oque você vai escrever para pegar a task ou escolher a mesma

 

Dailly não mecha

 

Pikachu = o nome do pokemon deve ser escrito igual começando com a letra maiuscula.

 

300 = será a quantidade de veses que você terá que matar o pokemon para terminar a task.

 

primeira parte feita.

 

Agora a segunda imagem

 

JCVTtBA.png

 

nessa segunda também você só vai adicionar mais pokemons porém tome cuidado ao adicionar um espaço errado o script buga

 

selfSay("What task do you want? {blastoise}, {electabuzz}, {venusaur}, {charizard}, {pikachu}", cid)

 

seguinte nessa primeira você pega as outras de base sempre vai ter {nomedopoke}, {nomedopoke},

 

sempre vai fechar rochetes e dar uma virgula e espaço rochetes nome do pokemon fecha rochetes e virgula, sempre nesta ordem

 

elseif isInArray({"blastoise", "electabuzz", "venusaur", "charizard", "pikachu"}, msg) and talkState[talkUser] == 1 then

 

está linha também porém em vez de rochetes será aspas "nomedopoke", "nomedopoke"

 

sempre terá aspas nome do pokemon fecha aspas virgulá e espaço.

 

OBS IMPORTANTE: bom você sempre vai adicionar depois do ultimo pokemon registrado então você terá que apenas colocar "nomedopoke" e acaba aqui porque será o ultimo porém quando você for adicionar mais pokemons você coloca uma virgula na aspas final e da um espaço abre aspas e continua e assim vai. ^^

 

bom espero que tenha compreendido tudo qualquer dúvida comente que eu vou fazer oque puder para ajudar


comentario editado amigo ^^

Editado por brunds (veja o histórico de edições)

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo