Below is my account of my attempts to make a Spiky Ceiling of Death using Unreal's visual scripting tool Kismet.
For the purposes of this exercise, everything was mocked-up using simple BSP geometry. The player starts outside of a large building with a door. A trigger in front launches an animation to open the door as the player approaches, and closes it behind them as they walk away.
After they enter the room, the door closes and locks shut behind them. In this case, I created the "locking" mechanism by simply reducing the Max Trigger Count on the door, so that after the door has been triggered twice, it won't trigger again. The problem with this is that if the player were to approach the door and open, then walk away instead of going inside, they would be permanently locked outside of the room. The better method would be to place a second trigger immediately inside the door, set to a boolean switch which would deactivate the door trigger.
Once they're inside and the door is locked, the ceiling immediately begins slowly lowering towards them. They can escape by running and stepping on the big button in the middle of the floor, Which triggers the door opening animation one more time, as well as a simple two frame animation to depress the button.
I experimented a bit with how far to place the button from the door, as well as the speed at which the ceiling lowers. The problem is that there's not really any way for the player to know that the door has locked, except to turn around and run against the door a few times until they realize it's not working. I already know the door's locked, so I can't really get a reading on what would be good timing (I sorta just tried to fake it by running at the door a few times before hitting the button).
But what the system really needs is a short cinematic or a sound cue, or both, to let the player know that the door has locked behind them.
I'm now also thinking it would be better to have the button stop the ceiling. Then you could put the button farther away, add a few obstacles, and really ramp up the tension leading up to the player hitting the button. And then you get this big moment of relief when you finally hit the button and it stops, but there would still be the eerie presence of the spikes hanging just inches above your head. Then there could be another puzzle or obstacle that you have to beat in order to actually open the door and escape.
On the other hand, if you do it that way, then you don't get the moment of the player rushing out of the door just as the spikes come down and crash into the floor. I really don't know.
Which is more intense, the trash compactor scene from Star Wars, or Indy grabbing his hat out from under the door in Raiders?
Finally, here's all of the Kismet I put together for this level.