• 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!

[1.5] Simple Task 4.0 | Vodkart

added the functions to data/global.lua ?
yes added everything , when i speak to npc and say task he doesnt say anything back and i get this error
Post automatically merged:

yes added everything , when i speak to npc and say task he doesnt say anything back and i get this error
ok i changed the GetContainer thing and it worked lol, but i cant choose what task to do it only gives me random task
Post automatically merged:

yes added everything , when i speak to npc and say task he doesnt say anything back and i get this error
Post automatically merged:


ok i changed the GetContainer thing and it worked lol, but i cant choose what task to do it only gives me random task
also noticed its not counting monsters i killed
 
Last edited:
yes added everything , when i speak to npc and say task he doesnt say anything back and i get this error
Post automatically merged:


ok i changed the GetContainer thing and it worked lol, but i cant choose what task to do it only gives me random task
Post automatically merged:


also noticed its not counting monsters i killed
Fix to Creatures not counting towards Task
- If its not counting the monsters; check if it is written with Capitals in monsters.xml
----
Recieve Reward in Backpack
- There is an issue that it doesnt give reward inside the backpack, I just now updated the script per last post of owner, but not tested yet, will do tomorrow
This now works correctly per updated backpack part of the script.

Still figuring out

Currently still an issue with taking items, for example if I put items = {{2674,5}} it doesn't complete the task and gives console error (will provide/fix tomorrow gonna go sleepy)
- Does work without delivering items and just killing monsters.
- Haven't tested daily tasks yet although it seems to take either a random or always the 3th option hmm, might call this a feature as in daily chores to do..

Console Error
Lua:
Lua Script Error: [Npc interface]
data/npc/scripts/taskdaily.lua:onCreatureSay
data/npc/scripts/taskdaily.lua:53: attempt to call global 'doRemoveItemsFromList' (a nil value)
stack traceback:
        [C]: in function 'doRemoveItemsFromList'
        data/npc/scripts/taskdaily.lua:53: in function 'callback'
        data/npc/lib/npcsystem/npchandler.lua:401: in function 'onCreatureSay'
        data/npc/scripts/taskdaily.lua:7: in function <data/npc/scripts/taskdaily.lua:7>

Good system overall though will be very useful!
You can adapt the scripts to work with Quest Logs and voila you have a quest system


Current global.xml
Code:
task_sys = {
    [1] = {name = "Rat Whisperer", start = 176201, monsters_list = {"Rat"}, level = 1, count = 10, points = 0, items = {}, reward = {{2674,5}}, exp = 100, money = 10},
    [2] = {name = "Cave Rats Spotted!", start = 176201, monsters_list = {"Cave Rat"}, level = 3, count = 5, points = 0, items = {}, reward = {{2580,1}}, exp = 150, money = 15},
    [3] = {name = "Trouble in the Old Forest", start = 176201, monsters_list = {"Huorn"}, level = 8, count = 10, points = 0, items = {}, reward = {{2160,30}}, exp = 250, money = 50},

}
daily_task = {
    [1] = {name = "Daily Rat" ,monsters_list = {"Rat"}, count = 10, points = 3, reward = {{2674,5}}, exp = 100, money = 10},
    [2] = {name = "Daily Cave Rat" ,monsters_list = {"Cave Rat"}, count = 50, points = 3, reward = {{2173,1}}, exp = 130, money = 20},
 
}
task_sys_storages = {176601, 176602, 176603, 176604, 176605, 176606, 176607, 176608} -- task, points, count, daily task, daily count, daily time , daily start, contador
function Player.getTaskMission(self)
 
    return self:getStorageValue(task_sys_storages[1]) < 0 and 1 or self:getStorageValue(task_sys_storages[1])
end
function Player.getDailyTaskMission(self)
 
    return self:getStorageValue(task_sys_storages[4]) < 0 and 1 or self:getStorageValue(task_sys_storages[4])
end
function Player.getTaskPoints(self)
 
    return self:getStorageValue(task_sys_storages[2]) < 0 and 0 or self:getStorageValue(task_sys_storages[2])
end

function Player.randomDailyTask(self)
    local t = {
        [{6,49}] = {1,3},
        [{50,79}] = {1,3},
        [{80,129}] = {1,3},
        [{130,math.huge}] = {1,3}
    }
    for a , b in pairs(t) do
        if self:getLevel()  >= a[1] and self:getLevel() <= a[2] then
            return math.random(b[1], b[2])
        end
    end
    return 0
end
function Player.GetRankTask(self)
    local ranks = {
        [{1, 20}] = "Huntsman",
        [{21, 50}] = "Ranger",
        [{51, 100}] = "Big Game Hunter",
        [{101, 200}] = "Trophy Hunter",
        [{201, math.huge}] = "Elite Hunter"
    }
    for v , r in pairs(ranks) do
        if self:getTaskPoints() >= v[1] and self:getTaskPoints() <= 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] .. ' ' .. getItemName(items[i][1])
            if i ~= table.maxn(items) then str = str .. ', '
            end
        end
    end
    return str
end


function Player.doRemoveItemsFromList(self,items)
    local count = 0
    if table.maxn(items) > 0 then
        for i = 1, table.maxn(items) do
            if self:getItemCount(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 self:removeItem(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 Player.GiveRewardsTask(self, items)
    local backpack = self:addItem(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
            backpack:addItem(item, amount)
        else
            for i = 1, amount do
                backpack:addItem(item, 1)
            end
        end
    end
end
 
Last edited:
This system is perfect.I would like to know how to make the player choose the task and count in the party
 
Back
Top