Hello,
I have a task system that doesn't count monsters killed.
I've tried a lot of mods and scripts and none of them in my opinion counts monsters as a task ...
Can anyone see if the mod is ok?
I have a task system that doesn't count monsters killed.
I've tried a lot of mods and scripts and none of them in my opinion counts monsters as a task ...
Can anyone see if the mod is ok?
XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Tasks" version="4.1" author="Collocorpusek" contact="otland.net" enabled="yes">
<config name="task_config">
<![CDATA[
taskConfig = {
taskStorage = 5469, -- wolne storage
vipStorage = 55888,
potion = {
[1] = {storage = 11093, doneStorage = 11094, uses = 36000, minLevel = 200, exp = 10000, items = {{2160, 5}, {7488, 1}}},
[2] = {storage = 11095, doneStorage = 11096, uses = 36000, minLevel = 200, exp = 10000, items = {{2160, 5}, {7488, 1}}},
[3] = {storage = 11097, doneStorage = 11098, uses = 36000, minLevel = 200, exp = 10000, items = {{2160, 5}, {8205, 1}}},
[4] = {storage = 11099, doneStorage = 11100, uses = 36000, minLevel = 200, exp = 10000, items = {{2160, 5}, {8474, 1}}}
},
superPotion = {
[1] = {storage = 111101, doneStorage = 111102, uses = 200000, minLevel = 300, exp = 10000000, potion = 9930},
[2] = {storage = 111103, doneStorage = 111104, uses = 200000, minLevel = 300, exp = 10000000, potion = 9930},
[3] = {storage = 111105, doneStorage = 111106, uses = 200000, minLevel = 300, exp = 10000000, potion = 9930},
[4] = {storage = 111107, doneStorage = 111108, uses = 200000, minLevel = 300, exp = 10000000, potion = 9930}
}
}
taskMonsters = {
["rotworm queen"] = {storage = 11101, doneStorage = 11102, kills = 250, minLevel = 1, exp = 10000, items = {{2160, 10}, {2160, 10}}, vip = false},
["dragon"] = {storage = 11103, doneStorage = 11104, kills = 2500, minLevel = 1, exp = 1070100, items = {{2160, 50}, {2498, 1}, {2492, 1}}, vip = false},
["dragon lord"] = {storage = 11105, doneStorage = 11106, kills = 4000, minLevel = 1, exp = 3605100, items = {{2160, 80}, {6132, 1}, {8306, 1}}, vip = false},
["hero"] = {storage = 11107, doneStorage = 11108, kills = 5000, minLevel = 1, exp = 1070100, items = {{2160, 30}, {2491, 1}, {2487, 1}, {2488, 1}, {2519, 1}}, vip = false},
["black knight"] = {storage = 11109, doneStorage = 11110, kills = 5000, minLevel = 1, exp = 1605100, items = {{2160, 80}, {7720, 1}, {2496, 1}}, vip = false},
["behemoth"] = {storage = 11111, doneStorage = 11112, kills = 3000, minLevel = 1, exp = 3605100, items = {{2160, 80}, {6132, 1}, {8306, 1}}, vip = false},
["enlightened of the cult"] = {storage = 11113, doneStorage = 11114, kills = 1000, minLevel = 1, exp = 3905900, items = {{2160, 50}, {9941, 1}}, vip = false},
["bog raider"] = {storage = 11115, doneStorage = 11116, kills = 1550, minLevel = 1, exp = 2605100, items = {{2160, 45}, {2506, 1}}, vip = false},
["cyclops smith"] = {storage = 11117, doneStorage = 11118, kills = 150, minLevel = 1, exp = 30000, items = {{2160, 5}, {2160, 5}}, vip = false},
["destroyer"] = {storage = 11119, doneStorage = 11120, kills = 1050, minLevel = 1, exp = 2000000, items = {{2160, 15}, {7722, 3}}, vip = false},
["diabolic imp"] = {storage = 11121, doneStorage = 11122, kills = 11000, minLevel = 200, exp = 9168750, items = {{2160, 100}, {7735, 1}, {2346, 1}, {9932, 1}}, vip = false},
["old mad pumpkin"] = {storage = 11125, doneStorage = 11126, kills = 1, minLevel = 250, exp = 13000000, items = {{2160, 100}, {2346, 2}, {9693, 1}}, vip = true},
["ferumbras"] = {storage = 11127, doneStorage = 11128, kills = 6000, minLevel = 1, exp = 3451000, items = {{2160, 35}, {8300, 1}}, vip = false},
["fury"] = {storage = 11129, doneStorage = 11130, kills = 3600, minLevel = 1, exp = 4456000, items = {{2160, 25}, {11302, 1}}, vip = false},
["evolution fury"] = {storage = 11131, doneStorage = 11132, kills = 25, minLevel = 1, exp = 10000000, items = {{2160, 60}, {2160, 50}, {8865, 1}, {8890, 1}}, vip = true},
["ghastly dragon"] = {storage = 11133, doneStorage = 11134, kills = 2500, minLevel = 1, exp = 600000, items = {{11301, 1}, {11304, 1}}, vip = false},
["grim reaper"] = {storage = 11135, doneStorage = 11136, kills = 5550, minLevel = 1, exp = 8685450, items = {{2160, 80}, {7958, 1}}, vip = false},
["giant spider"] = {storage = 11137, doneStorage = 11138, kills = 15000, minLevel = 1, exp = 3605100, items = {{2160, 80}, {6132, 1}, {8306, 1}}, vip = false},
["hand of cursed fate"] = {storage = 11139, doneStorage = 11140, kills = 2300, minLevel = 1, exp = 9500000, items = {{2160, 15}, {8266, 1}}, vip = false},
["hellfire fighter"] = {storage = 11141, doneStorage = 11142, kills = 5000, minLevel = 1, exp = 7500000, items = {{2160, 40}, {9776, 1}, {9693, 1}}, vip = false},
["hellspawn"] = {storage = 11143, doneStorage = 11144, kills = 3000, minLevel = 1, exp = 2000100, items = {{2160, 10}, {8306, 1}}, vip = false},
["hydra"] = {storage = 11145, doneStorage = 11146, kills = 9000, minLevel = 1, exp = 5550000, items = {{2160, 30}, {3983, 1}, {2469, 1}}, vip = false},
["ice golem"] = {storage = 11147, doneStorage = 11148, kills = 1000, minLevel = 1, exp = 3605100, items = {{2160, 60}, {8306, 1}, {8300, 1}}, vip = false},
["infernalist"] = {storage = 11149, doneStorage = 11150, kills = 2550, minLevel = 1, exp = 6000000, items = {{2160, 20}, {2157, 15}}, vip = false},
["juggernaut"] = {storage = 11151, doneStorage = 11152, kills = 500, minLevel = 200, exp = 11000000, items = {{2160, 80}, {7422, 1}, {2390, 1}, {8888, 1}}, vip = false},
["morgaroth"] = {storage = 11153, doneStorage = 11154, kills = 50, minLevel = 200, exp = 12500000, items = {{2160, 90}, {9777, 1}, {8300, 2}}, vip = false},
["medusa"] = {storage = 11155, doneStorage = 11156, kills = 7000, minLevel = 1, exp = 5550000, items = {{2160, 20}, {8850, 1}}, vip = false},
["pelzacz"] = {storage = 11157, doneStorage = 11158, kills = 50, minLevel = 300, exp = 14000000, items = {{2160, 70}, {2157, 15}, {8300, 5}, {2644, 1}}, vip = false},
["hellhound"] = {storage = 11159, doneStorage = 11160, kills = 5500, minLevel = 1, exp = 8000000, items = {{2160, 40}, {7450, 1}}, vip = false},
["plaguesmith"] = {storage = 11161, doneStorage = 11162, kills = 2500, minLevel = 1, exp = 6355000, items = {{2160, 15}, {8925, 1}}, vip = false},
["predator"] = {storage = 11163, doneStorage = 11164, kills = 1, minLevel = 300, exp = 25000000, items = {{2160, 100}, {2157, 25}, {8300, 5}, {9941, 5}, {9693, 2}}, vip = true},
["rook spawn"] = {storage = 11165, doneStorage = 11166, kills = 50, minLevel = 1, exp = 11000000, items = {{2160, 20}, {8903, 1}, {2346, 2}}, vip = false},
["serpent spawn"] = {storage = 11167, doneStorage = 11168, kills = 2000, minLevel = 1, exp = 7605100, items = {{2160, 10}, {8306, 1}}, vip = false},
["undead dragon"] = {storage = 11169, doneStorage = 11170, kills = 3000, minLevel = 1, exp = 8500000, items = {{2160, 75}, {6433, 1}, {7720, 1}}, vip = false},
["warlock"] = {storage = 11171, doneStorage = 11172, kills = 3000, minLevel = 1, exp = 6000000, items = {{2160, 20}, {2157, 15}}, vip = false},
["demon"] = {storage = 11173, doneStorage = 11174, kills = 5000, minLevel = 1, exp = 9505100, items = {{2160, 80}, {6529, 1}, {10518, 1}, {2346, 2}}, vip = false},
["yeti"] = {storage = 11175, doneStorage = 11176, kills = 2500, minLevel = 1, exp = 11000000, items = {{2160, 30}, {9778,1}, {2346, 1}, {6132, 1}}, vip = false},
["azerus"] = {storage = 11177, doneStorage = 11178, kills = 50, minLevel = 1, exp = 15000000, items = {{2160, 10}, {9778, 1}, {9776, 1}, {9777, 1}, {2157, 10}}, vip = false},
["wyrm"] = {storage = 11179, doneStorage = 11180, kills = 3000, minLevel = 1, exp = 3000000, items = {{2160, 20}, {8908, 1}}, vip = false},
["defiler"] = {storage = 11181, doneStorage = 11182, kills = 5550, minLevel = 1, exp = 8000000, items = {{2160, 70}, {8909, 1}, {8300, 2}}, vip = false},
["nightmare"] = {storage = 11183, doneStorage = 11184, kills = 8000, minLevel = 1, exp = 8000000, items = {{2160, 35}, {6391, 1}}, vip = false}
}
]]>
</config>
<talkaction words="!task" event="script">
<![CDATA[
domodlib('task_config')
function onSay(cid, words, param)
local currentTask, tasks = '', {}
for k, v in pairs(taskMonsters) do
if getCreatureStorage(cid, taskConfig.taskStorage) == k then
currentTask = k
end
table.insert(tasks, k)
end
param = param:lower()
if param == '' then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, '[TASK]\n"!task info" - check your current task\n"!task TaskName" - start new task\n"!task off" - stop current task')
elseif param == 'info' then
local t = (getPlayerVocation(cid) - 4 > 0) and taskConfig.potion[getPlayerVocation(cid)-4] or taskConfig.potion[getPlayerVocation(cid)]
if currentTask ~= '' then
local task, text = taskMonsters[currentTask], ''
if getCreatureStorage(cid, t.doneStorage) == 0 and getCreatureStorage(cid, t.storage) >= 0 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, '[TASK INFO] You are doing potion task and you have used them '..getCreatureStorage(cid, t.storage)..' of '..t.uses..'.')
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, '[TASK INFO] You are doing '..currentTask..' task. You killed '..getCreatureStorage(cid, task.storage)..' of '..task.kills..' this kind of monsters.'..text)
else
if getCreatureStorage(cid, t.doneStorage) == 0 and getCreatureStorage(cid, t.storage) >= 0 then
return true, doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, '[TASK INFO] You are doing potion task and you have used them '..getCreatureStorage(cid, t.storage)..' of '..t.uses..'.')
end
doPlayerSendCancel(cid, 'You are not in any task.')
end
elseif param == 'off' then
if currentTask == '' then
return doPlayerSendCancel(cid, 'You are not in any task.')
end
doCreatureSetStorage(cid, taskConfig.taskStorage, '')
doCreatureSetStorage(cid, taskMonsters[currentTask].storage, 0)
doCreatureSetStorage(cid, taskMonsters[currentTask].doneStorage, 0)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, '[TASK] You stopped currently '..currentTask..' task. You can now start other task.')
elseif param == 'potion' then
local p = (getPlayerVocation(cid) - 4 > 0) and taskConfig.potion[getPlayerVocation(cid)-4] or taskConfig.potion[getPlayerVocation(cid)]
if getCreatureStorage(cid, p.doneStorage) == 1 then
return doPlayerSendCancel(cid, 'You arleady done this kind of tasks.')
elseif p.minLevel > getPlayerLevel(cid) then
return doPlayerSendCancel(cid, 'You don\'t have enough level.')
end
if getCreatureStorage(cid, p.storage) < 0 then
doCreatureSetStorage(cid, p.storage, 0)
doCreatureSetStorage(cid, p.doneStorage, 0)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, '[TASK] You have started potion task. You have to use '..p.uses..' potions. Good luck!')
else
doCreatureSetStorage(cid, p.storage, -1)
doPlayerSendCancel(cid, 'Currently you are doing this task.')
end
elseif param == 'superpotion' then
local p = (getPlayerVocation(cid) - 4 > 0) and taskConfig.superPotion[getPlayerVocation(cid)-4] or taskConfig.superPotion[getPlayerVocation(cid)]
local normal_p = (getPlayerVocation(cid) - 4 > 0) and taskConfig.potion[getPlayerVocation(cid)-4] or taskConfig.potion[getPlayerVocation(cid)]
if getCreatureStorage(cid, normal_p.doneStorage) < 1 then
return doPlayerSendCancel(cid, 'You have to finish normal potion task until you start new one.')
elseif getCreatureStorage(cid, p.doneStorage) == 1 then
return doPlayerSendCancel(cid, 'You arleady done this kind of tasks.')
elseif p.minLevel > getPlayerLevel(cid) then
return doPlayerSendCancel(cid, 'You don\'t have enough level.')
end
if getCreatureStorage(cid, p.storage) < 0 then
doCreatureSetStorage(cid, p.storage, 0)
doCreatureSetStorage(cid, p.doneStorage, 0)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, '[TASK] You have started super potion task. You have to use '..p.uses..' potions. Good luck!')
else
doCreatureSetStorage(cid, p.storage, -1)
doPlayerSendCancel(cid, 'Currently you are doing this task.')
end
elseif isInArray(tasks, param) then
if currentTask ~= '' then
return doPlayerSendCancel(cid, 'Currently you are doing '..currentTask..' task. You can stop it typing "!taskoff".')
elseif taskMonsters[param].minLevel > getPlayerLevel(cid) then
return doPlayerSendCancel(cid, 'You do not have required '..taskMonsters[param].minLevel..' level to start this task.')
elseif taskMonsters[param].vip and getCreatureStorage(cid, taskConfig.vipStorage) < 1 then
return doPlayerSendCancel(cid, 'You have to be vip to start this task.')
elseif getCreatureStorage(cid, taskMonsters[param].doneStorage) == 1 then
return doPlayerSendCancel(cid, 'You arleady done task with '..param..'s.')
end
doCreatureSetStorage(cid, taskConfig.taskStorage, param)
doCreatureSetStorage(cid, taskMonsters[param].storage, 0)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, '[TASK] You have started '..param..' task. You have to kill '..taskMonsters[param].kills..' '..param..'s. Good luck!')
else
doPlayerSendCancel(cid, 'Type your param propely or type: "!task".')
end
return true
end
]]>
</talkaction>
<event type="kill" name="task_kill" event="script">
<![CDATA[
domodlib('task_config')
function onKill(cid, target, damage, flags)
if bit.band(flags, 1) == 1 and isMonster(target) then
if isPlayer(cid) then
if getCreatureStorage(cid, taskConfig.taskStorage) == getCreatureName(target):lower() then
local task = taskMonsters[getCreatureName(target):lower()]
if getCreatureStorage(cid, task.storage) + 1 >= task.kills then
doCreatureSetStorage(cid, taskConfig.taskStorage, '')
doCreatureSetStorage(cid, task.storage, task.kills)
doCreatureSetStorage(cid, task.doneStorage, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, '[TASK] You have finished task. You have killed enough '..getCreatureName(target):lower()..'s and you got a reward.')
doPlayerAddExperience(cid, task.exp)
local backpack = doPlayerAddItem(cid, 11244, 1)
for k, v in ipairs(task.items) do
doAddContainerItem(backpack, v[1], v[2])
end
else
doCreatureSetStorage(cid, task.storage, math.max(0, getCreatureStorage(cid, task.storage)) + 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, '[TASK] You killed '..getCreatureStorage(cid, task.storage)..'/'..task.kills..' '..getCreatureName(target):lower()..'s.')
end
end
end
end
return true
end
]]>
</event>
<event type="login" name="task_login" event="buffer">
<![CDATA[
registerCreatureEvent(cid, 'task_kill')
]]>
</event>
</mod>