Ir para conteúdo

[Task System] Command 1.0


Roksas

Posts Recomendados

[Task System] Command 1.0

Versão testada: 8.6 +

TFS usado: 0.4

 

Comandos disponíveis:

!task list -- Mostra quais monstros podem ser "taskeados";
!task Troll -- Neste modelo, você coloca o nome do monstro que quer taskear;

Eaaai galerinha XTibiana, beleza comunidade? Decidi fazer um sistema de Task bem legal, com recompensa de Exp, Money e é tudo via comandos.

 

Vá em data/creaturescripts/scripts, crie um arquivo chamado taskSys.lua e adicione dentro:

 

 

 

--[[

    Task System criado por Roksas

    Acesse já XTibia.com 

]]--



function onKill(cid, target, lastHit)

local task = taskSys[getCreatureName(string.lower(target))]



if not task then

    return true

end



if getPlayerStorageValue(cid, task.storKill) >= (task.goalNeed - 1) then

    doPlayerAddExp(cid, task.exp)

    doPlayerAddMoney(cid, task.money)

    setPlayerStorageValue(cid, 19000, -1)

    setPlayerStorageValue(cid, task.storKill, -1)

    doPlayerSendTextMessage(cid, 20, "[Task-System] Congratulations! You completed the task of "..task.raceName.." race.")

    return true

end



if getPlayerStorageValue(cid, task.can) >= 1 and getPlayerStorageValue(cid, 19000) >= 1 then



if getPlayerStorageValue(cid, task.storKill) < 1 then

    setPlayerStorageValue(cid, task.storKill, 0)

end



    setPlayerStorageValue(cid, task.storKill, getPlayerStorageValue(cid, task.storKill) + 1)

    doPlayerSendTextMessage(cid, 20, "[Task-System] Defeated ["..getPlayerStorageValue(cid, task.storKill).."/"..task.goalNeed.."] "..task.raceName..".")

    return true

end



    return true

end

 

 

 

Na mesma pasta, abra o arquivo login.lua e adicione:

registerCreatureEvent(cid, "taskSys")

Em creaturescripts.xml você deve adicionar a seguinte tag:

<event type="kill" name="taskSys" event="script" value="taskSys.lua"/>

Muito bem, agora vá na pasta data/talkactions/scripts, crie um arquivo chamado taskSys.lua e adicione dentro:

 

 

 

--[[
    Task System criado por Roksas
    Acesse já XTibia.com 
]]--
 
function onSay(cid, words, param)
local task = taskSys[param]

if not param or param == "" then
    return doPlayerSendTextMessage(cid, 20, "[Task-System] Insira o nome da Task que deseja iniciar.") and true
end

if getPlayerStorageValue(cid, 19000) >= 1 then
    return doPlayerSendTextMessage(cid, 20, "[Task-System] Você já está fazendo uma task, tente novamente.") and true
end

if not task and param ~= "list" then
    return doPlayerSendTextMessage(cid, 20, "[Task-System] Essa task não está em nosso banco de dados, utilize o comando {!task list} para se informar.") and true
end

if param == "list" then
doPlayerSendTextMessage(cid, 20, "[Task-System] Disponíveis no momento:")

for a, b in pairs(taskSys) do
    doPlayerSendTextMessage(cid, 20, ""..a.." - Matar "..b.goalNeed.."x - [EXP: "..b.exp.."] [Money: "..b.money.."]")
end

    return true
end

    setPlayerStorageValue(cid, 19000, 1)
    setPlayerStorageValue(cid, task.can, 1)
    doPlayerSendTextMessage(cid, 20, "[Task-System] Você iniciou uma task, derrote "..task.goalNeed.." "..task.raceName.."'s para completar a tarefa.")
    return true
end

 

 

 

E no arquivo talkactions.xml você adiciona essa seguinte tag:

<talkaction words="!task;/task" event="script" value="taskSys.lua"/>

Agora volte para a pasta data e entre na pasta lib (data/lib), nele você deve criar um arquivo também com o nome de taskSys.lua e adicionar esta tabela dentro:

 

 

 

--[[

    Task System criado por Roksas

    Acesse já XTibia.com 

]]--
 
taskSys = {



--[[ Trolls Race ]]-- 1



    ["Troll"] = {storKill = 17301, goalNeed = 100, raceName = "Trolls", can = 15019, exp = 1000, money = 5000},

    ["Frost Troll"] = {storKill = 17301, goalNeed = 100, raceName = "Trolls", can = 15019, exp = 1000, money = 5000},

    ["Furious Troll"] = {storKill = 17301, goalNeed = 100, raceName = "Trolls", can = 15019, exp = 1000, money = 5000},

    ["Island Troll"] = {storKill = 17301, goalNeed = 100, raceName = "Trolls", can = 15019, exp = 1000, money = 5000},

    ["Swamp Troll"] = {storKill = 17301, goalNeed = 100, raceName = "Trolls", can = 15019, exp = 1000, money = 5000},

    ["Troll Champion"] = {storKill = 17301, goalNeed = 100, raceName = "Trolls", can = 15019, exp = 1000, money = 5000},

    ["Troll Legionnaire"] = {storKill = 17301, goalNeed = 100, killBoss = 18701, raceName = "Trolls", can = 15019, exp = 1000, money = 5000},



 --[[ Goblins Race ]]-- 2

    ["Goblin"] = {storKill = 17302, goalNeed = 150, raceName = "Goblins", can = 15019, exp = 1000, money = 5000},

    ["Goblin Assassin"] = {storKill = 17302, goalNeed = 150, raceName = "Goblins", can = 15019, exp = 1000, money = 5000},

    ["Goblin Leader"] = {storKill = 17302, goalNeed = 150, raceName = "Goblins", can = 15019, exp = 1000, money = 5000},

    ["Goblin Scavenger"] = {storKill = 17302, goalNeed = 150, raceName = "Goblins", can = 15019, exp = 1000, money = 5000},

                                                                                        

 --[[ Annelidies Race ]]-- 3

    ["Rotworm"] = {storKill = 17303, goalNeed = 300, raceName = "Annelidies", can = 15019, exp = 1000, money = 5000},

    ["Carriom Worm"] = {storKill = 17303, goalNeed = 300, raceName = "Annelidies", can = 15019, exp = 1000, money = 5000},



 --[[ Cyclops Race ]]-- 4

    ["Cyclops"] = {storKill = 17304, goalNeed = 500, raceName = "Cyclops", can = 15019, exp = 1000, money = 5000},

    ["Cyclops Smith"] = {storKill = 17304, goalNeed = 500, raceName = "Cyclops", can = 15019, exp = 1000, money = 5000},

    ["Cyclops Drone"] = {storKill = 17304, goalNeed = 500, raceName = "Cyclops", can = 15019, exp = 1000, money = 5000},



--[[ Quaras Race ]]-- 6

    ["Quara Predator Scout"] = {storKill = 17306, goalNeed = 300, raceName = "Quaras", can = 15019, exp = 1000, money = 5000},

    ["Quara Constrictor Scout"] = {storKill = 17306, goalNeed = 300, raceName = "Quaras", can = 15019, exp = 1000, money = 5000},

    ["Quara Hydromancer Scout"] = {storKill = 17306, goalNeed = 300, raceName = "Quaras", can = 15019, exp = 1000, money = 5000},

    ["Quara Mantassin Scout"] = {storKill = 17306, goalNeed = 300, raceName = "Quaras", can = 15019, exp = 1000, money = 5000},

    ["Quara Pincher Scout"] = {storKill = 17306, goalNeed = 300, raceName = "Quaras", can = 15019, exp = 1000, money = 5000},

    ["Quara Predator"] = {storKill = 17306, goalNeed = 300, raceName = "Quaras", can = 15019, exp = 1000, money = 5000},

    ["Quara Ponstrictor"] = {storKill = 17306, goalNeed = 300, raceName = "Quaras", can = 15019, exp = 1000, money = 5000},

    ["Quara Hydromancer"] = {storKill = 17306, goalNeed = 300, raceName = "Quaras", can = 15019, exp = 1000, money = 5000},

    ["Quara Mantassin"] = {storKill = 17306, goalNeed = 300, raceName = "Quaras", can = 15019, exp = 1000, money = 5000},

    ["Quara Pincher"] = {storKill = 17306, goalNeed = 300, raceName = "Quaras", can = 15019, exp = 1000, money = 5000},



--[[ Water Elemental Race ]]-- 7

    ["Water Elemental"] = {storKill = 17307, goalNeed = 70, raceName = "Water Elementals", can = 15019, exp = 1000, money = 5000},

    ["Roaring Water Elemental"] = {storKill = 17307, goalNeed = 70, raceName = "Water Elementals", can = 15019, exp = 1000, money = 5000},

    ["Slick Water Elemental"] = {storKill = 17307, goalNeed = 70, raceName = "Water Elementals", can = 15019, exp = 1000, money = 5000},

    ["Massive Water Elemental"] = {storKill = 17307, goalNeed = 70, raceName = "Water Elementals", can = 15019, exp = 1000, money = 5000},



--[[ Earth Elemental Race ]]-- 8

    ["Earth Elemental"] = {storKill = 17308, goalNeed = 70, raceName = "Earth Elementals", can = 15019, exp = 1000, money = 5000},

    ["Jagged Earth Elemental"] = {storKill = 17308, goalNeed = 70, raceName = "Earth Elementals", can = 15019, exp = 1000, money = 5000},

    ["Massive Earth Elemental"] = {storKill = 17308, goalNeed = 70, raceName = "Earth Elementals", can = 15019, exp = 1000, money = 5000},

    ["Muddy Earth Elemental"] = {storKill = 17308, goalNeed = 70, raceName = "Earth Elementals", can = 15019, exp = 1000, money = 5000},



 --[[ Energy Elemental Race ]]-- 9

    ["Energy Elemental"] = {storKill = 17309, goalNeed = 70, raceName = "Energy Elementals", can = 15019, exp = 1000, money = 5000},

    ["Charged Energy Elemental"] = {storKill = 17309, goalNeed = 70, raceName = "Energy Elementals", can = 15019, exp = 1000, money = 5000},

    ["Massive Energy Elemental"] = {storKill = 17309, goalNeed = 70, raceName = "Energy Elementals", can = 15019, exp = 1000, money = 5000},

    ["Overcharged Energy Elemental"] = {storKill = 17309, goalNeed = 70, raceName = "Energy Elementals", can = 15019, exp = 1000, money = 5000},



--[[ Fire Elemental Race ]]-- 10

    ["Fire Elemental"] = {storKill = 17310, goalNeed = 70, raceName = "Fire Elementals", can = 15019, exp = 1000, money = 5000},

    ["Blazing Fire elemental"] = {storKill = 17310, goalNeed = 70, raceName = "Fire Elementals", can = 15019, exp = 1000, money = 5000},

    ["Blistering Fire elemental"] = {storKill = 17310, goalNeed = 70, raceName = "Fire Elementals", can = 15019, exp = 1000, money = 5000},

    ["Massive Fire elemental"] = {storKill = 17310, goalNeed = 70, raceName = "Fire Elementals", can = 15019, exp = 1000, money = 5000},



--[[ Djinns Race ]]-- 11

    ["Green Djinn"] = {storKill = 17311, goalNeed = 500, raceName = "Djinns", can = 15019, exp = 1000, money = 5000},

    ["Efreet"] = {storKill = 17311, goalNeed = 500, raceName = "Djinns", can = 15019, exp = 1000, money = 5000},

    ["Blue Djinn"] = {storKill = 17311, goalNeed = 500, raceName = "Djinns", can = 15019, exp = 1000, money = 5000},

    ["Marid"] = {storKill = 17311, goalNeed = 500, raceName = "Djinns", can = 15019, exp = 1000, money = 5000},



--[[ Pirates Race]]-- 12



    ["Pirate Buccaneer"] = {storKill = 17312, goalNeed = 3000, raceName = "Pirates", can = 15019, exp = 1000, money = 5000},

    ["Pirate Corsair"] = {storKill = 17312, goalNeed = 3000, raceName = "Pirates", can = 15019, exp = 1000, money = 5000},

    ["Pirate Cutthroat"] = {storKill = 17312, goalNeed = 3000, raceName = "Pirates", can = 15019, exp = 1000, money = 5000},

    ["Pirate Ghost"] = {storKill = 17312, goalNeed = 3000, raceName = "Pirates", can = 15019, exp = 1000, money = 5000},

    ["Pirate Marauder"] = {storKill = 17312, goalNeed = 3000, raceName = "Pirates", can = 15019, exp = 1000, money = 5000},

    ["Pirate Skeleton"] = {storKill = 17312, goalNeed = 3000, raceName = "Pirates", can = 15019, exp = 1000, money = 5000},





--[[ Magicians Race ]]-- 13

    ["Necromancer"] = {storKill = 17313, goalNeed = 1000, raceName = "Magicians", can = 15019, exp = 1000, money = 5000},

    ["Priestess"] = {storKill = 17313, goalNeed = 1000, raceName = "Magicians", can = 15019, exp = 1000, money = 5000},



--[[ Drakens Race ]]--     14

    ["Draken Abomination"] = {storKill = 17314, goalNeed = 300, raceName = "Ice Golems", can = 15019, exp = 1000, money = 5000},

    ["Draken Elite"] = {storKill = 17314, goalNeed = 300, raceName = "Ice Golems", can = 15019, exp = 1000, money = 5000},

    ["Draken Spellweaver"] = {storKill = 17314, goalNeed = 300, raceName = "Ice Golems", can = 15019, exp = 1000, money = 5000},

    ["Draptor"] = {storKill = 17314, goalNeed = 300, raceName = "Ice Golems", can = 15019, exp = 1000, money = 5000},





--[[ Lizards Race ]]--   15               

    ["Lizard Templar"] = {storKill = 17315, goalNeed = 300, raceName = "Lizards", can = 15019, exp = 1000, money = 5000},

    ["Lizard Snakecharmer"] = {storKill = 17315, goalNeed = 300, raceName = "Lizards", can = 15019, exp = 1000, money = 5000},

    ["Lizard Sentinel"] = {storKill = 17315, goalNeed = 300, raceName = "Lizards", can = 15019, exp = 1000, money = 5000},

    ["Wyvern"] = {storKill = 17315, goalNeed = 300, raceName = "Lizards", can = 15019, exp = 1000, money = 5000},





--[[ Dragons Race ]]-- 16

    ["Dragon"] = {storKill = 17316, goalNeed = 300, raceName = "Dragons", can = 15019, exp = 1000, money = 5000},

    ["Dragon Lord"] = {storKill = 17316, goalNeed = 300, raceName = "Dragons", can = 15019, exp = 1000, money = 5000},

    ["Dragon Hatchling"] = {storKill = 17316, goalNeed = 300, raceName = "Dragons", can = 15019, exp = 1000, money = 5000},

    ["Dragon Lord Hatchling"] = {storKill = 17316, goalNeed = 300, raceName = "Dragons", can = 15019, exp = 1000, money = 5000},

    ["Demodras"] = {storKill = 17316, goalNeed = 300, raceName = "Dragons", can = 15019, exp = 1000, money = 5000},

    ["Ghastly Dragon"] = {storKill = 17316, goalNeed = 300, raceName = "Dragons", can = 15019, exp = 1000, money = 5000},

    ["Undead Dragon"] = {storKill = 17316, goalNeed = 300, raceName = "Dragons", can = 15019, exp = 1000, money = 5000},



--[[ Nils Race ]]-- ?



    ["Demon"] = {storKill = 17317, goalNeed = 6666, raceName = "Demons", can = 15019, exp = 1000, money = 5000},

    ["Minotaur"] = {storKill = 17318, goalNeed = 5000, raceName = "Minotaurs", can = 15019, exp = 1000, money = 5000},

    ["Mutated Rat"] = {storKill = 17319, goalNeed = 200, raceName = "Mutated Rats", can = 15019, exp = 1000, money = 5000},

    ["Giant Spider"] = {storKill = 17320, goalNeed = 500, raceName = "Giant Spiders", can = 15019, exp = 1000, money = 5000},

    ["Hydra"] = {storKill = 17321, goalNeed = 2000, raceName = "Hydras", can = 15019, exp = 1000, money = 5000},

    ["Sea Serpent"] = {storKill = 17322, goalNeed = 2000, raceName = "Sea Serpents", can = 15019, exp = 1000, money = 5000},

    ["Behemoth"] = {storKill = 17323, goalNeed = 2000, raceName = "Behemoths", can = 15019, exp = 1000, money = 5000},

    ["Serpent Spawn"] = {storKill = 17324, goalNeed = 1500, raceName = "Serpents Spawn", can = 15019, exp = 1000, money = 5000},

    ["Crocodile"] = {storKill = 17325, goalNeed = 300, raceName = "Crocodiles", can = 15019, exp = 1000, money = 5000},

    ["Tarantula"] = {storKill = 17326, goalNeed = 300, raceName = "Tarantulas", can = 15019, exp = 1000, money = 5000},

    ["Carniphila"] = {storKill = 17327, goalNeed = 150, raceName = "Carniphilas", can = 15019, exp = 1000, money = 5000},

    ["Stone Golem"] = {storKill = 17328, goalNeed = 200, raceName = "Stone Golems", can = 15019, exp = 1000, money = 5000},

    ["Mammoth"] = {storKill = 17329, goalNeed = 300, raceName = "Mammoths", can = 15019, exp = 1000, money = 5000},

    ["Ice Golem"] = {storKill = 17330, goalNeed = 300, raceName = "Ice Golems", can = 15019, exp = 1000, money = 5000},



    ["Badger"] = {storKill = 17331, goalNeed = 250, raceName = "Badgers", can = 15019, exp = 1000, money = 5000},

    ["Terramite"] = {storKill = 17332, goalNeed = 100, raceName = "Terramites", can = 15019, exp = 1000, money = 5000},

    ["Gargoyle"] = {storKill = 17333, goalNeed = 700, raceName = "Gargoyles", can = 15019, exp = 1000, money = 5000},

    ["Ancient Scarab"] = {storKill = 17334, goalNeed = 220, raceName = "Ancient Scarabs", can = 15019, exp = 1000, money = 5000},

    ["Bonebeast"] = {storKill = 17335, goalNeed = 550, raceName = "Bonebeasts", can = 15019, exp = 1000, money = 5000},

    ["Crystal Spider"] = {storKill = 17336, goalNeed = 777, raceName = "Crystal Spiders", can = 15019, exp = 1000, money = 5000},

    ["Mutated Tiger"] = {storKill = 17337, goalNeed = 915, raceName = "Mutated Tigers", can = 15019, exp = 1000, money = 5000},

    ["Werewolf"] = {storKill = 17338, goalNeed = 242, raceName = "Werewolfs", can = 15019, exp = 1000, money = 5000},

    ["Nightmare"] = {storKill = 17339, goalNeed = 666, raceName = "Nightmares", can = 15019, exp = 1000, money = 5000},

    ["Mutated Bat"] = {storKill = 17340, goalNeed = 777, raceName = "Mutated Bats", can = 15019, exp = 1000, money = 5000},

    ["Lancer Beetle"] = {storKill = 17341, goalNeed = 400, raceName = "Lancer Beetles", can = 15019, exp = 1000, money = 5000},

    ["Kongra"] = {storKill = 17342, goalNeed = 500, raceName = "Kongras", can = 15019, exp = 1000, money = 5000},

    ["Tortoise"] = {storKill = 17343, goalNeed = 1000, raceName = "Tortoises", can = 15019, exp = 1000, money = 5000},

    ["Gnarlhound"] = {storKill = 17344, goalNeed = 1000, raceName = "Gnarlhounds", can = 15019, exp = 1000, money = 5000},

    ["Hellspawn"] = {storKill = 17345, goalNeed = 1000, raceName = "Hellspawns", can = 15019, exp = 1000, money = 5000},

    ["Killer Caiman"] = {storKill = 17346, goalNeed = 200, raceName = "Killer Caimans", can = 15019, exp = 1000, money = 5000},

    ["Stampor"] = {storKill = 17347, goalNeed = 215, raceName = "Stampos", can = 15019, exp = 1000, money = 5000},

    ["Brimstone Bug"] = {storKill = 17348, goalNeed = 1000, raceName = "Brimstone Bugs", can = 15019, exp = 1000, money = 5000},

    ["Medusa"] = {storKill = 17349, goalNeed = 750, raceName = "Medusas", can = 15019, exp = 1000, money = 5000},

    ["Destroyer"] = {storKill = 17350, goalNeed = 420, raceName = "Destroyers", can = 15019, exp = 1000, money = 5000},

    ["Hellhound"] = {storKill = 17351, goalNeed = 350, raceName = "Hellhounds", can = 15019, exp = 1000, money = 5000},

    ["Tiquanda Revenge"] = {storKill = 17352, goalNeed = 700, raceName = "Tiquandas Revenge", can = 15019, exp = 1000, money = 5000},

}

 

 

 

Demonstração

28jwn7b.jpg

É isso aêe galerinha, espero que tenham gostado e boa sorte :)

Editado por CyberBot
Link para o comentário
Compartilhar em outros sites

Obrigado pelas respostas galera.

 

#Gustavo,

Você quis dizer, tipo, poder fazer cada uma apenas uma vez na vida?

 

Sim, pois se eu não estou enganado (li meio por cima), o player pode fazer quantas vezes desejar a task, certo?

Link para o comentário
Compartilhar em outros sites

Eu uso o servidor devland 8,0 (DBKO 3.11), e não há sistema de tarefas não funciona, não há erros no console. Como entrar "/ task" ou "!Task" e não acontece nada, eu tenho que mudar em talkactions a "task" para que mais uma vez eu não posso usar a "task list" de comando. É que poderia ser feito para o NPC e não no comando?

Link para o comentário
Compartilhar em outros sites

Eu uso o servidor devland 8,0 (DBKO 3.11), e não há sistema de tarefas não funciona, não há erros no console. Como entrar "/ task" ou "!Task" e não acontece nada, eu tenho que mudar em talkactions a "task" para que mais uma vez eu não posso usar a "task list" de comando. É que poderia ser feito para o NPC e não no comando?

 

Cara, se você não quer task por comando, pode usar uma dessas alternativas:

http://www.xtibia.com/forum/topic/220239-tasks-diarias-e-por-level/ --> feita por mim

http://www.xtibia.com/forum/topic/151636-simple-task-30/ --> feita pelo Vodkart

Link para o comentário
Compartilhar em outros sites

  • 3 weeks later...
×
×
  • Criar Novo...