problem with quest chests

Joined
Dec 24, 2010
Messages
733
Best answers
1
Likes
9
#1
hello i have a problem with quest chests
when i put on the remere map editor like aid 2000 and uniqueid random for example for a quest like poi inqui when you only want the player to choose one item.

Its not working when i open the chest you can take the item like a container only one of the chest will give properly like a quest.

im using tfs 1.3

any idea on how can i solvethis? ty
 
Joined
Dec 4, 2017
Messages
69
Best answers
11
Likes
26
#2
what values are you using.
are all the unique id the same for the same quest u want like poi?
 
Joined
Dec 24, 2010
Messages
733
Best answers
1
Likes
9
#3
boots.png

like this all the chest are the same uid but its open like a container and only one chest give it properly like a quest i only want the player to choose ONE , i have other quest like this with the same problem
 
Joined
Dec 4, 2017
Messages
69
Best answers
11
Likes
26
#4
and the action script you are using for 2000 have you edited it at all or is it the original system.lua.
when it returns false i believe you can just open it as a normal chest.
 
Joined
Dec 24, 2010
Messages
733
Best answers
1
Likes
9
#5
this is the script that on actions.xml for aid2000 i have not move this script

Code:
local specialQuests = {
    [2215] = Storage.AnnihilatorDone,
    [2016] = Storage.DreamersChallenge.Reward,
    [10544] = Storage.PitsOfInferno.WeaponReward,
    [12513] = Storage.thievesGuild.Reward,
    [12374] = Storage.WrathoftheEmperor.mainReward,
    [26300] = Storage.SvargrondArena.RewardGreenhorn,
    [27300] = Storage.SvargrondArena.RewardScrapper,
    [28300] = Storage.SvargrondArena.RewardWarlord
}

local questsExperience = {
    [2217] = 1 -- dummy values
}

local questLog = {
    [9130] = Storage.hiddenCityOfBeregar.DefaultStart
}

local tutorialIds = {
    [50080] = 5,
    [50082] = 6,
    [50084] = 10,
    [50086] = 11
}

local hotaQuest = {12102, 12103, 12104, 12105, 12106, 12107}

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

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

    if isInArray(hotaQuest, item.uid) then
        if player:getStorageValue(Storage.TheAncientTombs.DefaultStart) ~= 1 then
            player:setStorageValue(Storage.TheAncientTombs.DefaultStart, 1)
        end
    end

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

Peora

New Member
Joined
Jun 26, 2018
Messages
21
Best answers
1
Likes
9
#6
I am not sure if this type would work in tfs, but could you put in the chests like this:
Lua:
local specialQuests = {
    [10002] = 10001, -- Annihilator
    [10003] = 10001, -- Annihilator
    [10004] = 10001, -- Annihilator
    }
For my server, this makes it so you can only choose 1 chest, and the others say 'you have already completed this quest' if you try them.
Sorry if incorrect, it was a little hard to fully see it. The UID have to be in order, I think, as well.
 

Peonso

Godly Member
Joined
Jan 14, 2008
Messages
1,451
Best answers
22
Likes
923
#8
bump still not working :S
You can't use the same uniqueID.

Code:
local specialQuests = {
    [2215] = Storage.AnnihilatorDone,
    [2016] = Storage.DreamersChallenge.Reward,
    [10544] = Storage.PitsOfInferno.WeaponReward,
    [12513] = Storage.thievesGuild.Reward,
    [12374] = Storage.WrathoftheEmperor.mainReward,
    [26300] = Storage.SvargrondArena.RewardGreenhorn,
    [27300] = Storage.SvargrondArena.RewardScrapper,
    [28300] = Storage.SvargrondArena.RewardWarlord,
    [5672] = 5671,
    [5673] = 5671,
    [5674] = 5671,
}
Use it like this, and use uniqueIDs 5671, 5672, 5673 and 5674.
 
Joined
Dec 24, 2010
Messages
733
Best answers
1
Likes
9
#9
You can't use the same uniqueID.

Code:
local specialQuests = {
    [2215] = Storage.AnnihilatorDone,
    [2016] = Storage.DreamersChallenge.Reward,
    [10544] = Storage.PitsOfInferno.WeaponReward,
    [12513] = Storage.thievesGuild.Reward,
    [12374] = Storage.WrathoftheEmperor.mainReward,
    [26300] = Storage.SvargrondArena.RewardGreenhorn,
    [27300] = Storage.SvargrondArena.RewardScrapper,
    [28300] = Storage.SvargrondArena.RewardWarlord,
    [5672] = 5671,
    [5673] = 5671,
    [5674] = 5671,
}
Use it like this, and use uniqueIDs 5671, 5672, 5673 and 5674.
im using like this and the player can retrieve all the chest (not normal chest) i only want them to pick one

Code:
local specialQuests = {
    [2215] = Storage.AnnihilatorDone,
    [2016] = Storage.DreamersChallenge.Reward,
    [10544] = Storage.PitsOfInferno.WeaponReward,
    [12513] = Storage.thievesGuild.Reward,
    [12374] = Storage.WrathoftheEmperor.mainReward,
    [26300] = Storage.SvargrondArena.RewardGreenhorn,
    [27300] = Storage.SvargrondArena.RewardScrapper,
    [28300] = Storage.SvargrondArena.RewardWarlord,
    [56721] = 56710,
    [56731] = 56710,
    [56741] = 56710,
}
asas.png
 

Peonso

Godly Member
Joined
Jan 14, 2008
Messages
1,451
Best answers
22
Likes
923
#10
One has unique ID 56721, the other 56731 and the other 56741?

Actually I was reading the script, you need to put it as actionID, as uniqueID maybe repeat, put something, also register the action IDs in actions.xml.
 
Last edited:
Joined
Dec 4, 2017
Messages
69
Best answers
11
Likes
26
#11
system.lua checks for actionid inside specialquests first.
if not does uniqueid


function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local storage = specialQuests[item.actionid]

<action actionid="2217" script="quests/system.lua" />

Lua:
local specialQuests = {
    [2215] = Storage.AnnihilatorDone,
    [2016] = Storage.DreamersChallenge.Reward,
    [2217] = Storage.NEWQUESTDONE,
annitest.png
 

Wirless

7.6 is the best :D
Joined
Nov 3, 2012
Messages
1,027
Best answers
1
Likes
187
Location
Ireland-Poland
#13
you dont need actionid for 2000 if you use it like that im sure because thats how i made level reward look at desert quest way its like aid 2000 uid anyu want and u acn take it 1 time
 
Top