RPGMaker 2003 - Making a breaking tile, and fun shenanigans
So
This was a fun one
My partner wants to make a puzzle where you step on breakable tiles. When you step off, the tile breaks immediately. When you stand on the tile for 2 seconds, the tile breaks under your feet, and you are sent back to the start of the puzzle.
An idea I could have coded in a few minutes in gamemaker because i am familiar with the engine, something pretty simple to do in Unity3D.
But we're dealing with RPGMaker 2003 and we are dealing with some Severe limitations.
The way the system ends up working is as follows:
On-Screen-Load event that runs once that sets two variables for each tile to record their X and Y position, and two switches for each tile (one for when the player steps on the tile and activates it and one for when the tile is breaking under the player's feet and triggers the reload event).
The tiles have their own code:
check if player is in the same X and Y position. If they are, activate the tile, and start a 2 second timer.
if the player is NOT in the same X and Y position, if the tile is active, the tile is deleted
if the player IS on the same X and Y position, AND the timer reaches 0, the tile breaks under the player's feet, and triggers a text box that reads "oh no!" and reloads the room.
the problem is that, upon reloading, we were having some trouble. The reloading did not reset all variables, as they are considered global, so we needed to re-run the on-screen-load event.
However, running it BEFORE moving the player made the code revert to the state where the player had just stepped on them; and trying to run it AFTER reloading the screen was impossible, as the code that was being ran was broken out of.
So, we were left with a mess of broken code that resulted in either infinite loops or on tiles that behaved like the player had stepped on them even though they were all the way at the start of the room.
I bug tested by creating some text boxes, one before resetting the room, and one after.
The one before resetting the room didn't trigger because the on-screen-load code was trying to run immediately. Removing it and going straight to the reload made the tiles act up.
What ended up fixing it?
The text box after the call to reload the room.
For some reason, the text box after the room reload triggered for a fraction of a second, just long enough that the variables reset but not long enough that the reload got messed up.
I hate that this is working, and I am pretty dang sure that it will not work on computers that work at different speeds.
But for now I need to go make dinner and to look away from the screens.
Rah!
I will add the code later for any RPGMaker2003 geniuses to look at









