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

TFS 1.X+ attempt to call method 'getStartedTasks' (a nil value)

Jeyci

Banned User
Joined
May 6, 2023
Messages
289
Solutions
3
Reaction score
36
tfs 1.5 -8.6
as title says, how can i resolve this?

This is the script that is causing the error
Lua:
function onKill(player, target)
    if target:isPlayer() or target:getMaster() then
        return true
    end
    

    local targetName, startedTasks, taskId = target:getName():lower(), player:getStartedTasks()
    for i = 1, #startedTasks do
        taskId = startedTasks[i]
        if isInArray(tasks[taskId].creatures, targetName) then
            local killAmount = player:getStorageValue(KILLSSTORAGE_BASE + taskId)
            if killAmount < tasks[taskId].killsRequired then                               
                player:setStorageValue(KILLSSTORAGE_BASE + taskId, killAmount + 1)               
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE,'You kill: ' .. killAmount + 1 .. "/" .. tasks[taskId].killsRequired .. " " ..tasks[taskId].raceName)
            else               
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE,'You complete task of ' ..tasks[taskId].raceName)                                 
            end
        end
    end
    return true
end

--MESSAGE_STATUS_DEFAULT
 
Solution
Yes i know. i need it, hope somebody could share it with me or by which function should i replace this one
Post automatically merged:

solved here is the missing function
Lua:
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
Yes i know. i need it, hope somebody could share it with me or by which function should i replace this one
Post automatically merged:

solved here is the missing function
Lua:
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
 
Last edited:
Solution
Back
Top