Can you reset pressure plates?

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
Scorcher24
Posts: 34
Joined: Thu Apr 12, 2012 8:32 am

Can you reset pressure plates?

Post by Scorcher24 »

Code: Select all

function PlateOne()
end

function PlateTwo()

	if ( pressure_riddle_1:isDown() == false ) then
	
		spawn("poison_cloud", party.level, party.x, party.y, 0)
		resetAllPlates()
		
	end
end


function PlateThree() 

	if ( pressure_riddle_1:isDown() == false or 
	     pressure_riddle_1:isDown() == false ) then
	
		spawn("poison_cloud", party.level, party.x, party.y, 0)
		resetAllPlates()
		
	end
end

function PlateFour()
	if ( pressure_riddle_1:isDown() == false or 
	     pressure_riddle_2:isDown() == false or
	     pressure_riddle_3:isDown() == false) then
	
		spawn("poison_cloud", party.level, party.x, party.y, 0)
		resetAllPlates()
		
	end
	
	if ( pressure_riddle_1:isDown() == true and
	     pressure_riddle_2:isDown() == true and
	     pressure_riddle_3:isDown() == true and
		 pressure_riddle_4:isDown() == true ) then
	
		 pressurePlatePit:close()
		
	end

end

function resetAllPlates()
	--- pressure_riddle_1:reset()
	--- pressure_riddle_2:reset()
	--- pressure_riddle_3:reset()
	--- pressure_riddle_4:reset()
end
resetAllPlates() does not work obviously, it says call to nil, which means they don't exist.
Is there a workaround?
I'd like to keep the plates in an "activate once" state, but there seems no way to do this kind of riddle.
When the user activates 4 first as example, the pit actually never closes, unless I would put the check if all plates have been pressed into all functions.
User avatar
Montis
Posts: 340
Joined: Sun Apr 15, 2012 1:25 am
Location: Grimrock II 2nd playthrough (hard/oldschool)

Re: Can you reset pressure plates?

Post by Montis »

you could try to "reset" them by setting PressurePlate:setActivateOnce(disable) (or how it works) in the reset function and then enable it again in the function when you step on them. can't say if that works but it's worth a shot imho.
When destiny calls, the chosen have no choice.

My completed dungeon (LoG1): Hypercube
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Can you reset pressure plates?

Post by Komag »

So the player has access to four plates and must step on them in the correct order? If they step on the wrong one next and poison cloud hits them, do they get teleported away? Or can they continue stepping all over the place onto more plates to get away? I'm just thinking, if they step on the wrong plate, they're still on it, so you can't really reset everything unless you teleport them off.

Also, each successive plate check only need check for the previous plate, not all the previous ones. so plate 3 only needs to check that plate 2 is down (since plate 2 couldn't be down unless plate 1 was down anyway)

Yeah, you might try to toggle the:
PressurePlate:setActivateOnce(enable)
If set to true, the pressure plate can only be triggered once.

so you could teleport the player away into a poison cloud, turn of the activate once feature, turn it back on, and see if that works.
Finished Dungeons - complete mods to play
User avatar
Scorcher24
Posts: 34
Joined: Thu Apr 12, 2012 8:32 am

Re: Can you reset pressure plates?

Post by Scorcher24 »

Thanks for all the suggestions gonna try that :).
User avatar
Scorcher24
Posts: 34
Joined: Thu Apr 12, 2012 8:32 am

Re: Can you reset pressure plates?

Post by Scorcher24 »

Code: Select all

function PlateOne()
end

function PlateTwo()

	if ( pressure_riddle_1:isDown() == false ) then
	
		teleporter_riddle_2:activate()	
		deactivatePlates()
		spawn("poison_cloud", party.level, 13, 10, 0)		
		
	end
end


function PlateThree() 

	if ( pressure_riddle_2:isDown() == false ) then
	
			teleporter_riddle_3:activate()
			deactivatePlates()
			spawn("poison_cloud", party.level, 13, 10, 0)
			
	end
end

function PlateFour()
	if ( pressure_riddle_3:isDown() == false) then
	
		teleporter_riddle_4:activate()
		deactivatePlates()
		spawn("poison_cloud", party.level, 13, 10, 0)	
				
	end
	
	if ( pressure_riddle_1:isDown() == true and
	     pressure_riddle_2:isDown() == true and
	     pressure_riddle_3:isDown() == true and
		 pressure_riddle_4:isDown() == true ) then
	
		 pressurePlatePit:close()
		
	end

end

function onHiddenPressurePlate()		
	reactivatePlates()
end

function reactivatePlates()
	pressure_riddle_1:setActivateOnce(true)
	pressure_riddle_2:setActivateOnce(true)
	pressure_riddle_3:setActivateOnce(true)
	pressure_riddle_4:setActivateOnce(true)
	
	teleporter_riddle_2:deactivate()
	teleporter_riddle_3:deactivate()
	teleporter_riddle_4:deactivate()
end

function deactivatePlates()
	pressure_riddle_1:setActivateOnce(false)
	pressure_riddle_2:setActivateOnce(false)
	pressure_riddle_3:setActivateOnce(false)
	pressure_riddle_4:setActivateOnce(false)	
end
Thats the final code.
I added 3 Teleporters to the level and 1 additional hidden_pressure_plate.
Well I hope there will be a reset() function and/or party:teleport() soon :P
psoliagkouras
Posts: 2
Joined: Fri Jan 18, 2013 2:06 pm

Re: Can you reset pressure plates?

Post by psoliagkouras »

Hello,
I wanted to ask if this actually works.
Does this line

pressure_riddle_1:setActivateOnce(false)

make the pressure plate named "pressure_riddle_1" (which was initially set to activate once) to deactivate (i.e. pop back up) ?
Because i couldn't recreate it in the editor, while the opposite works (to make a pressure plate that is used many times, the next time that it is pressed to stay down).

Thanks in advance.
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Can you reset pressure plates?

Post by Komag »

I've never actually tried it. You could always destroy it and spawn a new one in it's place
Finished Dungeons - complete mods to play
Post Reply