• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

RevScripts Task - Change Mobs

walltimer

Active Member
Joined
Aug 5, 2020
Messages
170
Reaction score
26
Why, when i change monsters to my own (like it was trolls - changed to rotworms), quetslog still counts TROLLS not ROTWORMS, so the task cant be done.

--[[
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 = 20,
raceName = "RotWorm",
level = {6, 1999},
premium = true,
creatures = {
"Rotworm"
},
rewards = {
{type = "exp", value = {10000}},
{type = "item", value = {40407, 10}},
}
},

[2] = {
killsRequired = 50,
raceName = "Cyclops",
level = {6, 1999},
premium = true,
creatures = {
"Cyclops",
"Cyclops Drone"
},
rewards = {
{type = "exp", value = {20000}},
{type = "item", value = {40407, 20}},
}
},
[3] = {
killsRequired = 100,
raceName = "Dragon",
level = {6, 19},
premium = true,
creatures = {
"Dragon",
"Dragon Lord"
},
rewards = {
{type = "exp", value = {30000}},
{type = "item", value = {40407, 30}},
}
},


}

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

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



OTSERVBR 1.3TFS , TIBIA 12.64
 
I had the same thing, I kept literally one week trying to solve it. I deleted this entire Killing in the name of quest from my server, and installed a different one converting to Rev.
 
Back
Top