I have actually a puzzle with a script that check weight in 4 alcoves:
Please can someone tell me if there is something wrong in my script, because sometimes players don't success to this puzzle, or they have to put items in a bag to have the exact weight, because putting the items directly in the alcove won't always work.
here is the script:
when 1,2,4 and 8 kg are placed on four alcoves (alcw1 1kg, alcw2 2kg, ect..) it opens a door (iron_weight).
Code: Select all
weight = 0
weight2 = 0
weight3 = 0
weight4 = 0
finish = 0
function weightcheck()
if finish == 0 then
weight = 0
weight2 = 0
weight3 = 0
weight4 = 0
for i in alcw1:containedItems() do
weight = weight + i:getWeight()
end
for j in alcw2:containedItems() do
weight2 = weight2 + j:getWeight()
end
for k in alcw3:containedItems() do
weight3 = weight3 + k:getWeight()
end
for l in alcw4:containedItems() do
weight4 = weight4 + l:getWeight()
end
check()
end
end
function check()
if finish == 0 then
if weight == 1 and
weight2 == 2 and
weight3 == 4 and
weight4 == 8 then
iron_weight:open()
playSound("secret")
party:getChampion(1):gainExp(800)
party:getChampion(2):gainExp(800)
party:getChampion(3):gainExp(800)
party:getChampion(4):gainExp(800)
hudPrint("800xp gained")
finish = 1
else
iron_weight:close()
end
end
end