I have 4 levers in total, but when two are activated I want to block the player in by opening a wall of pits. Opening this wall of pits also releases a strong monster for them to slay. Once slain, the monster will drop the appropriate key to close the pits for the player to continue through the dungeon.
Here is the basic floor plan. The monsters in the center of the room will be released. The others are fillers for now.

This is what I've come up with so far, but I know it's not right. It tells me there's an unexpected symbol near and. Referring to the "trapPit1:open() and"
Code: Select all
Pit Trap
function pullLever()
if accessLever3:getLeverState() == "activated" and
accessLever4:getLeverState() == "activated" then
trapPit1:open() and
trapPit2:open() and
trapPit3:open() and
trapPit4:open() and
trapPit5:open() and
trapPit6:open() and
trapPit7:open() and
trapPit8:open() and
trapPit9:open() and
trapPit10:open() and
trapPit11:open() and
trapPit12:open() and
trapPit13:open()
else
trapPit1:close() and
trapPit2:close() and
trapPit3:close() and
trapPit4:close() and
trapPit5:close() and
trapPit6:close() and
trapPit7:close() and
trapPit8:close() and
trapPit9:close() and
trapPit10:close() and
trapPit11:close() and
trapPit12:close() and
trapPit13:close()
end
end