First go to data/lib/050-function.lua and paste:
Now go to data/actions/scripts and make quest.lua file and paste:
Into actions.xml paste:
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.
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
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
PHP:
<action fromaid="2001" toaid="2005" event="script" value="quest.lua"/>
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.

Last edited: