If you don't mind, I'll post it here as another standard framework.
THE STARING CONTEST FRAMEWORK
Code: Select all
-- Staring at the south wall opens the secret doors there. -- Changing direction or moving from the plate will deactivate the event. -- by Komag in "Legend of Grimrock: Remake" stareCounter = 0 function stareCheck() if party.facing ~= 2 then stareCounter = 0 return end if party.facing == 2 then stareCounter = stareCounter + 1 end if stareCounter == 120 then stareDoor_1:open() stareDoor_2:open() stareDoor_3:open() end end function stareReset() -- set the starePlate to call this function and -- to deactivate the timer when the party moves off of it -- (i.e. when the plate deactivates). if starePlate:isUp() then stareCounter = 0 end end
Then the door opens when the in-script counter reaches a certain number of unbroken and successful stareChecks. It should be noted that as it stands, this counter total is not in seconds, but in number of times the timer hits 0.1 seconds. So setting the counter total to 10 would be just one second of staring.
Komag uses two pressure plates, one hidden (the real one) and one normal (just for show), though I didn't need to. One reason to do this is if a monster activates the plate and sits on it long enough while the party faces the right direction (anywhere in the level), the stareDoor(s) will open. Also, for the same reason, it is important to make the real plate (or your only one) to be unresponsive to items placed on it. Unless of course, you want to have a mobile staring contest?