• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[Request] Use Item Get Full Set

God Mythera

Veteran OT User
Joined
Aug 11, 2012
Messages
2,051
Solutions
2
Reaction score
260
Location
United States
Hello and id like to make it so when you use a item (box, bag, ect) you get a full set.

For example:

ID: 2462
L4KDiwT.gif


ID: 2476
ZHUZHMa.gif


ID: 2477
LlGBssI.gif


ID: 2528
sqbvPcQ.gif


ID: 2392
M0cI50j.gif


Could anyone help me out? ^.^
 
Something like that?
A quest chest that gives the set inside a bag..?

Code:
function onUse(cid, item, frompos, item2, topos)

if item.itemid == 1740 then -- item you use
queststatus = getPlayerStorageValue(cid, 12345) -- change storage

if queststatus == -1 then
setPlayerStorageValue(cid, 12345, 1) -- change storage
local bag = doPlayerAddItem(cid,1987,1)
doAddContainerItem(bag,2462,1)
doAddContainerItem(bag,2476,1)
doAddContainerItem(bag,2477,1)
doAddContainerItem(bag,2528,1)
doAddContainerItem(bag,2392,1)
else
doPlayerSendTextMessage(cid, 22, "it is empty.")
end
end

return 1

end
 
Something like that?
A quest chest that gives the set inside a bag..?

Code:
function onUse(cid, item, frompos, item2, topos)

if item.itemid == 1740 then -- item you use
queststatus = getPlayerStorageValue(cid, 12345) -- change storage

if queststatus == -1 then
setPlayerStorageValue(cid, 12345, 1) -- change storage
local bag = doPlayerAddItem(cid,1987,1)
doAddContainerItem(bag,2462,1)
doAddContainerItem(bag,2476,1)
doAddContainerItem(bag,2477,1)
doAddContainerItem(bag,2528,1)
doAddContainerItem(bag,2392,1)
else
doPlayerSendTextMessage(cid, 22, "it is empty.")
end
end

return 1

end
Thanks! works great ^.^
 
Here is a more complex version :p
Code:
-- lets use a table so we can learn a little bit about how they work :)
local c = {
    {id = 1987, amount = 1}, -- index 1, bag
    {id = 2462, amount = 1},
    {id = 2476, amount = 1},
    {id = 2477, amount = 1},
    {id = 2528, amount = 1},
    {id = 2392, amount = 1}, -- index 6
    questStorage = 12345, -- ipairs will ignore this
    useThisItem = 1740, -- ipairs will ignore this
    msg = "it is empty." -- ipairs will ignore this
}

function onUse(cid, item, frompos, item2, topos)
    if item.itemid == c.useThisItem then -- item you use
        if getPlayerStorageValue(cid, c.questStorage) < 1 then
            setPlayerStorageValue(cid, c.questStorage, 1)
            local bag = doPlayerAddItem(cid, c.[1].id, c.[1].amount)
            table.remove(c, 1) -- remove bag from the table
            c.msg = 'You have recieved '
            for _, equipment in ipairs(c) do
                doAddContainerItem(bag, equipment.id, equipment.amount)
                c.msg = c.msg .. ' a ' .. getItemDescriptionsById(equipment.id).name .. ', '
            end
            c.msg = string.sub(c.msg, 1, string.len(c.msg)-1) .. ' as your reward!'
        end
    end
    doPlayerSendTextMessage(cid, 22, c.msg)
    return true
end
Edit: clerical error
 
Last edited:
Back
Top