Mechanical trap
Stone walls at opposite ends of the room are rigged to move toward one another, crushing and compacting anything in the room until they touch. Any weight of more than 20 pounds placed on a hidden pressure plate at the center of the room triggers the trap. The pressure plate can be spotted with a DC 15 Wisdom (Perception) check. A character studying the area can determine the pressure plate is a slightly different color than the rest of the floor with a DC 15 Intelligence (Investigation) check. Wedging an iron spike or other object under the pressure plate prevents the trap from activating. A character can notice that the floor, ceiling, and walls have many scrapes on their surfaces with a DC 10 Wisdom (Perception) check.
When the trap is triggered, all doors to the room immediately close and lock. The doors are iron (AC 19, 27 hit points) and any character with thieves’ tools can pick the lock with a DC 20 Dexterity check. A character without thieves tools’ can attempt this check with disadvantage using a hair pin, wire, or other thin, metal tool.
The traps acts at the start of every round, each wall moving toward the center of the room at a pace of 5 feet per round. Characters can attempted to slow the walls by bracing a sturdy object (such as an iron pole) between the two walls. If characters do this these objects break at the start of the round, but the walls do not move that round.
A character who is adjacent to a wall can try to delay one wall from moving by making a DC 20 Strength check. The creature must remain adjacent to the wall until the start of the next round. On a successful check the wall does not move forward at the start of the next round.
As the walls move toward one another, the room shrinks pushing creatures and objects toward the center. At the start of the round when the room becomes too narrow for a creature (once the walls are touching for Medium and smaller creatures) that creature is restrained and it must make a DC 17 Strength saving throw. Creatures who fail take 55 (10d10) bludgeoning damage and creatures who succeed take half damage. Once the walls touch they grind against each other for two rounds and the walls slide back to their original position at the start of a round at a rate of 5 feet per round.
Sometimes the designer of this trip will put a hidden kill switch somewhere within the room in case the trap is triggered by accident. Such a kill switch is usually well hidden beneath a stone in the floor or wall and requires a DC 20 Intelligence (Investigation) check to find. Pressing the switch causes the walls to slide back into their original position at a rate of 5 feet per round on the start of the round. Once the walls are back into their original position, the doors unlock.