Page 1 of 1
Can you reset pressure plates?
Posted: Sat Sep 15, 2012 9:07 pm
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.
Re: Can you reset pressure plates?
Posted: Sat Sep 15, 2012 9:48 pm
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.
Re: Can you reset pressure plates?
Posted: Sat Sep 15, 2012 11:49 pm
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.
Re: Can you reset pressure plates?
Posted: Sat Sep 15, 2012 11:51 pm
by Scorcher24
Thanks for all the suggestions gonna try that

.
Re: Can you reset pressure plates?
Posted: Tue Sep 18, 2012 12:41 am
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

Re: Can you reset pressure plates?
Posted: Fri Jan 18, 2013 8:25 pm
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.
Re: Can you reset pressure plates?
Posted: Fri Jan 18, 2013 9:07 pm
by Komag
I've never actually tried it. You could always destroy it and spawn a new one in it's place