Então, no DxP tem dask diarias q meio funfan... (meio porque quando o servidor cai/fecha o contador sigue contando ai os caras continuam fazendo as tasks e quando vao no npc, ele só da duas novas opçaos)
mas entao queria q adaptarem para as TASK DE CLAN funfarem com esse contador ja que o servidor posee esse nas sources e nao o outro q pda usa pra as tasks do clan
script PDA:
Spoiler
local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talkState = {}function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endfunction creatureSayCallback(cid, type, msg)if(not npcHandler:isFocused(cid)) thenreturn falseendlocal talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid---------------------- Configs --------------------------- local clanNpcs = {["Mind Trainer"] = { task1 = { ["Mind Trainer"] = {{"Primeape", 5}, {"Venusaur", 5}, {"Arbok", 5}}, }, task2 = { ["Mind Trainer"] = {{"Arcanine", 5}, {"Venomoth", 5}, {"Heracross", 5}}, }, itens = {{12194, 20}, {12193, 20}, {12166, 10}}, poke = "Kadabra", level = 90, prevRank = 1, nextRank = 2,},["Brain Trainer"] = { task1 = { ["Brain Trainer"] = {{"Rhydon", 5}, {"Electabuzz", 5}, {"Mantine", 5}}, }, task2 = { ["Brain Trainer"] = {{"Tentacruel", 5}, {"Pidgeot", 5}, {"Ludicolo", 5}}, }, itens = {{12193, 25}, {13785, 200}}, poke = "Hypno", level = 100, prevRank = 2, nextRank = 3,},["Scholar Trainer"] = { task1 = { ["Scholar Trainer"] = {{"Noctowl", 5}, {"Magmar", 5}, {"Muk", 5}}, }, task2 = { ["Scholar Trainer"] = {{"Dugtrio", 5}, {"Furret", 5}, {"Snorlax", 5}}, }, itens = {{12194, 20}, {12193, 20}, {12166, 10}}, poke = "Mr. Mime", level = 110, prevRank = 3, nextRank = 4,},["Telepath Trainer"] = { task1 = { ["Telepath Trainer"] = {{"Crobat", 5}, {"Poliwrath", 5}, {"Golem", 5}}, }, task2 = { ["Telepath Trainer"] = {{"Dewgong", 5}, {"Houndoom", 5}, {"Miltank", 5}}, }, itens = {{12193, 25}, {13785, 200}}, poke = "Alakazam", level = 120, prevRank = 4, nextRank = 5,},}------------------------------------------------------------------------------local npc = clanNpcs[getNpcName()] if msgcontains(msg, 'help') or msgcontains(msg, 'Help') then if getPlayerLevel(cid) < npc.level or getPlayerClanName(cid) ~= 'Psycraft' or getPlayerClanRank(cid) ~= npc.prevRank then if getPlayerLevel(cid) < npc.level then selfSay("You need to be level: "..npc.level.." to speak with me") else selfSay("I don't need your help!") end talkState[talkUser] = 0 return true elseif getPlayerStorageValue(cid, 854789) <= -1 then selfSay("So you want to move up of rank on our clan... So, you need to bring some items to me... Do you wanna do it?") talkState[talkUser] = 1 return true elseif getPlayerStorageValue(cid, 854789) == 1 then selfSay("So you brought to me the items what i asked for?") talkState[talkUser] = 1 return true elseif getPlayerStorageValue(cid, 854789) == 2 then selfSay("The next step is you caught a pokemon to me... Do you wanna do it?") talkState[talkUser] = 1 return true elseif getPlayerStorageValue(cid, 854789) == 3 then selfSay("So you caught the pokemon what i asked for?") talkState[talkUser] = 1 return true elseif getPlayerStorageValue(cid, 854789) == 4 then selfSay("Now you need to do some tasks for me... Do you wanna do it?") talkState[talkUser] = 1 return true elseif getPlayerStorageValue(cid, 854789) == 5 then selfSay("So you finished the first task what i asked for?") talkState[talkUser] = 1 return true elseif getPlayerStorageValue(cid, 854789) == 6 then selfSay("And now comes the last task... Do you wanna to begin it?") talkState[talkUser] = 1 return true elseif getPlayerStorageValue(cid, 854789) == 7 then selfSay("So you finished the last task what i asked for?") talkState[talkUser] = 1 return true end elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'Yes')) and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, 854789) <= -1 then local str = "Ok then, you need bring to me: " for a = 1, #npc.itens do str = str..(a == #npc.itens and " and " or a ~= 1 and ", " or "{")..(npc.itens[a][2]).." "..(getItemNameById(npc.itens[a][1])) end str = str.."}, come back when you join those items!" selfSay(str) setPlayerStorageValue(cid, 854789, 1) talkState[talkUser] = 0 return true elseif getPlayerStorageValue(cid, 854789) == 1 then local check = checkItensForTask(cid, npc.itens) if check == 0 then selfSay("Ok then, you completed the mission, talk to me again when you want to continue!") setPlayerStorageValue(cid, 854789, 2) talkState[talkUser] = 0 return true else selfSay(check) talkState[talkUser] = 0 return true end elseif getPlayerStorageValue(cid, 854789) == 2 then selfSay("Ok then, you need to caught a {"..(npc.poke).."}, and bring it to me... Come back when you do that!") setPlayerStorageValue(cid, 854789, 3) setPlayerStorageValue(cid, 854788, npc.poke) talkState[talkUser] = 0 return true elseif getPlayerStorageValue(cid, 854789) == 3 then if getPlayerStorageValue(cid, 854788) == 'done' then selfSay("Very well, talk to me again when you want to continue!") setPlayerStorageValue(cid, 854789, 4) setPlayerStorageValue(cid, 854788, -1) setPlayerStorageValue(cid, 854787, npc.poke) talkState[talkUser] = 0 return true else selfSay("You didn't caught the pokemon what i asked for! Go do it!") talkState[talkUser] = 0 return true end elseif getPlayerStorageValue(cid, 854789) == 4 then local sto = getFreeTaskStorage(cid) local c = 0 if sto == -1 then selfSay("You can't get more tasks! You are already with the maximum of "..(maxTasks).." tasks!") talkState[talkUser] = 0 return true end local str = "Ok then, now you need to kill: {" for e, f in pairs(npc.task1) do for a = 1, #f do str = str..((a == #f and c ~= 0) and " and " or a ~= 1 and ", " or "")..f[a][2].." "..f[a][1] c = c+1 end end str = str.."} with the {"..(npc.poke).."} which you caught!" selfSay(str) setPlayerStorageValue(cid, 854789, 5) setStorageArray(cid, sto, npc.task1) talkState[talkUser] = 0 return true elseif getPlayerStorageValue(cid, 854789) == 5 then if isMyTaskComplete(cid, getNpcCid()) then selfSay("Very well, you have done my first task... Talk to me again when you want to continue!") local sto = getMyTaskSto(cid, getNpcCid()) setPlayerStorageValue(cid, sto, -1) setPlayerStorageValue(cid, 854789, 6) talkState[talkUser] = 0 return true else local str = "" local c = 0 for e, f in pairs(npc.task1) do for a = 1, #f do str = str..((a == #f and c ~= 0) and " and " or a ~= 1 and ", " or "")..f[a][2].." "..f[a][1] c = c+1 end end str = str.."} with the {"..(npc.poke).."} which you caught!" selfSay("You didn't complete my task yet... You need to kill: "..str) talkState[talkUser] = 0 return true end elseif getPlayerStorageValue(cid, 854789) == 6 then local sto = getFreeTaskStorage(cid) local c = 0 if sto == -1 then selfSay("You can't catch more tasks! You are already with the maximum of "..(maxTasks).." tasks!") talkState[talkUser] = 0 return true end local str = "Ok then, now for your last task you need to kill: {" for e, f in pairs(npc.task2) do for a = 1, #f do str = str..((a == #f and c ~= 0) and " and " or a ~= 1 and ", " or "")..f[a][2].." "..f[a][1] c = c+1 end end str = str.."} with the {"..(npc.poke).."} which you caught!" selfSay(str) setPlayerStorageValue(cid, 854789, 7) setStorageArray(cid, sto, npc.task2) talkState[talkUser] = 0 return true elseif getPlayerStorageValue(cid, 854789) == 7 then if isMyTaskComplete(cid, getNpcCid()) then --- local storages = {17000, 63215, 17001, 13008, 5700} --alterado v1.8 for s = 1, #storages do if getPlayerStorageValue(cid, storages[s]) >= 1 then selfSay("You can't do that while is Flying, Riding, Surfing, Diving or mount a bike!") talkState[talkUser] = 0 return true end end if #getCreatureSummons(cid) >= 1 then --alterado v1.8 selfSay("Return your pokemon!") talkState[talkUser] = 0 return true end --- if checkPokemonForTask(cid, npc.poke) then setPlayerClanRank(cid, npc.nextRank) selfSay("So you complete my last task! Congradulations! Now you move up of rank and become {"..lookClans[getPlayerClanNum(cid)][getPlayerClanRank(cid)].."}!") setPlayerStorageValue(cid, 854789, -1) setPlayerStorageValue(cid, 854787, -1) local sto = getMyTaskSto(cid, getNpcCid()) setPlayerStorageValue(cid, sto, -1) talkState[talkUser] = 0 return true else selfSay("You aren't with the "..(npc.poke).." which you caught before in your pokebag! Go get it!") talkState[talkUser] = 0 return true end else local str = "" local c = 0 for e, f in pairs(npc.task2) do for a = 1, #f do str = str..((a == #f and c ~= 0) and " and " or a ~= 1 and ", " or "")..f[a][2].." "..f[a][1] c = c+1 end end str = str.."} with the {"..(npc.poke).."} which you caught!" selfSay("You didn't complete my task yet... You need to kill: "..str) talkState[talkUser] = 0 return true end end end return trueendnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new())
Script DXP
Spoiler
function onCreatureTurn(creature)endfunction msgcontains(txt, str)return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))endlocal talkState = {}local focus = 0local talk_start = 0local lookNpcDir = getNPCXMLLOOKDIR(getNPCXMLNAME(getThis()))local tchau = falselocal opcoesDiarias = {}local hora = os.date("%d") -- mudar para diaslocal dia = os.date("%d")local strinSay1 = ""local stringSay2 = ""local expToGive1 = 1000local expToGive2 = 1000local strinSay1, strinSay2 = "", ""function onCreatureSay(cid, type, msg)local msg = string.lower(msg)local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cidif not (getDistanceToCreature(cid) <= 3) then return trueendif msgcontains(string.lower(msg), 'hi') then if focus ~= 0 and focus ~= cid then selfSay(getCreatureName(cid) .. ' aguarde...') return true else focus = cid talk_start = os.clock() endendlocal getNpcTaskName = getPlayerStorageValue(cid, storages.miniQuests.storNpcTaskName3)local pokeTask1 = getPlayerStorageValue(cid, storages.miniQuests.storPokeNameTask3)local pokeCountTask1 = tonumber(getPlayerStorageValue(cid, storages.miniQuests.storPokeCountTask3))local minhaHora = getPlayerStorageValue(cid, storages.miniQuests.storDayTask3) if tonumber(minhaHora) ~= tonumber(hora) then setPlayerStorageValue(cid, storages.miniQuests.storNpcTaskName3, -1) setPlayerStorageValue(cid, storages.miniQuests.storPokeNameTask3, -1) setPlayerStorageValue(cid, storages.miniQuests.storPokeCountTask3, -1) setPlayerStorageValue(cid, storages.miniQuests.storDayTask3, -1)endlocal getNpcTaskName = getPlayerStorageValue(cid, storages.miniQuests.storNpcTaskName3)local pokeTask1 = getPlayerStorageValue(cid, storages.miniQuests.storPokeNameTask3)local pokeCountTask1 = tonumber(getPlayerStorageValue(cid, storages.miniQuests.storPokeCountTask3))local minhaHora = getPlayerStorageValue(cid, storages.miniQuests.storDayTask3)if pokeTask1 == "amanha" and msgcontains(string.lower(msg), 'hi') then selfSay("Você já terminou minha task diaria.") talkState[talkUser] = 0 tchau = true focus = 0 return true end if ((pokeTask1 == strinSay1 or pokeTask1 == strinSay2) and getNpcTaskName == getCreatureName(getThis())) and msgcontains(string.lower(msg), 'hi') then local expToGive = expToGive1 if pokeTask1 == strinSay2 then expToGive = expToGive2 end if pokeCountTask1 <= 0 then selfSay('Aqui está sua recompensa.') doPlayerAddExp(cid, expToGive) doSendAnimatedText(getThingPos(cid), expToGive, 215) doPlayerAddItem(cid, 15645, 4) setPlayerStorageValue(cid, storages.miniQuests.storPokeNameTask3, "amanha") elseif pokeCountTask1 > 0 then selfSay('Ainda faltam ' .. pokeCountTask1 .. ' ' .. pokeTask1 .. (pokeCountTask1 > 1 and "s" or '') .. '.') end talkState[talkUser] = 0 tchau = true focus = 0 return true endcount = 0 if((msgcontains(string.lower(msg), 'hi') or msgcontains(string.lower(msg), 'help')) and (getDistanceToCreature(cid) <= 3)) then local stringToSay1 = "" for i = 1, #opcoesDiarias[1] do local pokeCount = opcoesDiarias[1][i][2] local pokeWord = pokeCount > 1 and "s" or "" stringToSay1 = stringToSay1 .. pokeCount .. " " .. opcoesDiarias[1][i][1] .. pokeWord .. (i == 1 and "" or " e ") end local stringToSay2 = "" for i = 1, #opcoesDiarias[2] do local pokeCount = opcoesDiarias[2][i][2] local pokeWord = pokeCount > 1 and "s" or "" stringToSay2 = stringToSay2 .. pokeCount .. " " .. opcoesDiarias[2][i][1] .. pokeWord .. (i == 1 and "" or " e ") end selfSay('Olá! Minhas tasks são do nivel Hard. Você pode matar ' .. stringToSay1 .. " ou " .. stringToSay2 .. ".") talkState[talkUser] = 1 elseif msgcontains(string.lower(msg), string.lower(strinSay1)) or msgcontains(string.lower(msg), string.lower(strinSay2)) and getDistanceToCreature(cid) <= 3 and talkState[talkUser] == 1 then local pokeCounts = 0 if msgcontains(string.lower(msg), string.lower(strinSay1)) then setPlayerStorageValue(cid, storages.miniQuests.storNpcTaskName3, getCreatureName(getThis())) setPlayerStorageValue(cid, storages.miniQuests.storPokeNameTask3, opcoesDiarias[1][1][1]) setPlayerStorageValue(cid, storages.miniQuests.storPokeCountTask3, opcoesDiarias[1][1][2]) setPlayerStorageValue(cid, storages.miniQuests.storDayTask3, hora) pokeCounts = opcoesDiarias[1][1][2] else setPlayerStorageValue(cid, storages.miniQuests.storNpcTaskName3, getCreatureName(getThis())) setPlayerStorageValue(cid, storages.miniQuests.storPokeNameTask3, opcoesDiarias[2][1][1]) setPlayerStorageValue(cid, storages.miniQuests.storPokeCountTask3, opcoesDiarias[2][1][2]) setPlayerStorageValue(cid, storages.miniQuests.storDayTask3, hora) pokeCounts = opcoesDiarias[2][1][2] end selfSay('Okay. Manterei contato com você. Boa sorte com os ' .. pokeCounts.. ' ' .. msg .. (pokeCounts > 1 and 's' or '') .. '.') talkState[talkUser] = 0 focus = 0 tchau = true return true endendlocal tablePoke = diarias.Hard local dificult = 3function onThink() -- resetar tasks if hora ~= os.date("%d") then opcoesDiarias = {} tablePoke = diarias.Hard hora = os.date("%d") end if #opcoesDiarias == 0 then -- vamos iniciar as opcoesDiarias local sorteio1 = math.random(1, #tablePoke) local op1 = tablePoke[sorteio1] table.remove(tablePoke, sorteio1) strinSay1 = op1 local sorteio2 = math.random(1, #tablePoke) local op2 = tablePoke[sorteio2] table.remove(tablePoke, sorteio2) strinSay2 = op2 local pokeCount1 = math.random(20, 100) * dificult local pokeCount2 = math.random(20, 100) * dificult opcoesDiarias[1] = { {op1, pokeCount1} } opcoesDiarias[2] = { {op2, pokeCount2} } expToGive1 = 1000 * pokeCount1 expToGive2 = 1000 * pokeCount2 end if focus ~= 0 then if getDistanceToCreature(focus) > 3 then tchau = true focus = 0 end if (os.clock() - talk_start) > 15 then if focus > 0 then tchau = true focus = 0 end end doNpcSetCreatureFocus(focus) end if tchau then tchau = false doCreatureSetLookDir(getThis(), lookNpcDir) selfSay('Tchau.') endend