• 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.4| 10.98 | RME Bug Quests for Chest not working?

SebbePwnyou

New Member
Joined
Jan 14, 2015
Messages
19
Reaction score
3
Hello, i recently started mapping for my Server again and it seems that Quest ActionID: 2000 doesn't work? is there something that was changed in TFS 1.4 or with RME 10.98 with doing ActionID 2000?

RMEBug1.PNG

RMEBug2.PNG
Actions.xml
XML:
<action actionid="2000" script="quests/questsystem.lua" />

questsystem.lua

Lua:
local specialQuests = {
    [2215] = 2215, -- Annihilator

}

local questsExperience = {
    [2215] = 100000, --anni

}

local questOutfits = {
    [2215] = {female = 542, male = 541}, --anni demon outfit

}

local questAddons = {

}

local questMount = {

}

local tutorialIds = {
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local storage = specialQuests[item.actionid]
    if not storage then
        storage = item.uid
        if storage > 65535 then
            return false
        end
    end

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

    local targetItem = Item(item.uid)
    local items = {}
    local reward = nil

    local size = targetItem:isContainer() and Container(item.uid):getSize() or 0
    if size == 0 then
        reward = targetItem:clone()
    else
        local container = Container(item.uid)
        for i = 0, container:getSize() - 1 do
            table.insert(items, container:getItem(i):clone())
        end
    end

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

    local result = ''
    local weight = 0
    if reward then
        local ret = ItemType(reward:getId())
        if ret:isRune() then
            result = ret:getArticle() .. ' ' ..  ret:getName() .. ' (' .. reward:getSubType() .. ' charges)'
        elseif ret:isStackable() and reward:getCount() > 1 then
            result = reward:getCount() .. ' ' .. ret:getPluralName()
        else
            result = ret:getArticle() .. ' ' .. ret:getName()
        end
        weight = weight + ret:getWeight(reward:getCount())
    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')
            else
                local ret = ', '
                if i == size then
                    ret = ' and '
                elseif i == 1 then
                    ret = ''
                end
                result = result .. ret

                local ret = ItemType(tmp:getId())
                if ret:isRune() then
                    result = result .. ret:getArticle() .. ' ' .. ret:getName() .. ' (' .. tmp:getSubType() .. ' charges)'
                elseif ret:isStackable() and tmp:getCount() > 1 then
                    result = result .. tmp:getCount() .. ' ' .. ret:getPluralName()
                else
                    result = result .. ret:getArticle() .. ' ' .. ret:getName()
                end
                weight = weight + ret:getWeight(tmp:getCount())
            end
        end
        weight = weight + ItemType(reward:getId()):getWeight()
    end

    if player:addItemEx(reward) ~= RETURNVALUE_NOERROR then
        if player:getFreeCapacity() < weight then
            player:sendCancelMessage('You have found ' .. result .. ' weighing ' .. string.format('%.2f', weight) .. ' oz. You have no capacity.')
        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 questOutfits[storage] then
    player:addOutfit(questOutfits[storage].female)
    player:addOutfit(questOutfits[storage].male)
    end

    if questAddons[storage] then
    player:addOutfitAddon(questAddons[storage].female, questAddons[storage].addon)
    player:addOutfitAddon(questAddons[storage].male, questAddons[storage].addon)
    end

    if questMount[storage] then
    player:addMount(questMount[storage].mountId)
    end

    if tutorialIds[storage] then
        player:sendTutorial(tutorialIds[storage])
        if item.uid == 50080 then
            player:setStorageValue(Storage.RookgaardTutorialIsland.SantiagoNpcGreetStorage, 3)
        end
    end

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

EDIT///
Used a script to give me the key with the actionID so I can open the door with the same ActionID, shame you can't make it in the editor :( Also added Silba's solution for normal quests.
 
Last edited:
Solution
default is called quests.lua in actions\scripts\quests\quests.lua
but using the default quests.lua doesn't work either.
default quest system uses unique id, so to get snakebite rod from chest you put unique id as 2182 which is the same item id as snakebite rod. It's a very stupid and inflexible system, but that's how it works.
default is called quests.lua in actions\scripts\quests\quests.lua
but using the default quests.lua doesn't work either.
default quest system uses unique id, so to get snakebite rod from chest you put unique id as 2182 which is the same item id as snakebite rod. It's a very stupid and inflexible system, but that's how it works.
 

Attachments

  • Screenshot 2021-10-18 025414.png
    Screenshot 2021-10-18 025414.png
    295.3 KB · Views: 21 · VirusTotal
Solution
default quest system uses unique id, so to get snakebite rod from chest you put unique id as 2182 which is the same item id as snakebite rod. It's a very stupid and inflexible system, but that's how it works.
Ah so I need a script for the chest that gives the item w/ actionID on it for a door?
 
Ah so I need a script for the chest that gives the item w/ actionID on it for a door?
Not sure what you mean but if you're talking about quest doors then you just set the quest door action id to the storage value that the player is given from the quest, for a chest quest you just set the door action id to the chest unique id, then they can only open the door once they open the chest.
 
Not sure what you mean but if you're talking about quest doors then you just set the quest door action id to the storage value that the player is given from the quest, for a chest quest you just set the door action id to the chest unique id, then they can only open the door once they open the chest.
I need to get a key with a actionID on it, to unlock a door with the same actionID
Post automatically merged:

I just used a script that gives me the key with an actionid on it. And attached the ActionID to the chest, thanks for the help with how to make a normal quest for a normal item :)
 
Last edited:
Back
Top