saw what happens, u guys are right. In my task storage must be a number, but special caracter like "↓■" there, why this happens?I'm 99% sure there is a console error either when starting the server or when killing the monster
maybe show the files related then to it! instead of just asking WHY THIS HAPPEN. we don't know code we can't See errorsaw what happens, u guys are right. In my task storage must be a number, but special caracter like "↓■" there, why this happens?
This is my task.xmlmaybe show the files related then to it! instead of just asking WHY THIS HAPPEN. we don't know code we can't See error
<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Simple Task" version="4.0" author="Vodkart" contact="tibiaking.com" enabled="yes">
<config name="task_func"><![CDATA[
task_sys = {
[1] = {name = "Trolls", start = 176201, monsters_list = {"Troll"}, level = 8, count = 40, points = 0, items = {}, reward = {}, exp = 20000, money = 2000},
[2] = {name = "rotworms", start = 176202, monsters_list = {"rotworm"}, level = 12, count = 50, points = 0, items = {}, reward = {}, exp = 25000, money = 3000},
[3] = {name = "Minotaurs", start = 176216, monsters_list = {"minotaur","minotaur guard","minotaur archer","minotaur mage"}, level = 15, count = 150, points = 1, items = {}, reward = {}, exp = 30000, money = 10000},
[4] = {name = "cyclops", start = 176203, monsters_list = {"cyclops"}, level = 19, count = 60, points = 1, items = {}, reward = {{2486,1}}, exp = 30000, money = 3000},
[5] = {name = "Green Djinn", start = 176204, monsters_list = {"Green Djinn","Efreet"}, level = 23, count = 80, points = 1, items = {}, reward = {}, exp = 100000, money = 5000},
[6] = {name = "Blue Djinn", start = 176205, monsters_list = {"Blue Djinn","Marid"}, level = 25, count = 80, points = 1, items = {}, reward = {}, exp = 100000, money = 5000},
[7] = {name = "Terror Birds", start = 176206, monsters_list = {"Terror Bird"}, level = 30, count = 120, points = 2, items = {}, reward = {}, exp = 100000, money = 5000},
[8] = {name = "Stone Golems", start = 176207, monsters_list = {"Stone Golem"}, level = 33, count = 130, points = 3, items = {}, reward = {}, exp = 120000, money = 7000},
[9] = {name = "Carniphilas", start = 176208, monsters_list = {"carniphila"}, level = 36, count = 135, points = 3, items = {}, reward = {}, exp = 80000, money = 8000},
[10] = {name = "Elephants", start = 176209, monsters_list = {"elephant"}, level = 40, count = 150, points = 2, items = {}, reward = {}, exp = 120000, money = 8200},
[11] = {name = "Dwarves", start = 176210, monsters_list = {"dwarf","dwarf soldier","dwarf guard","dwarf geomancer"}, level = 42, count = 150, points = 3, items = {}, reward = {}, exp = 200000, money = 15000},
[12] = {name = "Vampires", start = 176211, monsters_list = {"vampire"}, level = 46, count = 170, points = 2, items = {}, reward = {}, exp = 80000, money = 8500},
[13] = {name = "Dragons", start = 176212, monsters_list = {"dragon"}, level = 50, count = 120, points = 1, items = {}, reward = {}, exp = 90000, money = 9000},
[14] = {name = "Necromancer" ,start = 176213, monsters_list = {"Necromancer"}, level = 60, count = 200, points = 3, items = {}, reward = {}, exp = 200000, money = 15000},
[15] = {name = "Bonebeasts" ,start = 176214, monsters_list = {"Bonebeast"}, level = 63, count = 250, points = 3, items = {}, reward = {}, exp = 250000, money = 11000},
[16] = {name = "Giant Spider" ,start = 176215, monsters_list = {"Giant Spider","The old widow"}, level = 80, count = 500, points = 0, items = {}, reward = {}, exp = 200000, money = 32000},
[17] = {name = "Dragon Lords" ,start = 176219, monsters_list = {"Dragon lord"}, level = 88, count = 650, points = 3, items = {}, reward = {}, exp = 30000, money = 35000},
[18] = {name = "Hydras" ,start = 176222, monsters_list = {"Hydra"}, level = 100, count = 700, points = 3, items = {{4850,10}}, reward = {}, exp = 400000, money = 40000},
[19] = {name = "Serpent Spawn" ,start = 176223, monsters_list = {"Serpent Spawn"}, level = 103, count = 720, points = 4, items = {{2445,1}}, reward = {}, exp = 500000, money = 45000},
[20] = {name = "Behemoths" ,start = 176224, monsters_list = {"Behemoth"}, level = 108, count = 800, points = 4, items = {}, reward = {}, exp = 5000000, money = 200000},
[21] = {name = "Demons" ,start = 176225, monsters_list = {"Demon"}, level = 110, count = 6666, points = 4, items = {}, reward = {{2495,1}}, exp = 6660000, money = 500000},
[22] = {name = "Orshabaals" ,start = 176226, monsters_list = {"Orshabaal"}, level = 120, count = 300, points = 5, items = {}, reward = {{2341,1},{5114,1}}, exp = 9960000, money = 800000},
[23] = {name = "Ferumbras" ,start = 176227, monsters_list = {"Ferumbras"}, level = 130, count = 50, points = 5, items = {}, reward = {{2345,1}}, exp = 6660000, money = 666000},
[24] = {name = "Golden Knights" ,start = 176228, monsters_list = {"Golden Knight"}, level = 200, count = 10, points = 10, items = {}, reward = {{2646,1}}, exp = 10660000, money = 900000}
}
daily_task = {
[1] = {name = "Orcs" ,monsters_list = {"Orc Berserker","Orc Rider","Orc Leader","Orc Warlord"}, count = 100, points = 0, reward = {}, exp = 5000, money = 10000},
[2] = {name = "Tarantulas" ,monsters_list = {"Tarantula"}, count = 120, points = 1, reward = {}, exp = 9000, money = 12000},
[3] = {name = "Cyclops" ,monsters_list = {"Cyclops"}, count = 125, points = 2, reward = {}, exp = 9000, money = 15000},
[4] = {name = "Dragons" ,monsters_list = {"Dragon"}, count = 150, points = 0, reward = {}, exp = 2000, money = 10000},
[5] = {name = "Giant Spiders" ,monsters_list = {"Giant Spider"}, count = 200, points = 1, reward = {}, exp = 20000, money = 25000},
[6] = {name = "Ancient Scarabs" ,monsters_list = {"Ancient Scarab"}, count = 180, points = 5, reward = {}, exp = 22000, money = 18000},
[7] = {name = "Behemoths" ,monsters_list = {"Behemoth"}, count = 300, points = 3, reward = {}, exp = 50000, money = 60000},
[8] = {name = "Heroes" ,monsters_list = {"Hero"}, count = 260, points = 2, reward = {}, exp = 40000, money = 55000},
[9] = {name = "Giant Spiders" ,monsters_list = {"Giant Spider"}, count = 350, points = 3, reward = {}, exp = 60000, money = 70000},
[10] = {name = "Warlocks" ,monsters_list = {"Warlock"}, count = 700, points = 3, reward = {{2173,1}}, exp = 90000, money = 120000},
[11] = {name = "Hydras" ,monsters_list = {"Hydra"}, count = 700, points = 3, reward = {}, exp = 100000, money = 160000},
[12] = {name = "Dragon Lords" ,monsters_list = {"Dragon Lord"}, count = 700, points = 3, reward = {{2445,1}}, exp = 1300000, money = 200000},
[13] = {name = "Frost Dragons" ,monsters_list = {"Frost Dragon"}, count = 700, points = 3, reward = {{2445,1}}, exp = 1300000, money = 200000},
[14] = {name = "The Old Widows" ,monsters_list = {"The Old Widow"}, count = 500, points = 5, reward = {{2472,1}}, exp = 2000000, money = 200000},
[15] = {name = "Demodras" ,monsters_list = {"Demodras"}, count = 500, points = 5, reward = {{2492,1}}, exp = 2000000, money = 200000},
[16] = {name = "Necropharus" ,monsters_list = {"Necropharus"}, count = 600, points = 8, reward = {{2663,1}}, exp = 2000000, money = 200000}
}
task_sys_storages = {176601, 176602, 176603, 176604, 176605, 176606, 176607, 176608} -- task, points, count, daily task, daily count, daily time , daily start, contador
function getTaskMission(cid)
return getPlayerStorageValue(cid,task_sys_storages[1]) < 0 and 1 or getPlayerStorageValue(cid,task_sys_storages[1])
end
function getDailyTaskMission(cid)
return getPlayerStorageValue(cid,task_sys_storages[4]) < 0 and 1 or getPlayerStorageValue(cid,task_sys_storages[4])
end
function getTaskPoints(cid)
return getPlayerStorageValue(cid,task_sys_storages[2]) < 0 and 0 or getPlayerStorageValue(cid,task_sys_storages[2])
end
function doRandomDailyTask(cid)
local t = {
[{6,49}] = {1,4},
[{50,99}] = {5,9},
[{100,199}] = {10,13},
[{200,math.huge}] = {14,16}
}
for a , b in pairs(t) do
if getPlayerLevel(cid) >= a[1] and getPlayerLevel(cid) <= a[2] then
return math.random(b[1], b[2])
end
end
return 0
end
function GetRankTask(cid)
local ranks = {
[{1, 20}] = "Huntsman",
[{21, 50}] = "Ranger",
[{51, 100}] = "Big Game Hunter",
[{101, 200}] = "Senior Hunter",
[{201, math.huge}] = "Extreme Hunter"
}
for v , r in pairs(ranks) do
if getTaskPoints(cid) >= v[1] and getTaskPoints(cid) <= v[2] then
return r
end
end
return 0
end
function getItemsFromList(items)
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 doRemoveItemsFromList(cid,items)
local count = 0
if table.maxn(items) > 0 then
for i = 1, table.maxn(items) do
if getPlayerItemCount(cid,items[i][1]) >= items[i][2] then
count = count + 1 end
end
end
if count == table.maxn(items) then
for i = 1, table.maxn(items) do doPlayerRemoveItem(cid,items[i][1],items[i][2]) end
else
return false
end
return true
end
function getMonsterFromList(monster)
local str = ''
if #monster > 0 then
for i = 1, #monster do
str = str .. monster[i]
if i ~= #monster then str = str .. ', ' end
end
end
return str
end
function GiveRewardsTask(cid, items)
local backpack = doPlayerAddItem(cid, 1999, 1) -- backpackID
for _, i_i in ipairs(items) do
local item, amount = i_i[1],i_i[2]
if isItemStackable(item) or amount == 1 then
doAddContainerItem(backpack, item, amount)
else
for i = 1, amount do
doAddContainerItem(backpack, item, 1)
end
end
end
end
function isSummon(cid)
if(not isCreature(cid)) then
return false
end
return getCreatureMaster(cid) ~= cid
end
]]></config>
<event type="login" name="TaskLogin" event="script"><![CDATA[
function onLogin(cid)
registerCreatureEvent(cid, "KillTask")
registerCreatureEvent(cid, "TaskLook")
return true
end]]></event>
<talkaction words="/task;!task" event="buffer"><![CDATA[
domodlib('task_func')
param,task,daily = param:lower(), getTaskMission(cid), getDailyTaskMission(cid)
if isInArray({"counter","contador"},param) then
setPlayerStorageValue(cid, task_sys_storages[8], getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and 1 or 0)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"[Task System] O contador foi "..(getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and "ativado" or "desativado")..".") return true
elseif isInArray({"daily","diaria"},param) then
if not daily_task[daily] or getPlayerStorageValue(cid, task_sys_storages[7]) <= 0 then
doPlayerSendCancel(cid, "Desculpe, Mas você não está em nenhuma Daily Task.") return true
elseif getPlayerStorageValue(cid, task_sys_storages[6]) - os.time() <= 0 and getPlayerStorageValue(cid, task_sys_storages[5]) < daily_task[daily].count then
doPlayerSendCancel(cid,"Desculpe, Mas Você não terminou a Daily Task a tempo! Por favor volte ao npc e comece uma nova Daily Task!") return true
end
return doShowTextDialog(cid, 1961, "[->] CURRENT DAILY TASK INFO [<-]\n\nNome: "..daily_task[daily].name.."\nProgresso: ["..(getPlayerStorageValue(cid, task_sys_storages[5]) < 0 and 0 or getPlayerStorageValue(cid, task_sys_storages[5])).."/"..daily_task[daily].count.."]\nPrazo para entrega: "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,task_sys_storages[6])).."\nMonstros para caçar: "..getMonsterFromList(daily_task[daily].monsters_list).."\n\n[->] CURRENT TASK REWARDS [<-]\n\nMoney: "..(daily_task[daily].money > 0 and daily_task[daily].money or 0).."\nExperiencia: "..(daily_task[daily].exp > 0 and daily_task[daily].exp or 0).."\nTask Points: "..daily_task[daily].points.."\nItems: "..(#daily_task[daily].reward > 0 and getItemsFromList(daily_task[daily].reward) or "Nenhum item de recompensa")..".")
end
if not task_sys[task] or getPlayerStorageValue(cid, task_sys[task].start) <= 0 then
doPlayerSendCancel(cid, "Voce nao esta em nenhuma task.") return true
end
return doShowTextDialog(cid, 1961, "-> CURRENT TASK ["..getTaskMission(cid).."/"..#task_sys.."] <-\n\nTask Name: "..task_sys[task].name.."\nTask Level: "..task_sys[task].level.."\nTask Progress: ["..(getPlayerStorageValue(cid, task_sys_storages[3]) < 0 and 0 or getPlayerStorageValue(cid, task_sys_storages[3])).."/"..task_sys[task].count.."]\nMonster To Hunt: "..getMonsterFromList(task_sys[task].monsters_list)..".\nItens Para Entrega: "..(#task_sys[task].items > 0 and getItemsFromList(task_sys[task].items) or "Nenhum")..".\n\n[->] CURRENT TASK REWARDS [<-]\n\nReward Money: "..(task_sys[task].money > 0 and task_sys[task].money or 0).."\nReward Experiencia: "..(task_sys[task].exp > 0 and task_sys[task].exp or 0).."\nReward Points: "..task_sys[task].points.."\nReward Items: "..(#task_sys[task].reward > 0 and getItemsFromList(task_sys[task].reward) or "Nenhum item de recompensa")..".")
]]></talkaction>
<event type="look" name="TaskLook" event="script"><![CDATA[
domodlib('task_func')
function onLook(cid, thing, position, lookDistance)
if isPlayer(thing.uid) and getTaskPoints(thing.uid) > 0 then
doPlayerSetSpecialDescription(thing.uid, "\n"..(getPlayerSex(thing.uid) == 0 and "She" or "He").. " is a "..GetRankTask(thing.uid))
end
return true
end]]></event>
<event type="kill" name="KillTask" event="script"><![CDATA[
domodlib('task_func')
function onKill(cid, target)
if isPlayer(cid) and isMonster(target) then
local t,daily = task_sys[getTaskMission(cid)], daily_task[getDailyTaskMission(cid)]
if t and getPlayerStorageValue(cid, t.start) > 0 and isInArray(t.monsters_list, getCreatureName(target):lower()) and getPlayerStorageValue(cid, task_sys_storages[3]) < t.count then
setPlayerStorageValue(cid, task_sys_storages[3], getPlayerStorageValue(cid, task_sys_storages[3]) < 0 and 1 or (getPlayerStorageValue(cid, task_sys_storages[3])+1))
if getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and getPlayerStorageValue(cid, task_sys_storages[3]) < t.count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Task System] defeated Total [" .. getPlayerStorageValue(cid, task_sys_storages[3]) .. "/" .. t.count .. "] da Task do " .. t.name .. ".")
end
if getPlayerStorageValue(cid, task_sys_storages[3]) >= t.count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Task System] Parabens! Voce terminou a Task do "..t.name..", volte ao npc parece receber sua recompensa.")
end
end
if daily and getPlayerStorageValue(cid, task_sys_storages[7]) > 0 and getPlayerStorageValue(cid, task_sys_storages[6]) - os.time() >= 0 and isInArray(daily.monsters_list, getCreatureName(target):lower()) and getPlayerStorageValue(cid, task_sys_storages[5]) < daily.count then
setPlayerStorageValue(cid, task_sys_storages[5], getPlayerStorageValue(cid, task_sys_storages[5]) < 0 and 1 or (getPlayerStorageValue(cid, task_sys_storages[5])+1))
if getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and getPlayerStorageValue(cid, task_sys_storages[5]) < daily.count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"[Daily Task System] defeated Total [" .. getPlayerStorageValue(cid, task_sys_storages[5]) .. "/" .. daily.count .. "] da Task do " .. daily.name .. ".")
end
if getPlayerStorageValue(cid, task_sys_storages[5]) >= daily.count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Daily Task System] Parabens! Voce terminou a Task do "..daily.name..", volte ao npc parece receber sua recompensa.")
end
end
end
return true
end]]></event>
</mod>
and the djinn and efreet xmlThis is my task.xml
XML:<?xml version="1.0" encoding="ISO-8859-1"?> <mod name="Simple Task" version="4.0" author="Vodkart" contact="tibiaking.com" enabled="yes"> <config name="task_func"><![CDATA[ task_sys = { [1] = {name = "Trolls", start = 176201, monsters_list = {"Troll"}, level = 8, count = 40, points = 0, items = {}, reward = {}, exp = 20000, money = 2000}, [2] = {name = "rotworms", start = 176202, monsters_list = {"rotworm"}, level = 12, count = 50, points = 0, items = {}, reward = {}, exp = 25000, money = 3000}, [3] = {name = "Minotaurs", start = 176216, monsters_list = {"minotaur","minotaur guard","minotaur archer","minotaur mage"}, level = 15, count = 150, points = 1, items = {}, reward = {}, exp = 30000, money = 10000}, [4] = {name = "cyclops", start = 176203, monsters_list = {"cyclops"}, level = 19, count = 60, points = 1, items = {}, reward = {{2486,1}}, exp = 30000, money = 3000}, [5] = {name = "Green Djinn", start = 176204, monsters_list = {"Green Djinn","Efreet"}, level = 23, count = 80, points = 1, items = {}, reward = {}, exp = 100000, money = 5000}, [6] = {name = "Blue Djinn", start = 176205, monsters_list = {"Blue Djinn","Marid"}, level = 25, count = 80, points = 1, items = {}, reward = {}, exp = 100000, money = 5000}, [7] = {name = "Terror Birds", start = 176206, monsters_list = {"Terror Bird"}, level = 30, count = 120, points = 2, items = {}, reward = {}, exp = 100000, money = 5000}, [8] = {name = "Stone Golems", start = 176207, monsters_list = {"Stone Golem"}, level = 33, count = 130, points = 3, items = {}, reward = {}, exp = 120000, money = 7000}, [9] = {name = "Carniphilas", start = 176208, monsters_list = {"carniphila"}, level = 36, count = 135, points = 3, items = {}, reward = {}, exp = 80000, money = 8000}, [10] = {name = "Elephants", start = 176209, monsters_list = {"elephant"}, level = 40, count = 150, points = 2, items = {}, reward = {}, exp = 120000, money = 8200}, [11] = {name = "Dwarves", start = 176210, monsters_list = {"dwarf","dwarf soldier","dwarf guard","dwarf geomancer"}, level = 42, count = 150, points = 3, items = {}, reward = {}, exp = 200000, money = 15000}, [12] = {name = "Vampires", start = 176211, monsters_list = {"vampire"}, level = 46, count = 170, points = 2, items = {}, reward = {}, exp = 80000, money = 8500}, [13] = {name = "Dragons", start = 176212, monsters_list = {"dragon"}, level = 50, count = 120, points = 1, items = {}, reward = {}, exp = 90000, money = 9000}, [14] = {name = "Necromancer" ,start = 176213, monsters_list = {"Necromancer"}, level = 60, count = 200, points = 3, items = {}, reward = {}, exp = 200000, money = 15000}, [15] = {name = "Bonebeasts" ,start = 176214, monsters_list = {"Bonebeast"}, level = 63, count = 250, points = 3, items = {}, reward = {}, exp = 250000, money = 11000}, [16] = {name = "Giant Spider" ,start = 176215, monsters_list = {"Giant Spider","The old widow"}, level = 80, count = 500, points = 0, items = {}, reward = {}, exp = 200000, money = 32000}, [17] = {name = "Dragon Lords" ,start = 176219, monsters_list = {"Dragon lord"}, level = 88, count = 650, points = 3, items = {}, reward = {}, exp = 30000, money = 35000}, [18] = {name = "Hydras" ,start = 176222, monsters_list = {"Hydra"}, level = 100, count = 700, points = 3, items = {{4850,10}}, reward = {}, exp = 400000, money = 40000}, [19] = {name = "Serpent Spawn" ,start = 176223, monsters_list = {"Serpent Spawn"}, level = 103, count = 720, points = 4, items = {{2445,1}}, reward = {}, exp = 500000, money = 45000}, [20] = {name = "Behemoths" ,start = 176224, monsters_list = {"Behemoth"}, level = 108, count = 800, points = 4, items = {}, reward = {}, exp = 5000000, money = 200000}, [21] = {name = "Demons" ,start = 176225, monsters_list = {"Demon"}, level = 110, count = 6666, points = 4, items = {}, reward = {{2495,1}}, exp = 6660000, money = 500000}, [22] = {name = "Orshabaals" ,start = 176226, monsters_list = {"Orshabaal"}, level = 120, count = 300, points = 5, items = {}, reward = {{2341,1},{5114,1}}, exp = 9960000, money = 800000}, [23] = {name = "Ferumbras" ,start = 176227, monsters_list = {"Ferumbras"}, level = 130, count = 50, points = 5, items = {}, reward = {{2345,1}}, exp = 6660000, money = 666000}, [24] = {name = "Golden Knights" ,start = 176228, monsters_list = {"Golden Knight"}, level = 200, count = 10, points = 10, items = {}, reward = {{2646,1}}, exp = 10660000, money = 900000} } daily_task = { [1] = {name = "Orcs" ,monsters_list = {"Orc Berserker","Orc Rider","Orc Leader","Orc Warlord"}, count = 100, points = 0, reward = {}, exp = 5000, money = 10000}, [2] = {name = "Tarantulas" ,monsters_list = {"Tarantula"}, count = 120, points = 1, reward = {}, exp = 9000, money = 12000}, [3] = {name = "Cyclops" ,monsters_list = {"Cyclops"}, count = 125, points = 2, reward = {}, exp = 9000, money = 15000}, [4] = {name = "Dragons" ,monsters_list = {"Dragon"}, count = 150, points = 0, reward = {}, exp = 2000, money = 10000}, [5] = {name = "Giant Spiders" ,monsters_list = {"Giant Spider"}, count = 200, points = 1, reward = {}, exp = 20000, money = 25000}, [6] = {name = "Ancient Scarabs" ,monsters_list = {"Ancient Scarab"}, count = 180, points = 5, reward = {}, exp = 22000, money = 18000}, [7] = {name = "Behemoths" ,monsters_list = {"Behemoth"}, count = 300, points = 3, reward = {}, exp = 50000, money = 60000}, [8] = {name = "Heroes" ,monsters_list = {"Hero"}, count = 260, points = 2, reward = {}, exp = 40000, money = 55000}, [9] = {name = "Giant Spiders" ,monsters_list = {"Giant Spider"}, count = 350, points = 3, reward = {}, exp = 60000, money = 70000}, [10] = {name = "Warlocks" ,monsters_list = {"Warlock"}, count = 700, points = 3, reward = {{2173,1}}, exp = 90000, money = 120000}, [11] = {name = "Hydras" ,monsters_list = {"Hydra"}, count = 700, points = 3, reward = {}, exp = 100000, money = 160000}, [12] = {name = "Dragon Lords" ,monsters_list = {"Dragon Lord"}, count = 700, points = 3, reward = {{2445,1}}, exp = 1300000, money = 200000}, [13] = {name = "Frost Dragons" ,monsters_list = {"Frost Dragon"}, count = 700, points = 3, reward = {{2445,1}}, exp = 1300000, money = 200000}, [14] = {name = "The Old Widows" ,monsters_list = {"The Old Widow"}, count = 500, points = 5, reward = {{2472,1}}, exp = 2000000, money = 200000}, [15] = {name = "Demodras" ,monsters_list = {"Demodras"}, count = 500, points = 5, reward = {{2492,1}}, exp = 2000000, money = 200000}, [16] = {name = "Necropharus" ,monsters_list = {"Necropharus"}, count = 600, points = 8, reward = {{2663,1}}, exp = 2000000, money = 200000} } task_sys_storages = {176601, 176602, 176603, 176604, 176605, 176606, 176607, 176608} -- task, points, count, daily task, daily count, daily time , daily start, contador function getTaskMission(cid) return getPlayerStorageValue(cid,task_sys_storages[1]) < 0 and 1 or getPlayerStorageValue(cid,task_sys_storages[1]) end function getDailyTaskMission(cid) return getPlayerStorageValue(cid,task_sys_storages[4]) < 0 and 1 or getPlayerStorageValue(cid,task_sys_storages[4]) end function getTaskPoints(cid) return getPlayerStorageValue(cid,task_sys_storages[2]) < 0 and 0 or getPlayerStorageValue(cid,task_sys_storages[2]) end function doRandomDailyTask(cid) local t = { [{6,49}] = {1,4}, [{50,99}] = {5,9}, [{100,199}] = {10,13}, [{200,math.huge}] = {14,16} } for a , b in pairs(t) do if getPlayerLevel(cid) >= a[1] and getPlayerLevel(cid) <= a[2] then return math.random(b[1], b[2]) end end return 0 end function GetRankTask(cid) local ranks = { [{1, 20}] = "Huntsman", [{21, 50}] = "Ranger", [{51, 100}] = "Big Game Hunter", [{101, 200}] = "Senior Hunter", [{201, math.huge}] = "Extreme Hunter" } for v , r in pairs(ranks) do if getTaskPoints(cid) >= v[1] and getTaskPoints(cid) <= v[2] then return r end end return 0 end function getItemsFromList(items) 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 doRemoveItemsFromList(cid,items) local count = 0 if table.maxn(items) > 0 then for i = 1, table.maxn(items) do if getPlayerItemCount(cid,items[i][1]) >= items[i][2] then count = count + 1 end end end if count == table.maxn(items) then for i = 1, table.maxn(items) do doPlayerRemoveItem(cid,items[i][1],items[i][2]) end else return false end return true end function getMonsterFromList(monster) local str = '' if #monster > 0 then for i = 1, #monster do str = str .. monster[i] if i ~= #monster then str = str .. ', ' end end end return str end function GiveRewardsTask(cid, items) local backpack = doPlayerAddItem(cid, 1999, 1) -- backpackID for _, i_i in ipairs(items) do local item, amount = i_i[1],i_i[2] if isItemStackable(item) or amount == 1 then doAddContainerItem(backpack, item, amount) else for i = 1, amount do doAddContainerItem(backpack, item, 1) end end end end function isSummon(cid) if(not isCreature(cid)) then return false end return getCreatureMaster(cid) ~= cid end ]]></config> <event type="login" name="TaskLogin" event="script"><![CDATA[ function onLogin(cid) registerCreatureEvent(cid, "KillTask") registerCreatureEvent(cid, "TaskLook") return true end]]></event> <talkaction words="/task;!task" event="buffer"><![CDATA[ domodlib('task_func') param,task,daily = param:lower(), getTaskMission(cid), getDailyTaskMission(cid) if isInArray({"counter","contador"},param) then setPlayerStorageValue(cid, task_sys_storages[8], getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and 1 or 0) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"[Task System] O contador foi "..(getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and "ativado" or "desativado")..".") return true elseif isInArray({"daily","diaria"},param) then if not daily_task[daily] or getPlayerStorageValue(cid, task_sys_storages[7]) <= 0 then doPlayerSendCancel(cid, "Desculpe, Mas você não está em nenhuma Daily Task.") return true elseif getPlayerStorageValue(cid, task_sys_storages[6]) - os.time() <= 0 and getPlayerStorageValue(cid, task_sys_storages[5]) < daily_task[daily].count then doPlayerSendCancel(cid,"Desculpe, Mas Você não terminou a Daily Task a tempo! Por favor volte ao npc e comece uma nova Daily Task!") return true end return doShowTextDialog(cid, 1961, "[->] CURRENT DAILY TASK INFO [<-]\n\nNome: "..daily_task[daily].name.."\nProgresso: ["..(getPlayerStorageValue(cid, task_sys_storages[5]) < 0 and 0 or getPlayerStorageValue(cid, task_sys_storages[5])).."/"..daily_task[daily].count.."]\nPrazo para entrega: "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,task_sys_storages[6])).."\nMonstros para caçar: "..getMonsterFromList(daily_task[daily].monsters_list).."\n\n[->] CURRENT TASK REWARDS [<-]\n\nMoney: "..(daily_task[daily].money > 0 and daily_task[daily].money or 0).."\nExperiencia: "..(daily_task[daily].exp > 0 and daily_task[daily].exp or 0).."\nTask Points: "..daily_task[daily].points.."\nItems: "..(#daily_task[daily].reward > 0 and getItemsFromList(daily_task[daily].reward) or "Nenhum item de recompensa")..".") end if not task_sys[task] or getPlayerStorageValue(cid, task_sys[task].start) <= 0 then doPlayerSendCancel(cid, "Voce nao esta em nenhuma task.") return true end return doShowTextDialog(cid, 1961, "-> CURRENT TASK ["..getTaskMission(cid).."/"..#task_sys.."] <-\n\nTask Name: "..task_sys[task].name.."\nTask Level: "..task_sys[task].level.."\nTask Progress: ["..(getPlayerStorageValue(cid, task_sys_storages[3]) < 0 and 0 or getPlayerStorageValue(cid, task_sys_storages[3])).."/"..task_sys[task].count.."]\nMonster To Hunt: "..getMonsterFromList(task_sys[task].monsters_list)..".\nItens Para Entrega: "..(#task_sys[task].items > 0 and getItemsFromList(task_sys[task].items) or "Nenhum")..".\n\n[->] CURRENT TASK REWARDS [<-]\n\nReward Money: "..(task_sys[task].money > 0 and task_sys[task].money or 0).."\nReward Experiencia: "..(task_sys[task].exp > 0 and task_sys[task].exp or 0).."\nReward Points: "..task_sys[task].points.."\nReward Items: "..(#task_sys[task].reward > 0 and getItemsFromList(task_sys[task].reward) or "Nenhum item de recompensa")..".") ]]></talkaction> <event type="look" name="TaskLook" event="script"><![CDATA[ domodlib('task_func') function onLook(cid, thing, position, lookDistance) if isPlayer(thing.uid) and getTaskPoints(thing.uid) > 0 then doPlayerSetSpecialDescription(thing.uid, "\n"..(getPlayerSex(thing.uid) == 0 and "She" or "He").. " is a "..GetRankTask(thing.uid)) end return true end]]></event> <event type="kill" name="KillTask" event="script"><![CDATA[ domodlib('task_func') function onKill(cid, target) if isPlayer(cid) and isMonster(target) then local t,daily = task_sys[getTaskMission(cid)], daily_task[getDailyTaskMission(cid)] if t and getPlayerStorageValue(cid, t.start) > 0 and isInArray(t.monsters_list, getCreatureName(target):lower()) and getPlayerStorageValue(cid, task_sys_storages[3]) < t.count then setPlayerStorageValue(cid, task_sys_storages[3], getPlayerStorageValue(cid, task_sys_storages[3]) < 0 and 1 or (getPlayerStorageValue(cid, task_sys_storages[3])+1)) if getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and getPlayerStorageValue(cid, task_sys_storages[3]) < t.count then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Task System] defeated Total [" .. getPlayerStorageValue(cid, task_sys_storages[3]) .. "/" .. t.count .. "] da Task do " .. t.name .. ".") end if getPlayerStorageValue(cid, task_sys_storages[3]) >= t.count then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Task System] Parabens! Voce terminou a Task do "..t.name..", volte ao npc parece receber sua recompensa.") end end if daily and getPlayerStorageValue(cid, task_sys_storages[7]) > 0 and getPlayerStorageValue(cid, task_sys_storages[6]) - os.time() >= 0 and isInArray(daily.monsters_list, getCreatureName(target):lower()) and getPlayerStorageValue(cid, task_sys_storages[5]) < daily.count then setPlayerStorageValue(cid, task_sys_storages[5], getPlayerStorageValue(cid, task_sys_storages[5]) < 0 and 1 or (getPlayerStorageValue(cid, task_sys_storages[5])+1)) if getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and getPlayerStorageValue(cid, task_sys_storages[5]) < daily.count then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"[Daily Task System] defeated Total [" .. getPlayerStorageValue(cid, task_sys_storages[5]) .. "/" .. daily.count .. "] da Task do " .. daily.name .. ".") end if getPlayerStorageValue(cid, task_sys_storages[5]) >= daily.count then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Daily Task System] Parabens! Voce terminou a Task do "..daily.name..", volte ao npc parece receber sua recompensa.") end end end return true end]]></event> </mod>
and the djinn and efreet xml
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Green Djinn" nameDescription="a green djinn" race="blood" experience="215" speed="220" manacost="0">
<health now="330" max="330"/>
<look type="51" corpse="2989"/>
<targetchange interval="5000" chance="8"/>
<strategy attack="100" defense="0"/>
<flags>
<flag summonable="0"/>
<flag attackable="1"/>
<flag hostile="1"/>
<flag illusionable="0"/>
<flag convinceable="0"/>
<flag pushable="0"/>
<flag canpushitems="1"/>
<flag canpushcreatures="0"/>
<flag targetdistance="1"/>
<flag staticattack="90"/>
<flag runonhealth="0"/>
</flags>
<attacks>
<attack name="melee" interval="2000" skill="45" attack="40"/>
<attack name="fire" interval="1000" chance="50" range="7" min="-45" max="-75">
<attribute key="shootEffect" value="fire"/>
</attack>
<attack name="energycondition" interval="2000" chance="34" range="7" min="-50" max="-90">
<attribute key="shootEffect" value="energy"/>
</attack>
<attack name="lifedrain" interval="3000" chance="25" range="7" min="-55" max="-105">
<attribute key="shootEffect" value="death"/>
</attack>
<attack name="outfit" interval="1000" chance="17" range="7" monster="rat" duration="30000">
<attribute key="areaEffect" value="blueshimmer"/>
</attack>
</attacks>
<defenses armor="18" defense="10"/>
<elements>
<element icePercent="-10"/>
<element holyPercent="-10"/>
</elements>
<immunities>
<immunity invisible="1"/>
</immunities>>
<voices interval="5000" chance="10">
<voice sentence="I grant you a deathwish!"/>
<voice sentence="Muhahahaha!"/>
<voice sentence="I wish you a merry trip to hell!"/>
<voice sentence="Good wishes are for fairytales"/>
</voices>
<loot>
<item id="2148" countmax="70" chance="31000"/><!-- gold coin -->
<item id="2148" countmax="45" chance="31000"/><!-- gold coin -->
<item id="2696" chance="27500"/><!-- cheese -->
<item id="2747" chance="10000"/><!-- grave flower -->
<item id="2062" chance="6750"/><!-- small oil lamp -->
<item id="1965" chance="4250"/><!-- green book -->
<item id="2149" countmax="4" chance="750"/><!-- small emerald -->
</loot>
</monster>
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Efreet" nameDescription="an efreet" race="blood" experience="410" speed="270" manacost="0">
<health now="550" max="550"/>
<look type="103" corpse="3037"/>
<targetchange interval="5000" chance="8"/>
<strategy attack="100" defense="0"/>
<flags>
<flag summonable="0"/>
<flag attackable="1"/>
<flag hostile="1"/>
<flag illusionable="0"/>
<flag convinceable="0"/>
<flag pushable="0"/>
<flag canpushitems="1"/>
<flag canpushcreatures="0"/>
<flag targetdistance="1"/>
<flag staticattack="90"/>
<flag runonhealth="0"/>
</flags>
<attacks>
<attack name="melee" interval="2000" skill="45" attack="40"/>
<attack name="fire" interval="2000" chance="50" range="7" min="-40" max="-110">
<attribute key="shootEffect" value="fire"/>
</attack>
<attack name="energy" interval="2000" chance="25" range="7" min="-65" max="-115">
<attribute key="shootEffect" value="energy"/>
</attack>
<attack name="lifedrain" interval="3000" chance="20" range="7" min="-60" max="-120">
<attribute key="shootEffect" value="death"/>
</attack>
<attack name="outfit" interval="1000" chance="17" range="7" monster="rat" duration="30000">
<attribute key="areaEffect" value="blueshimmer"/>
</attack>
<attack name="energycondition" interval="1000" chance="17" radius="3" target="0" min="-60" max="-100">
<attribute key="areaEffect" value="energy"/>
</attack>
</attacks>
<defenses armor="15" defense="20">
<defense name="healing" interval="1000" chance="15" min="50" max="80">
<attribute key="areaEffect" value="blueshimmer"/>
</defense>
</defenses>
<elements>
<element icePercent="-10"/>
<element holyPercent="-10"/>
</elements>
<immunities>
<immunity invisible="1"/>
</immunities>
<voices interval="5000" chance="10">
<voice sentence="I grant you a deathwish!"/>
<voice sentence="Good wishes are for fairytales"/>
</voices>
<loot>
<item id="2148" countmax="75" chance="40000"/><!-- gold coin -->
<item id="2148" countmax="50" chance="40000"/><!-- gold coin -->
<item id="2673" countmax="12" chance="6000"/><!-- pear -->
<item id="2442" chance="5000"/><!-- heavy machete -->
<item id="2063" chance="20000"/><!-- small oil lamp -->
<item id="2149" countmax="4" chance="1000"/><!-- small emerald -->
<item id="1860" chance="1000"/><!-- green tapestry -->
<item id="2187" chance="900"/><!-- wand of inferno -->
<item id="2155" chance="200"/><!-- green gem -->
</loot>
</monster>
Sorry about that, i cant select the lines on my consoleCan you please take picture of your screen (preferably with your phone) so we can read better?
But I don't know how a string ended up in this field, is there something wrong with my task MOD?trying to compare string with a number.
-- TASK
RANK_NONE = 0
RANK_HUNTSMAN = 1
RANK_RANGER = 2
RANK_BIGGAMEHUNTER = 3
RANK_TROPHYHUNTER = 4
RANK_ELITEHUNTER = 5
REWARD_MONEY = 1
REWARD_EXP = 2
REWARD_ACHIEVEMENT = 3
REWARD_STORAGE = 4
REWARD_POINT = 5
REWARD_ITEM = 6
QUESTSTORAGE_BASE = 71500
KILLSSTORAGE_BASE = 72500
REPEATSTORAGE_BASE = 73500
POINTSSTORAGE = 72500
ONTASKSTORAGE = 74500
tasks =
{
[1] = {killsRequired = 200, raceName = "Bog Raiders", level = {400, 800}, premium = false, creatures = {"bog raider"}, rewards = {
{type = "exp", value = {50000}},
{type = "money", value = {10000}},
{type = "item", value = {5829,1}},
{type = "storage", value = {35000, 1}}
}},
[2] = {killsRequired = 75, raceName = "Dwarfs", level = {6, 30}, premium = false, creatures = {"dwarf","dwarf soldier","dwarf guard"}, rewards = {
{type = "exp", value = {15000}},
{type = "money", value = {10000}},
{type = "item", value = {2157,2}}, -- u can add as many lines as u want here maning ther ebe more items e.g:
--{type = "item", value = {2157,2}}, -- item 2 reward
{type = "storage", value = {35001, 1}} -- Same for storage just remember last in this array cant have , symbol
}},
}
tasksByPlayer = 3
repeatTimes = 1
function getPlayerRank(cid)
return (getPlayerStorageValue(cid, POINTSSTORAGE) >= 100 and RANK_ELITEHUNTER or getPlayerStorageValue(cid, POINTSSTORAGE) >= 70 and RANK_TROPHYHUNTER or getPlayerStorageValue(cid, POINTSSTORAGE) >= 40 and RANK_BIGGAMEHUNTER or getPlayerStorageValue(cid, POINTSSTORAGE) >= 20 and RANK_RANGER or getPlayerStorageValue(cid, POINTSSTORAGE) >= 10 and RANK_HUNTSMAN or RANK_NONE)
end
function getTaskByName(name, table)
local t = (table and table or tasks)
for k, v in pairs(t) do
if v.name then
if v.name:lower() == name:lower() then
return k
end
else
if v.raceName:lower() == name:lower() then
return k
end
end
end
return false
end
function getTasksByPlayer(cid)
local canmake = {}
local able = {}
for k, v in pairs(tasks) do
if getPlayerStorageValue(cid, QUESTSTORAGE_BASE + k) < 1 and getPlayerStorageValue(cid, REPEATSTORAGE_BASE + k) < repeatTimes then
able[k] = true
if getPlayerLevel(cid) < v.level[1] or getPlayerLevel(cid) > v.level[2] then
able[k] = false
end
if v.storage and getPlayerStorageValue(cid, v.storage[1]) < v.storage[2] then
able[k] = false
end
if v.rank then
if getPlayerRank(cid) < v.rank then
able[k] = false
end
end
if v.premium then
if not isPremium(cid) then
able[k] = false
end
end
if able[k] then
table.insert(canmake, k)
end
end
end
return canmake
end
function canStartTask(cid, name, table)
local v = ""
local id = 0
local t = (table and table or tasks)
for k, i in pairs(t) do
if i.name then
if i.name:lower() == name:lower() then
v = i
id = k
break
end
else
if i.raceName:lower() == name:lower() then
v = i
id = k
break
end
end
end
if v == "" then
return false
end
if getPlayerStorageValue(cid, QUESTSTORAGE_BASE + id) > 0 then
return false
end
if (getPlayerStorageValue(cid, REPEATSTORAGE_BASE + id) >= repeatTimes) or (v.norepeatable and getPlayerStorageValue(cid, REPEATSTORAGE_BASE + id) > 0) then
return false
end
if getPlayerLevel(cid) >= v.level[1] and getPlayerLevel(cid) <= v.level[2] then
if v.premium then
if isPremium(cid) then
if v.rank then
if getPlayerRank(cid) >= v.rank then
if v.storage then
if getPlayerStorageValue(cid, v.storage[1]) >= v.storage[2] then
return true
end
else
return true
end
end
else
return true
end
end
else
return true
end
end
return false
end
function getPlayerStartedTasks(cid)
local tmp = {}
for k, v in pairs(tasks) do
if getPlayerStorageValue(cid, QUESTSTORAGE_BASE + k) > 0 and getPlayerStorageValue(cid, QUESTSTORAGE_BASE + k) < 2 then
table.insert(tmp, k)
end
end
return tmp
end
function isSummon(target)
return (getCreatureMaster(target) ~= target)
end
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
local choose = {}
local cancel = {}
local available = {}
function creatureSayCallback(cid, type, msg)
if npcHandler.focus ~= cid then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
if isInArray({"tasks", "task", "mission"}, msg:lower()) then
local can = getTasksByPlayer(cid)
if #can > 0 then
local text = ""
local sep = ", "
table.sort(can, (function(a, b) return (a < b) end))
local t = 0
for _, id in ipairs(can) do
t = t + 1
if t == #can - 1 then
sep = " and "
elseif t == #can then
sep = "."
end
text = text .. "{" .. (tasks[id].name or tasks[id].raceName) .. "}" .. sep
end
selfSay("The current task" .. (#can > 1 and "s" or "") .. " that you can choose " .. (#can > 1 and "are" or "is") .. " " .. text, cid)
talkState[talkUser] = 0
else
selfSay("I don't have any task for you right now.", cid)
end
elseif msg ~= "" and canStartTask(cid, msg) then
if #getPlayerStartedTasks(cid) >= tasksByPlayer then
selfSay("Sorry, but you already started " .. tasksByPlayer .. " tasks.", cid)
return true
end
local task = getTaskByName(msg)
if task and getCreatureStorage(cid, QUESTSTORAGE_BASE + task) > 0 then
return false
end
selfSay("In this task you must defeat " .. tasks[task].killsRequired .. " " .. tasks[task].raceName .. ". Are you sure that you want to start this task?", cid)
choose[cid] = task
talkState[talkUser] = 1
elseif msg:lower() == "yes" and talkState[talkUser] == 1 then
doCreatureSetStorage(cid, QUESTSTORAGE_BASE + choose[cid], 1)
selfSay("Excellent! You can check the status of your task saying report to me.", cid)
choose[cid] = nil
talkState[talkUser] = 0
elseif msg:lower() == "report" then
local started = getPlayerStartedTasks(cid)
local finishedAtLeastOne = false
local finished = 0
if started and #started > 0 then
for _, id in ipairs(started) do
if getCreatureStorage(cid, KILLSSTORAGE_BASE + id) >= tasks[id].killsRequired then
for _, reward in ipairs(tasks[id].rewards) do
print("Rewards loaded")
local deny = false
if reward.storage then
if getCreatureStorage(cid, reward.storage[1]) >= reward.storage[2] then
deny = true
end
end
if isInArray({REWARD_MONEY, "money"}, reward.type:lower()) and not deny then
doPlayerAddMoney(cid, reward.value[1])
elseif isInArray({REWARD_EXP, "exp", "experience"}, reward.type:lower()) and not deny then
doPlayerAddExperience(cid, reward.value[1])
doPlayerSendDefaultCancel(cid, "You gained " .. reward.value[1] .. " experience points.")
elseif isInArray({REWARD_STORAGE, "storage", "stor"}, reward.type:lower()) and not deny then
doCreatureSetStorage(cid, reward.value[1], reward.value[2])
elseif isInArray({REWARD_POINT, "points", "point"}, reward.type:lower()) and not deny then
doCreatureSetStorage(cid, POINTSSTORAGE, getCreatureStorage(cid, POINTSSTORAGE) + reward.value[1])
elseif isInArray({REWARD_ITEM, "item", "items", "object"}, reward.type:lower()) and not deny then
doPlayerAddItem(cid, reward.value[1], reward.value[2])
end
if reward.storage then
doCreatureSetStorage(cid, reward.storage[1], reward.storage[2])
end
end
if tasks[id].norepeatable then
doCreatureSetStorage(cid, QUESTSTORAGE_BASE + id, 2)
else
doCreatureSetStorage(cid, QUESTSTORAGE_BASE + id, 0)
end
doCreatureSetStorage(cid, KILLSSTORAGE_BASE + id, 0)
if getCreatureStorage(cid, REPEATSTORAGE_BASE + id) < 1 then
doCreatureSetStorage(cid, REPEATSTORAGE_BASE + id, 0)
end
doCreatureSetStorage(cid, REPEATSTORAGE_BASE + id, getCreatureStorage(cid, REPEATSTORAGE_BASE + id) + 1)
finishedAtLeastOne = true
finished = finished + 1
end
end
if not finishedAtLeastOne then
selfSay("You haven't finished any task yet.", cid)
else
selfSay("Awesome! you finished " .. (finished > 1 and "various" or "a") .. " task" .. (finished > 1 and "s" or "") .. ". Talk to me again if you want to start a task.", cid)
end
else
selfSay("You haven't started any task yet.", cid)
end
elseif msg:lower() == "started" then
local started = getPlayerStartedTasks(cid)
if started and #started > 0 then
local text = ""
local sep = ", "
table.sort(started, (function(a, b) return (a < b) end))
local t = 0
for _, id in ipairs(started) do
t = t + 1
if t == #started - 1 then
sep = " and "
elseif t == #started then
sep = "."
end
text = text .. "{" .. (tasks[id].name or tasks[id].raceName) .. "}" .. sep
end
selfSay("The current task" .. (#started > 1 and "s" or "") .. " that you started " .. (#started > 1 and "are" or "is") .. " " .. text, cid)
else
selfSay("You haven't started any task yet.", cid)
end
elseif msg:lower() == "cancel" then
local started = getPlayerStartedTasks(cid)
if started and #started > 0 then
selfSay("Cancelling a task will make the count restart. Wich task you want to cancel?", cid)
talkState[talkUser] = 2
else
selfSay("You haven't started any task yet.", cid)
end
elseif getTaskByName(msg) and talkState[talkUser] == 2 and isInArray(getPlayerStartedTasks(cid), getTaskByName(msg)) then
local task = getTaskByName(msg)
if getCreatureStorage(cid, KILLSSTORAGE_BASE + task) > 0 then
selfSay("You currently killed " .. getCreatureStorage(cid, KILLSSTORAGE_BASE + task) .. "/" .. tasks[task].killsRequired .. " " .. tasks[task].raceName .. ". Cancelling this task will restart the count. Are you sure you want to cancel this task?", cid)
else
selfSay("Are you sure you want to cancel this task?", cid)
end
talkState[talkUser] = 3
cancel[cid] = task
elseif msg:lower() == "yes" and talkState[talkUser] == 3 then
doCreatureSetStorage(cid, QUESTSTORAGE_BASE + cancel[cid], -1)
doCreatureSetStorage(cid, KILLSSTORAGE_BASE + cancel[cid], -1)
selfSay("You have cancelled the task " .. (tasks[cancel[cid]].name or tasks[cancel[cid]].raceName) .. ".", cid)
talkState[talkUser] = 0
elseif isInArray({"points", "rank"}, msg:lower()) then
selfSay("At this time, you have " .. getCreatureStorage(cid, POINTSSTORAGE) .. " Paw & Fur points. You " .. (getPlayerRank(cid) == 5 and "are an Elite Hunter" or getPlayerRank(cid) == 4 and "are a Trophy Hunter" or getPlayerRank(cid) == 3 and "are a Big Game Hunter" or getPlayerRank(cid) == 2 and "are a Ranger" or getPlayerRank(cid) == 1 and "are a Huntsman" or "haven't been ranked yet") .. ".", cid)
talkState[talkUser] = 0
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())