Estou com um sistema de task, que aparentimente está funcionando até um certo ponto, qnd pedimos a task recebemos normalmente, ai qnd vamos la matar o bixo a task nao conta..
-- Sistema de Task feito por Leoric (Omega no XTibia) --
function onSay(cid, words, param, channel)
local monster, permission = getPlayerStorageValue(cid,taskstg.monster), getPlayerStorageValue(cid,taskstg.permission)
local kills, killstotal = getPlayerStorageValue(cid,taskstg.kills), getPlayerStorageValue(cid,taskstg.killstotal)
if monster == -1 or monster == 0 then
doPlayerSendTextMessage(cid,27,'Voce nao tem nenhuma task ativa.')
else
local left = killstotal - kills
if left <= 0 then
doPlayerSendTextMessage(cid,27,'Voce ja matou monstros suficientes para terminar sua task.')
else
doPlayerSendTextMessage(cid,27,'Andamento da sua task de '..taskmonsters[monster][1]..'s -> ['..kills..'/'..killstotal..']')
end
end
return true
end
Creatureevents:
-- Sistema de Task feito por Leoric (Omega no XTibia) --
function onKill(cid, target)
if not isPlayer(cid) then return true end
if isSummon(target) then return true end
local monster, permission = getPlayerStorageValue(cid,taskstg.monster), getPlayerStorageValue(cid,taskstg.permission)
local kills, killstotal = getPlayerStorageValue(cid,taskstg.kills), getPlayerStorageValue(cid,taskstg.killstotal)
if monster ~= -1 and monster ~= 0 then
if isInArray(taskmonsters[monster],string.lower(getCreatureName(target))) then
if kills == -1 then
setPlayerStorageValue(cid,taskstg.kills,1)
elseif kills + 1 == killstotal and taskMsg.bool == true then
doPlayerSendTextMessage(cid, 21, taskMsg.msg)
setPlayerStorageValue(cid,taskstg.kills,kills+1)
else
setPlayerStorageValue(cid,taskstg.kills,kills+1)
end
end
end
return true
end
Pergunta
Nickbhz 15
Boa tarde xTibianos...
Estou com um sistema de task, que aparentimente está funcionando até um certo ponto, qnd pedimos a task recebemos normalmente, ai qnd vamos la matar o bixo a task nao conta..
LIB:
-- Sistema de Task feito por Leoric (Omega no XTibia) -- taskstg = { kills = 3451, permission = 3452, killstotal = 3453, monster = 3454, stage = 3455, points = 3456, } timeBetweenTasks = 1 -- tempo até poder fazer outra task (24 * 60 * 60 = 24hs) taskLevel = false -- true se quiser que as tasks sejam feitas por level / false se quiser que elas sejam feitas na ordem taskMsg = {bool = true, msg = 'Voce acaba de matar monstros suficientes para completar sua task!'} -- bool = false > sem mensagens; bool = true > aviso quando terminar a task taskEnd = true -- [não tem função no modo Level] se estiver como true, quando o jogador terminar a última task disponível, ele não poderá repeti-la. Se estiver false, ele poderá repetir a última task infinitamente. taskmonsters = { [1] = {'rotworm','carrion worm', killstotal = 270}, -- aqui você deve mudar [2] = {'bandit','assassin', killstotal = 285}, [3] = {'dwarf','dwarf soldier', killstotal = 300}, [4] = {'amazon','amazons', killstotal = 315}, [5] = {'orc warrior','orc spearman','orc shaman','orc leader','orc berserker','orc warlord','orc rider', killstotal = 330}, [6] = {'elf scout','elf arcanist', killstotal = 345}, [7] = {'tarantula', killstotal = 360}, [8] = {'cyclop','cyclops','cyclops drone','cyclops smith', killstotal = 375}, [9] = {'dwarf guard', killstotal = 390}, [10] = {'beholder','elder beholder','braindeath', killstotal = 405}, [11] = {'pirate buccaneer','pirate corsair','pirate Cutthroat','pirate ghost','pirate marauder','pirate skeleton', killstotal = 425}, [12] = {'crypt shambler', killstotal = 445}, [13] = {'monk','dark monk', killstotal = 465}, [14] = {'dark magician','mad scientist', killstotal = 485}, [15] = {'lizard sentinel','lizard snakecharmer','lizard templar', killstotal = 505}, [16] = {'blue djinn','green djinn','efreet','marid', killstotal = 525}, [17] = {'demon skeleton', killstotal = 545}, [18] = {'mercury blob','death blob','acid blob','slime', killstotal = 565}, [19] = {'necromancer', killstotal = 585}, [20] = {'vampire','vampire bride', killstotal = 605}, [21] = {'bone beast', killstotal = 630}, [22] = {'ice witch', killstotal = 655}, [23] = {'mutated bat', killstotal = 680}, [24] = {'dragon', killstotal = 705}, [25] = {'ancient scarab', killstotal = 730}, [26] = {'frost dragon hatchling', killstotal = 755}, [27] = {'crystal spider', killstotal = 780}, [28] = {'lich', killstotal = 805}, [29] = {'banshee', killstotal = 830}, [30] = {'giant spider', killstotal = 855}, [31] = {'hero', killstotal = 885}, [32] = {'nightmare','nightmare scion', killstotal = 915}, [33] = {'black knight', killstotal = 945}, [34] = {'dragon lord', killstotal = 975}, [35] = {'frost dragon', killstotal = 1005}, [36] = {'hydra', killstotal = 1035}, [37] = {'behemoth', killstotal = 1065}, [38] = {'plaguesmith', killstotal = 1095}, [39] = {'blightwalker', killstotal = 1125}, [40] = {'dark torturer', killstotal = 1155}, [41] = {'hand of cursed fate', killstotal = 1190}, [42] = {'warlock', killstotal = 1225}, [43] = {'infernalist', killstotal = 1260}, [44] = {'phantasm', killstotal = 1295}, [45] = {'grim reaper', killstotal = 1330}, [46] = {'son of verminor', killstotal = 1365}, [47] = {'demon', killstotal = 1400}, [48] = {'hellhound', killstotal = 1435}, [49] = {'undead dragon', killstotal = 1470}, [50] = {'Juggernaut', killstotal = 1500}, [51] = {'ferumbras', killstotal = 80}, [52] = {'verminor','annihilon','latrivan','zoralurk','hellgorak','madareth', killstotal = 60}, [53] = {'orshabaal', killstotal = 40}, [54] = {'ghazbaran','morgaroth', killstotal = 40} } taskreward = -- em gps { [1] = {money = 3000000,xp = 64000,item = {5940, 5940, 5919, 5809, 5804}, amount = {1,1,1,1,1}}, [2] = {money = 2,xp = 11000}, -- 1 item(2458) será adicionado e nenhum ponto de task [3] = {money = 3,xp = 12000}, -- aqui serão adicionados 2 itens com id 2458 (se ele for amontoável - stackable) e 5 pontos de task [4] = {money = 4,xp = 13000}, [5] = {money = 5,xp = 14000}, [6] = {money = 6,xp = 15000}, [7] = {money = 7,xp = 16000}, [8] = {money = 8,xp = 17000}, [9] = {money = 9,xp = 18000}, [10] = {money = 3000000,xp = 19000,item = {8300}, amount = {2}}, [11] = {money = 10,xp = 20000}, [12] = {money = 11,xp = 21000}, [13] = {money = 12,xp = 22000}, [14] = {money = 13,xp = 23000}, [15] = {money = 14,xp = 24000}, [16] = {money = 15,xp = 25000}, [17] = {money = 16,xp = 26000}, [18] = {money = 17,xp = 27000}, [19] = {money = 18,xp = 28000}, [20] = {money = 3000000,xp = 29000,item = {8300}, amount = {3}}, [21] = {money = 20,xp = 30000}, [22] = {money = 21,xp = 31000}, [23] = {money = 22,xp = 32000}, [24] = {money = 23,xp = 33000}, [25] = {money = 24,xp = 34000}, [26] = {money = 25,xp = 35000}, [27] = {money = 26,xp = 36000}, [28] = {money = 27,xp = 37000}, [29] = {money = 28,xp = 38000}, [30] = {money = 29,xp = 39000,item = {5015,8300}, amount = {1,1}}, [31] = {money = 30,xp = 40000}, [32] = {money = 31,xp = 41000}, [33] = {money = 32,xp = 42000}, [34] = {money = 33,xp = 43000}, [35] = {money = 34,xp = 44000}, [36] = {money = 35,xp = 45000}, [37] = {money = 36,xp = 46000}, [38] = {money = 37,xp = 47000}, [39] = {money = 38,xp = 48000}, [40] = {money = 5000000,xp = 49000,item = {8306, 8300}, amount = {1,1}}, [41] = {money = 39,xp = 50000}, [42] = {money = 40,xp = 51000}, [43] = {money = 41,xp = 52000}, [44] = {money = 42,xp = 53000}, [45] = {money = 43,xp = 54000}, [46] = {money = 44,xp = 55000}, [47] = {money = 45,xp = 56000}, [48] = {money = 46,xp = 57000}, [49] = {money = 47,xp = 58000}, [50] = {money = 48,xp = 59000}, [51] = {money = 49,xp = 60000}, [52] = {money = 50,xp = 61000}, [53] = {money = 51,xp = 62000}, [54] = {money = 3000000,xp = 64000,item = {5940, 5940, 5919, 5809, 5804}, amount = {1,1,1,1,1}} } function canDoTask(cid) local stage = getPlayerStorageValue(cid, taskstg.stage) if stage + 1 > #taskmonsters then return false elseif getPlayerStorageValue(cid,taskstg.permission) <= 0 then return true elseif getPlayerStorageValue(cid,taskstg.permission) == 1 then return false elseif getPlayerStorageValue(cid,taskstg.permission) >= os.time(t) then return false end return true end function doResetTask(cid) setPlayerStorageValue(cid,taskstg.kills,-1) setPlayerStorageValue(cid,taskstg.permission,os.time(t) + timeBetweenTasks) setPlayerStorageValue(cid,taskstg.killstotal,-1) setPlayerStorageValue(cid,taskstg.monster,-1) return true end function doRewardTask(cid) local monster = getPlayerStorageValue(cid,taskstg.monster) local reward = taskreward[monster] if reward.item then for i= 1, #reward.item do doPlayerAddItem(cid,reward.item[i],reward.amount[i]) end end if reward.points then local points = getPlayerStorageValue(cid, taskstg.points) if points == -1 then setPlayerStorageValue(cid, taskstg.points, 0) end setPlayerStorageValue(cid, taskstg.points, reward.points + points) end if monster and reward then doPlayerAddMoney(cid,reward.money) doPlayerAddExperience(cid, reward.xp) end return true end function isSummon(cid) -- baseada na função do Vodkart if getCreatureMaster(cid) ~= nil or getCreatureMaster(cid) == true then return true end return false end function doCompleteTask(cid) doRewardTask(cid) doResetTask(cid) return true end function doStartTask(cid) if not taskLevel then local stage = getPlayerStorageValue(cid, taskstg.stage) if stage <= 0 then setPlayerStorageValue(cid, taskstg.monster, 1) setPlayerStorageValue(cid, taskstg.killstotal, taskmonsters[1].killstotal) setPlayerStorageValue(cid, taskstg.stage, 1) else setPlayerStorageValue(cid, taskstg.monster, stage+1) setPlayerStorageValue(cid, taskstg.killstotal, taskmonsters[stage+1].killstotal) if taskEnd or stage < #taskmonsters then setPlayerStorageValue(cid, taskstg.stage, stage+1) end end setPlayerStorageValue(cid, taskstg.permission, 1) setPlayerStorageValue(cid, taskstg.kills, 0) return true end local lvl = getPlayerLevel(cid) if lvl < 20 then local killstotal = taskmonsters[1].killstotal setPlayerStorageValue(cid,taskstg.monster,1) setPlayerStorageValue(cid,taskstg.killstotal,killstotal) setPlayerStorageValue(cid,taskstg.permission,1) elseif lvl < 50 then local killstotal = taskmonsters[2].killstotal setPlayerStorageValue(cid,taskstg.monster,2) setPlayerStorageValue(cid,taskstg.killstotal,killstotal) setPlayerStorageValue(cid,taskstg.permission,1) else local killstotal = taskmonsters[3].killstotal setPlayerStorageValue(cid,taskstg.monster,3) setPlayerStorageValue(cid,taskstg.killstotal,killstotal) setPlayerStorageValue(cid,taskstg.permission,1) end setPlayerStorageValue(cid,taskstg.kills,0) return true endTalkactions:
-- Sistema de Task feito por Leoric (Omega no XTibia) -- function onSay(cid, words, param, channel) local monster, permission = getPlayerStorageValue(cid,taskstg.monster), getPlayerStorageValue(cid,taskstg.permission) local kills, killstotal = getPlayerStorageValue(cid,taskstg.kills), getPlayerStorageValue(cid,taskstg.killstotal) if monster == -1 or monster == 0 then doPlayerSendTextMessage(cid,27,'Voce nao tem nenhuma task ativa.') else local left = killstotal - kills if left <= 0 then doPlayerSendTextMessage(cid,27,'Voce ja matou monstros suficientes para terminar sua task.') else doPlayerSendTextMessage(cid,27,'Andamento da sua task de '..taskmonsters[monster][1]..'s -> ['..kills..'/'..killstotal..']') end end return true endCreatureevents:
-- Sistema de Task feito por Leoric (Omega no XTibia) -- function onKill(cid, target) if not isPlayer(cid) then return true end if isSummon(target) then return true end local monster, permission = getPlayerStorageValue(cid,taskstg.monster), getPlayerStorageValue(cid,taskstg.permission) local kills, killstotal = getPlayerStorageValue(cid,taskstg.kills), getPlayerStorageValue(cid,taskstg.killstotal) if monster ~= -1 and monster ~= 0 then if isInArray(taskmonsters[monster],string.lower(getCreatureName(target))) then if kills == -1 then setPlayerStorageValue(cid,taskstg.kills,1) elseif kills + 1 == killstotal and taskMsg.bool == true then doPlayerSendTextMessage(cid, 21, taskMsg.msg) setPlayerStorageValue(cid,taskstg.kills,kills+1) else setPlayerStorageValue(cid,taskstg.kills,kills+1) end end end return true endAJUDEM PLISSS !!!
Editado por brendoonhUP
Link para o comentário
https://xtibia.com/forum/topic/238221-task/Compartilhar em outros sites
10 respostass a esta questão
Posts Recomendados