Hello everyone! I have problem with my script (this one is from dreamer challenge quest - teleport from pillow room). When the pillows are unordered and I enter the teleport I get debug, when I login I'm teleported to the position. When the pillows are putted in order I get debug, when I login I'm in the position which I should be only when the puzzles are unordered.
Code:
function onStepIn(cid, item, pos)
local nextroom = {x=449, y=657, z=13}
-- blue pillows --
pillowbid = 1686
for pillowbx = 999, 1001 do
for pillowby = 843, 845 do
pillowb = {x=pillowbx, y=pillowby, z=9, stackpos=1}
-- green pillows --
pillowgid = 1688
for pillowgx = 1002, 1004 do
for pillowgy = 843, 845 do
pillowg = {x=pillowgx, y=pillowgy, z=9, stackpos=1}
-- red pillows --
pillowrid = 1687
for pillowrx = 999, 1001 do
for pillowry = 846, 848 do
pillowr = {x=pillowrx, y=pillowry, z=9, stackpos=1}
-- yellow pillows --
pillowyid = 1689
for pillowyx = 1002, 1004 do
for pillowyy = 846, 848 do
pillowy = {x=pillowyx, y=pillowyy, z=9, stackpos=1}
if (getThingfromPos(pillowb).itemid == pillowbid) and (getThingfromPos(pillowg).itemid == pillowgid) and (getThingfromPos(pillowr).itemid == pillowrid) and (getThingfromPos(pillowy).itemid == pillowyid) then
doTeleportThing(cid, nextroom)
doSendMagicEffect(nextroom,10)
else
doTeleportThing(cid, {x=pos.x-3, y=pos.y, z=pos.z})
doSendMagicEffect({x=pos.x-3, y=pos.y, z=pos.z},10)
end
end
end
end
end
end
end
end
end
return true
end