• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Quest Chest

Oskar1121

Excellent OT User
Joined
Jul 15, 2009
Messages
662
Reaction score
638
Location
Poland
First go to data/lib/050-function.lua and paste:
PHP:
--Functions by Oskar--
function doAddExp(cid, amount)
    doSendAnimatedText(getCreaturePosition(cid), amount, COLOR_WHITE)
    return doPlayerAddExperience(cid, amount) or false
end

function doScanContainer(item, backpack, tables, count)
    if isContainer(item.uid) then
        for i = 0, getContainerSize(item.uid) do
            local item = getContainerItem(item.uid, i)
            if not(isContainer(item.uid)) then
                table.insert(tables, item.itemid)
                table.insert(count, item.type)
            else
                table.insert(backpack, item.itemid)
                doScanContainer(item, backpack, tables, count)
            end
        end
    end
end
Now go to data/actions/scripts and make quest.lua file and paste:
PHP:
--Script by Oskar--
local item_dajacy_expa = 6527
local mnoznik_expa = 100
local czy_inne_bp = "no"

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.actionid == 2001 then
        storage = item.uid
    else
        storage = item.actionid
    end
if getPlayerStorageValue(cid, storage) == -1 then
    local backpack, tabelka, counts, b, expe, cap = {}, {}, {}, 1, 0, 0
    doScanContainer(item, backpack, tabelka, counts)
    x = "Znalazles "
    if #backpack ~= 0 then
        local rand = math.random(1,#backpack)
        bp = backpack[rand]
        cap = cap + getItemInfo(bp).weight
        table.remove(backpack, rand)
        bag = doPlayerAddItem(cid, bp, 1)
        x = x .. getItemNameById(bp)..", a w nim "
    end
        for v = #tabelka, 1, -1 do
            if isInArray({item_dajacy_expa, 0}, tabelka[v]) then
                if tabelka[v] == item_dajacy_expa then
                    expe = expe + counts[v] * mnoznik_expa
                end
                table.remove(tabelka, v)
                table.remove(counts, v)
            else
                if counts[v] == 0 then counts[v] = 1 end
                cap = cap + (getItemInfo(tabelka[v]).weight * counts[v])
            end
        end
    if getPlayerFreeCap(cid) >= cap then
        for c = #tabelka, 1, -1 do
            if bag == nil then
                doPlayerAddItem(cid, tabelka[c], counts[c], true)
            else
                doAddContainerItem(bag, tabelka[c], counts[c])
            end
            if #backpack >= c and czy_inne_bp == "yes" then
                doAddContainerItem(bag, backpack[c], 1)
            end
            if isItemStackable(tabelka[c]) and counts[c] > 1 then
                counts[c] = counts[c] .. " "
            else
                counts[c] = ""
            end
        end
            for s = 1, #tabelka do
                if s < #tabelka - b then
                    x = x .. counts[s] .. getItemNameById(tabelka[s]) .. ", "
                elseif s == #tabelka - b then
                    x = x .. counts[s] .. getItemNameById(tabelka[s]) .. " oraz "
                else
                    x = x .. counts[s] .. getItemNameById(tabelka[s]) .. "."
                end
            end
            if expe ~= 0 then
                doAddExp(cid, expe)
            end
        if not(x == "Znalazles ") then
            if bp ~= nil then
                if not(x == "Znalazles "..getItemNameById(bp)..", a w nim ") then
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, x)
                    doPlayerSetStorageValue(cid, storage, 1)
                else
                    doRemoveItem(bag)
                    return false
                end
            else
                doPlayerSetStorageValue(cid, storage, 1)
            end
        else
            return false
        end
    else
        x = "Potrzebujesz przynajmniej "..cap.." oz. wolnego capa."
    end
else
    x = "Pusto."
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, x)
return true
end
Into actions.xml paste:
PHP:
<action fromaid="2001" toaid="2005" event="script" value="quest.lua"/>
If you use actionid 2001 then uid is storage, but when you use other actionid than 2001 then actionid is storage.
Put items into chest/crate, change actionid and quest is complete.

12:17 You have found pirate backpack with ceremonial ankh, death ring, life ring, 3 orichalcum pearl, 5 white pearl, 2 soul orb, 11 silver coin, sudden death rune, sudden death rune, ultimate healing rune, ultimate healing rune, ultimate healing rune, blank rune and great mana potion.

s2v0co.jpg
 
Last edited:
REALLY REALLY REALLY REALLY GOOD MAN!!

If i put on a book with a text inside, the text appears after player complete quest?
 
-nothing, my question was silly sory xd-
to be less offtopic i write another one.
I already have 2001-2005 aids on my ot to other quest system but chests don't working for me so can your work be as whole quest system?
 
Last edited:
Back
Top