Temple_pit coding issue

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
Zerosangheili
Posts: 7
Joined: Tue Mar 05, 2013 2:41 am

Temple_pit coding issue

Post by Zerosangheili »

I'm attempting to make a full set of pits open/close, but can't seem to get it to work correctly. I'm extremely new to any type of coding, so bear with me here.

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.
Image

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
Any help at all would be greatly appreciated. Thank you.
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: Temple_pit coding issue

Post by msyblade »

remove ALL of the "ands :), let me know if you still have an error
Currently conspiring with many modders on the "Legends of the Northern Realms"project.

"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
Zerosangheili
Posts: 7
Joined: Tue Mar 05, 2013 2:41 am

Re: Temple_pit coding issue

Post by Zerosangheili »

So simple. I can't believe I didn't try that. Thank you very much.
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Temple_pit coding issue

Post by Komag »

Code: Select all

Pit Trap
function pullLever()
  local lv = false
  if accessLever3:getLeverState() == "activated" and
     accessLever4:getLeverState() == "activated" then
     lv = true
  end
  for i=1,13 do
    local p = findEntity("trapPit"..i)
    if p then if lv then p:open() else p:close() end end
  end
end
Finished Dungeons - complete mods to play
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: Temple_pit coding issue

Post by msyblade »

Damn, I wish i could do that, lol.
Currently conspiring with many modders on the "Legends of the Northern Realms"project.

"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
Post Reply