You can try this, but I warn you, this kind of scripts needs grimq
viewtopic.php?f=14&t=4256&hilit=grimq
because the script I'm going to write will not work if the items are inside sacks, boxes, mortars, ecc...
A script with grimq will provide that kind of stuff, but unfortunately I'm not good using it

Anyway, here's the script, I've tested it and it's working
Code: Select all
function checkItems()
local treasure1 = false
local treasure2 = false
local treasure3 = false
local treasures = {
"golden_crown", "golden_dragon", "golden_orb"}
local checks = {
treasure1, treasure2, treasure3}
for i = 1, 4 do
for j = 1, 31 do
local item = party:getChampion(i):getItem(j)
for k, v in ipairs(treasures) do
if item then
if item.name == v then
checks[k] = true
end
end
end
end
end
for i, v in ipairs(checks) do
if not v then
door2:open()
return
end
end
door1:open()
end
EDIT:
Okay, I've managed to create a code that seek for items even inside sacks, boxes, etc... and seems working good.
Here's the new code.
Code: Select all
function checkItems()
local treasure1 = false
local treasure2 = false
local treasure3 = false
local treasures = {
"golden_crown", "golden_dragon", "golden_orb"}
local checks = {
treasure1, treasure2, treasure3}
for i = 1, 4 do
for j = 1, 31 do
local item = party:getChampion(i):getItem(j)
for k, v in ipairs(treasures) do
if item then
if item.name == "sack" or item.name == "mortar" or item.name == "wooden_box" then
for x in item:containedItems() do
if x then
if x.name == "mortar" then
for y in x:containedItems() do
if y then
if y.name == v then
checks[k] = true
end
end
end
end
end
if x.name == v then
checks[k] = true
end
end
end
if item.name == v then
checks[k] = true
end
end
end
end
end
for i, v in ipairs(checks) do
if not v then
door2:open()
return
end
end
door1:open()
end
Let me know if you have problems
