VO
creatureevent

Simple Task 3.0

Por Vodkart, 14 de fev. de 2011 em Globalevents e Spells

otserv
tibia
script
159
51.3k
melocomM
28 de abril de 2012 às 09:38

essa Simple Task 2.0 q vc fes tem como configura ela pra poder faser mais d uma por ves pq ali so da d pega 1 por ves

VodkartV
28 de abril de 2012 às 09:53

essa Simple Task 2.0 q vc fes tem como configura ela pra poder faser mais d uma por ves pq ali so da d pega 1 por ves

 

essa era á V1.0 '-'

 

vou te passar ela:

 

 

 

 

em Data/Lib crie um arquivo.lua e renomei para

 

 

SimpletaskLib.lua

tasktabble = {
["minotaur mage"] = {storage = 91001,count = 12,exp = 1000,reward = {{2656,1},{7730,1},{2152,20}}},
["orc spearman"] = {storage = 91002,count = 14,exp = 2000,reward = {{2152,50}}},
["cyclops"] = {storage = 91003,count = 25,exp = 4000,reward = {{2462,1},{2648,1},{2152,35}}},
["cave rat"] = {storage = 91004,count = 10,exp = 0,reward = {{2696,1},{2152,20}}},
["fire devil"] = {storage = 91005,count = 17,exp = 10000,reward = {{2160,2},{2491,1},{2488,1}}},
["orc warrior"] = {storage = 91006,count = 28,exp = 0,reward = {{2152,25}}},
["slime"] = {storage = 91007,count = 18,exp = 15000,reward = {{2160,1},{2477,1}}},
["beholder"] = {storage = 91008,count = 40,exp = 0,reward = {{2160,2},{2518,1}}},
["dragon hatchling"] = {storage = 91009,count = 45,exp = 20000,reward = {{2475,1},{2187,1}}},
["wyvern"] = {storage = 91010,count = 55,exp = 0,reward = {{2519,1},{2160,2}}},
["fire elemental"] = {storage = 91011,count = 60,exp = 0,reward = {{2392,1},{2160,5}}},
["blue djinn"] = {storage = 91012,count = 64,exp = 0,reward = {{2160,10},{2451,1}}},
["demon skeleton"] = {storage = 91013,count = 45,exp = 0,reward = {{2498,2},{2152,30}}},
["dragon"] = {storage = 91014,count = 80,exp = 25000,reward = {{2516,1},{7457,2},{2160,4}}},
["dragon lord"] = {storage = 91015,count = 95,exp = 101321,reward = {{7402,1},{2537,1}}},
["vampire"] = {storage = 91016,count = 50,exp = 60000,reward = {{2534,1},{2197,1}}},
["crystal spider"] = {storage = 91017,count = 45,exp = 30000,reward = {{2160,25},{8920,1}}},
["earth elemental"] = {storage = 91018,count = 80,exp = 80000,reward = {{2160,10},{11114,1}}},
["hero"] = {storage = 91019,count = 72,exp = 0,reward = {{2487,1},{2491,1}}},
["avalanche"] = {storage = 91020,count = 83,exp = 0,reward = {{8851,2}}},
["giant spider"] = {storage = 91021,count = 97,exp = 150000,reward = {{2536,1},{2160,13}}},
["fury"] = {storage = 91022,count = 105,exp = 0,reward = {{6500,35},{2414,1}}},
["orc warlord"] = {storage = 91023,count = 74,exp = 98574,reward = {{7414,1}}},
["green djinn"] = {storage = 91024,count = 65,exp = 123125,reward = {{2656,1},{7730,1},{2152,20}}},
["demon"] = {storage = 91025,count = 400,exp = 7500000,reward = {{2160,80},{2495,1},{2496,1},{2520,1},{2472,1}}},
["hydra"] = {storage = 91026,count = 295,exp = 2500000,reward = {{2160,50},{6433,1},{7434,1},{2197,1},{2476,1}}},
["frost dragon"] = {storage = 91027,count = 330,exp = 5246300,reward = {{2396,1},{2492,1},{2160,100}}},
["warlock"] = {storage = 91028,count = 210,exp = 27393800,reward = {{8918,1},{2206,1},{2173,1},{2160,100}}},
["medusa"] = {storage = 91029,count = 152,exp = 1639300,reward = {{2542,1},{7403,1},{2536,1},{2160,65}}},
["grim reaper"] = {storage = 91030,count = 350,exp = 38124230,reward = {{2160,70},{2474,1},{8927,1},{6433,1}}},
["undead dragon"] = {storage = 91031,count = 200,exp = 2219180,reward = {{2160,80},{2514,1},{2466,1}}},
["ferumbras"] = {storage = 91032,count = 7,exp = 5246300,reward = {{2472,1},{8925,1},{8904,1},{5903,1},{2160,100}}},
["orshabaal"] = {storage = 91033,count = 20,exp = 7915800,reward = {{2469,1},{2472,1},{2393,1},{2160,100}}},
["morgaroth"] = {storage = 91034,count = 10,exp = 15694800,reward = {{2523,1},{2415,1},{2160,100}}},
["ghazbaran"] = {storage = 91035,count = 20,exp = 15694800,reward = {{2494,1},{2408,1},{2390,1},{2160,100}}},
["minishabaal"] = {storage = 91036,count = 243,exp = 1118190,reward = {{2470,1},{2466,1},{7753,1},{2160,70}}},
["diabolic imp"] = {storage = 91037,count = 163,exp = 2125150,reward = {{9776,1},{7418,1},{2421,1},{2160,68}}},
["juggernaut"] = {storage = 91038,count = 45,exp = 24858000,reward = {{2506,1},{2522,1},{2160,90}}},
["behemoth"] = {storage = 91039,count = 147,exp = 3138470,reward = {{6391,1},{5741,1},{2160,65}}}
}
function finisheAllTask(cid)
local x = true
for k, v in pairs(tasktabble) do
if tonumber(getPlayerStorageValue(cid,v.storage)) then
x = false
end
end
if x == true then
local b = getGlobalStorageValue(63004) if b == -1 then b = 1 end
if b < 11 then
setGlobalStorageValue(63004,b+1)
doBroadcastMessage('[Task Mission Complete] '..getCreatureName(cid)..' was the '..b..'° to finish the task!.')
doPlayerAddPremiumDays(cid, 10)
doItemSetAttribute(doPlayerAddItem(cid, 7369), "name", "trophy of the 10 firsts finish all task")
end
end
end
function getItemsInContainerById(container, itemid) -- Function By Kydrai
           local items = {}
           if isContainer(container) and getContainerSize(container) > 0 then
                           for slot=0, (getContainerSize(container)-1) do
                                           local item = getContainerItem(container, slot)
                                           if isContainer(item.uid) then
                                                           local itemsbag = getItemsInContainerById(item.uid, itemid)
                                                           for i=0, #itemsbag do
                                                                           table.insert(items, itemsbag[i])
                                                           end
                                           else
                                                           if itemid == item.itemid then
                                                                           table.insert(items, item.uid)
                                                           end
                                           end
                           end
           end
           return items
end
function doPlayerAddItemStacking(cid, itemid, quant) -- by mkalo
   local item = getItemsInContainerById(getPlayerSlotItem(cid, 3).uid, itemid)
   local piles = 0
   if #item > 0 then
           for i,x in pairs(item) do
                   if getThing(x).type < 100 then
                           local it = getThing(x)
                           doTransformItem(it.uid, itemid, it.type+quant)
                           if it.type+quant > 100 then
                                   doPlayerAddItem(cid, itemid, it.type+quant-100)
                           end
                   else
                          piles = piles+1
                   end
           end
   else
           return doPlayerAddItem(cid, itemid, quant)
   end
   if piles == #item then
           doPlayerAddItem(cid, itemid, quant)
   end
end
function getItemsFromList(items) -- by vodka
local str = ''
if table.maxn(items) > 0 then
for i = 1, table.maxn(items) do
str = str .. items[i][2] .. ' ' .. getItemNameById(items[i][1])
if i ~= table.maxn(items) then str = str .. ', ' end end end
return str
end
function doAddItemsFromList(cid,items) -- by vodka
if table.maxn(items) > 0 then
for i = 1, table.maxn(items) do
local count = items[i][2]
while count > 0 do
if isItemStackable(items[i][1]) then
doPlayerAddItemStacking(cid, items[i][1], 1)
else
doPlayerAddItem(cid, items[i][1],1)
end
count = count - 1
end
end
end
end
       function pairsByKeys(t, f)
         local a = {}
         for n in pairs(t) do table.insert(a, n) end
         table.sort(a, f)
         local i = 0
         local iter = function ()
               i = i + 1
               if a[i] == nil then return nil
               else return a[i], t[a[i]]
               end
         end
         return iter
       end

 

 

 

 

 

Creaturescript

 

 

taskcount.lua

function onKill(cid, target)
if(isMonster(target) == TRUE) then
local n = getCreatureName(target)
local name_monster = tasktabble[string.lower(n)]
if(name_monster) then
local contagem = getPlayerStorageValue(cid, name_monster.storage)
if (contagem == -1) then contagem = 1 end
if not tonumber(contagem) then return true end
if contagem > name_monster.count then return true end
setPlayerStorageValue(cid, name_monster.storage, contagem+1)
if contagem == name_monster.count then
doPlayerSendTextMessage(cid, 18, "Congratulations! You finished the task of "..n)
end
end
end
return TRUE
end

 

creaturescript/script/login.lua

registerCreatureEvent(cid, "task_count")

 

creaturescript.xml

<event type="kill" name="task_count" script="taskcount.lua"/>

 

 

 

 

Talkactions

 

 

Talkactions/script

 

task_complete.lua

function onSay(cid, words, param)
local str = ""
str = str .. "Task Completed :\n\n"
for k, v in pairsByKeys(tasktabble) do
local contagem = getPlayerStorageValue(cid, v.storage)
if (contagem == -1) then contagem = 1 end
str = str..k.." = ".. (not tonumber(contagem) and "["..contagem.."]" or "["..((contagem)-1).."/"..v.count.."]") .."\n"
end
str = str .. ""
return doShowTextDialog(cid, 8983, str)
end

 

talkactions.xml

<talkaction words="!task" script="task_complete.lua"/>

 

 

 

NPC

 

 

NPC/SCRIPT

 

simple_task.lua

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, 'task') or msgcontains(msg, 'TASK'))then
npcHandler:say("say the name of the task that you completed to receive your reward!", cid)
talkState[talkUser] = 1
elseif talkState[talkUser] == 1 then
local msg = string.lower(msg)
if tasktabble[msg] then
local contagem = getPlayerStorageValue(cid, tasktabble[msg].storage)
if (contagem == -1) then contagem = 1 end
if not tonumber(contagem) then npcHandler:say('You can only receive the reward once!', cid) return true end
if (((contagem)-1) >= tasktabble[msg].count) then
doPlayerAddExp(cid, tasktabble[msg].exp)
doAddItemsFromList(cid,tasktabble[msg].reward)
setPlayerStorageValue(cid, tasktabble[msg].storage, "Finished")
npcHandler:say('Thanks for your help,you won: '..getItemsFromList(tasktabble[msg].reward)..' to finish the task of '..msg, cid)
finisheAllTask(cid)
else
npcHandler:say('Sorry,but you still only killed '..((contagem)-1)..' '..msg, cid)
end
else
npcHandler:say('enter the correct name of the monster!', cid)
end
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

NPC/

 

Ludger.xml

<?xml version="1.0"?>
<npc name="Ludger" script="data/npc/scripts/simple_task.lua" walkinterval="50000" floorchange="0">
<health now="100" max="100"/>
<look type="129" head="95" body="116" legs="121" feet="115" addons="3"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|.I have some {task} for you!" />
</parameters>
</npc>

 

 

 

 

melocomM
28 de abril de 2012 às 12:26

vo testa e ja te do rep

LeoxtibiaL
03 de maio de 2012 às 22:18

Esse script só tem um probleminha: Monstros sumonados também contam para a task. Exemplo: Task de Minotaur, os players podem sumonar e com isso completam a task. Ou, minishabaals sumonando diabolic imps e ao matar os imps, contam para a task. Porém, não acho isso muito importante já que as tasks melhores são as de high level e ninguém pode sumonar ^^. Só estou falando isso para aperfeiçoar o sistema ainda mais. Parabéns de novo pelo seu trabalho ^^

VodkartV
03 de maio de 2012 às 22:30

obrigado por avisar, é fácil remover esse problema, acho que nem é um problema mas irei remover mesmo assim!

obrigado

DenuvoD
04 de maio de 2012 às 19:46

mano perfeito.. configurei pro meu ot de pokémon testei.. funciona perfeitamente :D THX VODKART! REP+

Editado Maio 4 por ChuckNorris666

2 meses depois...
VodkartV
09 de julho de 2012 às 21:10

Atualizado para V3.0

mais informações na descrição do tópico

joao33J
10 de julho de 2012 às 15:29

REP + VODKART JA ESTOU USANDO EM MEU OT E TA UM SUCESSO KK :)

12 de julho de 2012 às 08:44

seria bem melhor se desse pra ver no quest log do que no comando, ficaria bem mais legal...

VodkartV
12 de julho de 2012 às 12:54

sim, mas eu não estou com saco para ficar editando ali no quest log, quem quiser que coloque

o que não falta é tutorial ensinando

2 semanas depois...
TchubakaT
21 de julho de 2012 às 11:59

ai vodkart queria por bixos propios do meu ot invez desses e so mudar certo?

e nao queria isso axo. meu ot e de xp alta com resets vocations..

configbosses_task = {
{race = "minotaur",Playerpos = {x = 189, y = 57, z = 7}, FromPosToPos = {{x = 186, y = 54, z = 7},{x = 193, y = 60, z = 7}},time = 5},
{race = "necromancer",Playerpos = {x = 196, y = 39, z = 7}, FromPosToPos = {{x = 195, y = 37, z = 7},{x = 198, y = 41, z = 7}}, time = 5},
{race = "dragon",Playerpos = {x = 208, y = 59, z = 7}, FromPosToPos = {{x = 206, y = 56, z = 7},{x = 209, y = 65, z = 7}}, time = 5}
}

joao33J
21 de julho de 2012 às 15:09

s amigo é assim mesmo vc muda ai + veja que ai é a race do bicho entao acima no script vai ter o race la vc vai ter q editar os races tbm

 

Exemplo

 

La em cima ta ghazbaran vc precisa mata 10000 ai ta la race Demonio ai vc poe race demonio ali onde é o boss do ghazbaran

entende

 

Eu acho q é isso amigo pq n to com o script aqui manda pm se n der certo q eu vejo certinho

VodkartV
21 de julho de 2012 às 15:21

ai vodkart queria por bixos propios do meu ot invez desses e so mudar certo?

e nao queria isso axo. meu ot e de xp alta com resets vocations..

configbosses_task = {
{race = "minotaur",Playerpos = {x = 189, y = 57, z = 7}, FromPosToPos = {{x = 186, y = 54, z = 7},{x = 193, y = 60, z = 7}},time = 5},
{race = "necromancer",Playerpos = {x = 196, y = 39, z = 7}, FromPosToPos = {{x = 195, y = 37, z = 7},{x = 198, y = 41, z = 7}}, time = 5},
{race = "dragon",Playerpos = {x = 208, y = 59, z = 7}, FromPosToPos = {{x = 206, y = 56, z = 7},{x = 209, y = 65, z = 7}}, time = 5}
}

 

essas ai é o nome da task que ai ter boss, para editar os bixos que vai ter que matar é na outra tabela!

TchubakaT
21 de julho de 2012 às 17:20

sim, e que meu ot e igual o rozin. exp alta.

ai eu ia por so task de matar bixos. nao boss.

ai ia por umas parada maneira. esse systema de task da vodkart ta de parabens.

bem explicado gostei mt.

rodrygososR
22 de julho de 2012 às 18:40

Vodkart tem como eu configurar para ela da a permissão para fazer a demon oak?