The alcoves are paired so they must have identical items before their matched door opens.
The first combination of two filled alcoves works correctly, but each following alcove pair opens the next door with only one alcove filled.
Any ideas? I know there has to be an easier way to do this.
Code: Select all
-- run this script _once for each item_ with a matching name
function check1()
-- change these variables to match your alcove's ID and the item you want to test for
local itemName = "XXXXXX"
local alcoveID01 = alcove_1
local alcoveID02 = alcove_2
-- iterate through all the contained items on alcove, checking for a matching name
for i in alcoveID01:containedItems() and alcoveID02:containedItems() do
if i.name == itemName then
itemFound1()
else
itemNotFound1()
end
end
end
-- run this script _once for each item_ with a matching name
function itemFound1()
door1:open()
end
-- run this script _once for each item_ without a matching name
function itemNotFound1()
door1:close()
spawn("poison_cloud", party.level, party.x, party.y, 0)
end
-- run this script _once for each item_ with a matching name
function check2()
-- change these variables to match your alcove's ID and the item you want to test for
local itemName = "XXXXXX"
local alcoveID03 = alcove_3
local alcoveID04 = alcove_4
-- iterate through all the contained items on alcove, checking for a matching name
for i in alcoveID03:containedItems() and alcoveID04:containedItems() do
if i.name == itemName then
itemFound2()
else
itemNotFound2()
end
end
end
-- run this script _once for each item_ with a matching name
function itemFound2()
door2:open()
end
-- run this script _once for each item_ without a matching name
function itemNotFound2()
door2:close()
spawn("poison_cloud", party.level, party.x, party.y, 0)
end
-- run this script _once for each item_ with a matching name
function check3()
-- change these variables to match your alcove's ID and the item you want to test for
local itemName = "XXXXXX"
local alcoveID05 = alcove_5
local alcoveID06 = alcove_6
-- iterate through all the contained items on alcove, checking for a matching name
for i in alcoveID05:containedItems() and alcoveID06:containedItems() do
if i.name == itemName then
itemFound3()
else
itemNotFound3()
end
end
end
-- run this script _once for each item_ with a matching name
function itemFound3()
door3:open()
end
-- run this script _once for each item_ without a matching name
function itemNotFound3()
door3:close()
spawn("poison_cloud", party.level, party.x, party.y, 0)
end
-- run this script _once for each item_ with a matching name
function check4()
-- change these variables to match your alcove's ID and the item you want to test for
local itemName = "XXXXXX"
local alcoveID07 = alcove_7
local alcoveID08 = alcove_8
-- iterate through all the contained items on alcove, checking for a matching name
for i in alcoveID07:containedItems() and alcoveID08:containedItems() do
if i.name == itemName then
itemFound4()
else
itemNotFound4()
end
end
end
-- run this script _once for each item_ with a matching name
function itemFound4()
door4:open()
end
-- run this script _once for each item_ without a matching name
function itemNotFound4()
door4:close()
spawn("poison_cloud", party.level, party.x, party.y, 0)
end
-- run this script _once for each item_ with a matching name
function check5()
-- change these variables to match your alcove's ID and the item you want to test for
local itemName = "XXXXXX"
local alcoveID09 = alcove_9
local alcoveID10 = alcove_10
-- iterate through all the contained items on alcove, checking for a matching name
for i in alcoveID09:containedItems() and alcoveID10:containedItems() do
if i.name == itemName then
itemFound5()
else
itemNotFound5()
end
end
end
-- run this script _once for each item_ with a matching name
function itemFound5()
door5:open()
end
-- run this script _once for each item_ without a matching name
function itemNotFound5()
door5:close()
spawn("poison_cloud", party.level, party.x, party.y, 0)
end