Hello everyone,
I am trying to implement a task system in this source from MillhioreBT. (GitHub - MillhioreBT/forgottenserver-downgrade: TFS Downgrade 1.5 8.6))
I followed all the instructions from various topics, but unfortunately, I was not successful and couldn't find any solution for this issue.
Every time I receive this error in the console:

Could you help me understand this error?
I attached the all scripts.
Config:
killingInTheNameOfQuest.lua
i linked the lib on global.lua
dofile('data/lib/miscellaneous/killingInTheNameOfQuest.lua')
I am trying to implement a task system in this source from MillhioreBT. (GitHub - MillhioreBT/forgottenserver-downgrade: TFS Downgrade 1.5 8.6))
I followed all the instructions from various topics, but unfortunately, I was not successful and couldn't find any solution for this issue.
Every time I receive this error in the console:

Could you help me understand this error?
I attached the all scripts.
Config:
killingInTheNameOfQuest.lua
LUA:
--[[
TODO
Unite all related variables / functions in a table
rewrite functions like "getTasksByPlayer" to "Player.getTasks"
]]
RANK_NONE = 0
RANK_JOIN = 1
RANK_HUNTSMAN = 2
RANK_RANGER = 3
RANK_BIGGAMEHUNTER = 4
RANK_TROPHYHUNTER = 5
RANK_ELITEHUNTER = 6
REWARD_MONEY = 1
REWARD_EXP = 2
REWARD_ACHIEVEMENT = 3
REWARD_STORAGE = 4
REWARD_POINT = 5
REWARD_ITEM = 6
QUESTSTORAGE_BASE = 1500
JOIN_STOR = 100157
KILLSSTORAGE_BASE = 65000
REPEATSTORAGE_BASE = 48950
POINTSSTORAGE = 2500
tasks =
{
[1] = {killsRequired = 100, raceName = "Trolls", level = {6, 19}, premium = false, creatures = {"troll", "troll champion", "island troll", "swamp troll"}, rewards = {{type = "exp", value = {200}},{type = "money", value = {200}}}},
[2] = {killsRequired = 150, raceName = "Goblins", level = {6, 19}, premium = false, creatures = {"goblin", "goblin assassin", "goblin leader"}, rewards = {{type = "exp", value = {300}},{type = "money", value = {250}}}},
[3] = {killsRequired = 300, raceName = "Crocodiles", level = {6, 49}, premium = false, creatures = {"crocodile"}, rewards = {{type = "exp", value = {800}},{type = "achievement", value = {"Blood-Red Snapper"}},{type = "storage", value = {35000, 1}},{type = "points", value = {1}}}},
[4] = {killsRequired = 300, raceName = "Badgers", level = {6, 49}, premium = false, creatures = {"badger"}, rewards = {{type = "exp", value = {500}},{type = "points", value = {1}}}},
}
tasksByPlayer = 3
repeatTimes = 3
function Player.getPawAndFurRank(self)
return (self:getStorageValue(POINTSSTORAGE) >= 100 and RANK_ELITEHUNTER or self:getStorageValue(POINTSSTORAGE) >= 70 and RANK_TROPHYHUNTER or self:getStorageValue(POINTSSTORAGE) >= 40 and RANK_BIGGAMEHUNTER or self:getStorageValue(POINTSSTORAGE) >= 20 and RANK_RANGER or self:getStorageValue(POINTSSTORAGE) >= 10 and RANK_HUNTSMAN or self:getStorageValue(JOIN_STOR) == 1 and RANK_JOIN or RANK_NONE)
end
function Player.getPawAndFurPoints(self)
return math.max(self:getStorageValue(POINTSSTORAGE), 0)
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 Player.getTasks(self)
local canmake = {}
local able = {}
for k, v in pairs(tasks) do
if self:getStorageValue(QUESTSTORAGE_BASE + k) < 1 and self:getStorageValue(REPEATSTORAGE_BASE + k) < repeatTimes then
able[k] = true
if self:getLevel() < v.level[1] or self:getLevel() > v.level[2] then
able[k] = false
end
if v.storage and self:getStorageValue(v.storage[1]) < v.storage[2] then
able[k] = false
end
if v.rank then
if self:getPawAndFurRank() < v.rank then
able[k] = false
end
end
if v.premium then
if not self:isPremium() then
able[k] = false
end
end
if able[k] then
canmake[#canmake + 1] = k
end
end
end
return canmake
end
function Player.canStartTask(self, 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 self:getStorageValue(QUESTSTORAGE_BASE + id) > 0 then
return false
end
if self:getStorageValue(REPEATSTORAGE_BASE + id) >= repeatTimes or v.norepeatable and self:getStorageValue(REPEATSTORAGE_BASE + id) > 0 then
return false
end
if v.level and self:getLevel() >= v.level[1] and self:getLevel() <= v.level[2] then
if v.premium then
if self:isPremium() then
if v.rank then
if self:getPawAndFurRank() >= v.rank then
if v.storage then
if self:getStorageValue(v.storage[1]) >= v.storage then
return true
end
else
return true
end
end
else
return true
end
else
return true
end
else
return true
end
end
return false
end
function Player.getStartedTasks(self)
local tmp = {}
for k, v in pairs(tasks) do
if self:getStorageValue(QUESTSTORAGE_BASE + k) > 0 and self:getStorageValue(QUESTSTORAGE_BASE + k) < 2 then
tmp[#tmp + 1] = k
end
end
return tmp
end
--in case other scripts are using these functions, i'll let them here
function getPlayerRank(cid) local p = Player(cid) return p and p:getPawAndFurRank() end
function getPlayerTasksPoints(cid) local p = Player(cid) return p and p:getPawAndFurPoints() end
function getTasksByPlayer(cid) local p = Player(cid) return p and p:getTasks() end
function canStartTask(cid, name, table) local p = Player(cid) return p and p:canStartTask(name, table) end
function getPlayerStartedTasks(cid) local p = Player(cid) return p and p:getStartedTasks() end
i linked the lib on global.lua
dofile('data/lib/miscellaneous/killingInTheNameOfQuest.lua')
Attachments
-
global.lua13.8 KB · Views: 3 · VirusTotal
-
Grizzly Adams.xml273 bytes · Views: 1 · VirusTotal
-
grizzlyadams.lua19.4 KB · Views: 0 · VirusTotal
-
killingInTheNameOfQuest.lua16.6 KB · Views: 1 · VirusTotal