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

Lua Quests not working

Kthxbye

New Member
Joined
Jul 11, 2012
Messages
122
Reaction score
2
None of my quests are working, I have searched everywhere for a fix.
real map tfs 1.3 10.98 any help at all will be grateful
Thank you.
Quests are giving items but only once every serversave
 
None of my quests are working, I have searched everywhere for a fix.
real map tfs 1.3 10.98 any help at all will be grateful
Thank you.
Quests are giving items but only once every serversave
Can you give an example of 2-3 of these quests?
Maybe a few pictures?

in-game / rme
 
That worked!!! thank you
Would you be able to help me with another issue on this thread or no
If it's regarding a similar issue, yes.

Otherwise, it's better to create a new thread, in case someone has a similar problem in the future.

--
Remember to choose a 'Best Answer' as well.
 
what if i want reward to be 2-100x count ?

If you want something custom, you'll need to use a custom script.
Lua:
local actionId = 45001
local reward = {1111, 2, 100} -- {itemid, amountMin, amountMax}

local action = Action()

function action.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    player:addItem(reward[1], math.random(reward[2], reward[3]), true)
    return true
end

action:aid(actionId)
action:register()
 
If you want something custom, you'll need to use a custom script.
Lua:
local actionId = 45001
local reward = {1111, 2, 100} -- {itemid, amountMin, amountMax}

local action = Action()

function action.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    player:addItem(reward[1], math.random(reward[2], reward[3]), true)
    return true
end

action:aid(actionId)
action:register()
But before i could just add action ID 2000
UNIQ ID ( for storage)

and put all i want in box/bag/ any container what this ( container will have)


I can make this work like before ?
 
But before i could just add action ID 2000
UNIQ ID ( for storage)

and put all i want in box/bag/ any container what this ( container will have)


I can make this work like before ?

🤷‍♀️

Probably have to script it yourself, or find the old version and convert it.

I'd have to assume that the UniqueId is the storage value, and the actionId tells it what script to run.

Then you'd have to loop through the container and copy all the items inside (into a bag?), then attempt to give that to the player, checking for capacity and free space.

Not entirely hard to do.. just time consuming.
 
🤷‍♀️

Probably have to script it yourself, or find the old version and convert it.

I'd have to assume that the UniqueId is the storage value, and the actionId tells it what script to run.

Then you'd have to loop through the container and copy all the items inside (into a bag?), then attempt to give that to the player, checking for capacity and free space.

Not entirely hard to do.. just time consuming.
testing some quetss.lua , i hope it works
Post automatically merged:

🤷‍♀️

Probably have to script it yourself, or find the old version and convert it.

I'd have to assume that the UniqueId is the storage value, and the actionId tells it what script to run.

Then you'd have to loop through the container and copy all the items inside (into a bag?), then attempt to give that to the player, checking for capacity and free space.

Not entirely hard to do.. just time consuming.
it was working perfectly till 1.2 tfs for me, on 1.3+ its different now lol
Post automatically merged:

🤷‍♀️

Probably have to script it yourself, or find the old version and convert it.

I'd have to assume that the UniqueId is the storage value, and the actionId tells it what script to run.

Then you'd have to loop through the container and copy all the items inside (into a bag?), then attempt to give that to the player, checking for capacity and free space.

Not entirely hard to do.. just time consuming.
Lua:
local annihilatorReward = {1990, 2400, 2431, 2494}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.uid <= 1250 or item.uid >= 30000 then
        return false
    end

    local itemType = ItemType(item.uid)
    if itemType:getId() == 0 then
        return false
    end

    local itemWeight = itemType:getWeight()
    local playerCap = player:getFreeCapacity()
    if table.contains(annihilatorReward, item.uid) then
        if player:getStorageValue(PlayerStorageKeys.annihilatorReward) == -1 then
            if playerCap >= itemWeight then
                if item.uid == 1990 then
                    player:addItem(1990, 1):addItem(2326, 1)
                else
                    player:addItem(item.uid, 1)
                end
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. itemType:getName() .. '.')
                player:setStorageValue(PlayerStorageKeys.annihilatorReward, 1)
                player:addAchievement("Annihilator")
            else
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. itemType:getName() .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.')
            end
        else
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "It is empty.")
        end
    elseif player:getStorageValue(item.uid) == -1 then
        if playerCap >= itemWeight then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. itemType:getName() .. '.')
            player:addItem(item.uid, 1)
            player:setStorageValue(item.uid, 1)
        else
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. itemType:getName() .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.')
        end
    else
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "It is empty.")
    end
    return true
end


trying this script but doesnt work

made 2x chests

1.
action id -2000
UNIQID -1251

2.
actionid -2000
UNIQID - 1252

gives reward as UNIQID - ID ... :( its source edit ?
 
Last edited:
@Lbtg this is the quest system you are looking for:

just remove the unwanted stuff and you are done
im not programer at all :D can you please remove those what i dont need ?

I cant find even 2000 action id in the code :O
Post automatically merged:

Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local storage = specialQuests[item.actionid]
    if not storage then
        storage = item.uid
        if storage > 65535 then
            return false
        end
    end

    if player:getStorageValue(storage) > 0 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'The ' .. ItemType(item.itemid):getName() .. ' is empty.')
        return true
    end

    local items, reward = {}
    local size = item:isContainer() and item:getSize() or 0
    if size == 0 then
        reward = item:clone()
    else
        local container = Container(item.uid)
        for i = 0, container:getSize() - 1 do
            items[#items + 1] = container:getItem(i):clone()
        end
    end

    size = #items
    if size == 1 then
        reward = items[1]:clone()
    end

    local result = ''
    if reward then
        local ret = ItemType(reward.itemid)
        if ret:isRune() then
            result = ret:getArticle() .. ' ' ..  ret:getName() .. ' (' .. reward.type .. ' charges)'
        elseif ret:isStackable() and reward:getCount() > 1 then
            result = reward:getCount() .. ' ' .. ret:getPluralName()
        elseif ret:getArticle() ~= '' then
            result = ret:getArticle() .. ' ' .. ret:getName()
        else
            result = ret:getName()
        end
    else
        if size > 20 then
            reward = Game.createItem(item.itemid, 1)
        elseif size > 8 then
            reward = Game.createItem(1988, 1)
        else
            reward = Game.createItem(1987, 1)
        end

        for i = 1, size do
            local tmp = items[i]
            if reward:addItemEx(tmp) ~= RETURNVALUE_NOERROR then
                print('[Warning] QuestSystem:', 'Could not add quest reward to container')
            end
        end
        local ret = ItemType(reward.itemid)
        result = ret:getArticle() .. ' ' .. ret:getName()
    end

    if player:addItemEx(reward) ~= RETURNVALUE_NOERROR then
        local weight = reward:getWeight()
        if player:getFreeCapacity() < weight then
            player:sendCancelMessage(string.format('You have found %s weighing %.2f oz. You have no capacity.', result, (weight / 100)))
        else
            player:sendCancelMessage('You have found ' .. result .. ', but you have no room to take it.')
        end
        return true
    end

    if questsExperience[storage] then
        player:addExperience(questsExperience[storage], true)
    end

    if questLog[storage] then
        player:setStorageValue(questLog[storage], 1)
    end

    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found ' .. result .. '.')
    player:setStorageValue(storage, 1)
    return true
end

like this ? :)


update , no doesnt work getting errors
 
Last edited:
Back
Top