Alright here's what you do:
Make an Event. Priority: Under Characters. Trigger: Player touch.
Give it the floor graphic you want.
Variable Control: Add "1" to a variable we'll call "Tile Count"
Control Self Switch A ON (The command, not the Condition)
Copy Event Page; Paste Event Page.
On Page 2 now,
Checkmark Self Switch "A" the event condition
Give this page the activated tile graphic you want.
Change the Variable Control to Sub "1" from the "Tile Count" variable this time.
Control Self Switch A OFF (The command, not the Condition)
Now create a 3rd page. With a Condition Switch "Puzzle Solved". Nothing needs to be on this page.
Create a 4th page. With a Condition Switch "Reset". This will be a parallel process. And simply needs to turn off Self Switch A off.
With this, walking on the tile will change the graphic as well as keep track of the number of activated tiles.
Copy & Paste this event all over the floor.
Your Treasure Chest Event simply needs the event conditions variable "Tile Count" ≥ [However many tiles there are in the room].
Set the first page to parallel process. Play a Success Sound. Appearance Animation message or whatever. Turn the "Puzzle Solved" Switch on. Then create a second page with the "Puzzle Solved" Switch on as a condition, and otherwise function like an ordinary chest event.
Finally you'll want a reset button by the exits or at the starting point. How it's activated is up to you. It simply needs to turn the Switch "Reset" On and OFF again. And reset the Tile Count variable to 0.
When "Reset" is on, all the tile events will jump to their page 4 where they are instructed to turn off their individual self switches. Since their self switches are turned off they'll return to page 1 once the Reset switch turns off. Unless the "Puzzle Solved" Switch is already on, then they'll just stay on page 3 and do nothing.