Object Falling from Ceiling or Sky

In this tutorial, I made a chest fall to the floor, bounce and land again popping the chest open.
I have made a very simple map to illustrate.
There are many ways to trigger the chest. A switch, a puzzle to solve or very simply, a below character player touch event.
I chose a very simple puzzle of pushing a table into place.


Falling Chest Mapx.png




Leave a couple undeveloped rows of tiles above the picture to place the Chest Event or more for more effect.
Place 2 chairs or stools with a space between them for the Table to go.

First, an Event for the Table.
Table P1
Create an Event and name it Table
Priority
: Same as Characters
Comments: Play SE Push
Comments: Set Move Route: Move away from Player

Falling Chest   Table p1.png


Table P2
Conditions
: Create a Switch: Table in place
This page will prevent the Push sound if you push on the table after it's been placed.

Falling Chest  Table p2.png


Next, the Tile between the chairs
Create an Event
Name it Tile
Nothing else is needed because it is only to set it's location coordinates.
Falling Chest  Tile.png


Now the Chest event
Create an Even
t 2 tiles above the map.Name it Chest

Chest P1
No graphic
. It will appear when Table is pushed into place.
Priority: Above Characters
Options: Check Through
That is all for this page.
Falling Chest  Chest p 1.png


Chest P2
Conditions
: Creat a Switch: Chest Falls is ON
Trigger
: Parallel Process
Priority: Same as characters
Options: Through
Comments:
Move Route: as shown
Control Switch: Create a switch called Chest lands is ON

Falling Chest  Chest p2.png


Chest P3

Conditions
: Chest Lands is ON
Priority
: Same as characters
Trigger: Action Button
Comments: can be what ever you like.
Control Self Switch A is ON
Once the chest has stopped ond opened, just use your action button on it.
Falling Chest Chest P3.png


Chest P4

Conditions
:Self switch A ON
Priority:
Same as characters

Falling Chest  Chest p4.png

Alternative Effect

If you prefer not to have the bounce and the chest open, and would prefer to just have it land, then, delete all move route entries in Chest Page 2 after the first SE :Earth3 entry.
Page 2 would then look like this:

FallingChest  Chest P2 Alt.png




Chest P3 would then look like this:
This can be copied from a Quick Event Creation:Chest
Fallin Chest Alt P3 final.png


Chest P4 will remain the same.

Now, on the ceiling tiles , there are 2 Events.
The one on the left will be to keep track of the positions for the Table and the Tile
The one on the right will be to determine what happens when the Table and Tile Locations are the same.

Variables

Open an Event
name it Variables
Trigger
: Parallel Process
Under Comments:
Click on Control Variables. You will come to the small page below.
Where it says Single, click on the three dots and create a new variable Call it Tile X.
Operation: Set
Operand:Click on Game Data.
A new page will open.


Falling Chest  Variables p2x.png


On the page below, use the drop down arrow and select Tile

Falling Chest  Variables p3x.png


On the page below click both OK buttons and then click apply at the bottom of the Event sheet..

Falling Chest  Variables p4x.png


The page below is saying that you are keeping track of Tile's Map x location which is why there is an ('s) between
Tile and Map x

Falling Chest  Variables p5x.png


Repeat this process three more times
You will need to create new Variables for each.
Make sure you start each entry on the very next @ line.

Tile y Tile 's Map y
Table x Table 's Map x
Table y Table 's Map y

When finished, the page will look like this.
Falling Chest  Variables.png


Now finally. the Conditional Branches

Branches P1

Open an Event. Call it Branches or Conditional Branches.
Trigger: Parallel Process

Falling Chest Branches.png


Branches P2

Click on the Variable directly under Switch
Use the three dots and find Table x
Make sure Equal to is showing.
Under that, Click Variable use the three dots and select Tile X
Make sure "Set handling when conditions are not met" is NOT Checked

This is saying that Table x and Tile x will be occupying the same tile.
Click OK and Apply.

On the very next line@ Repeat the same process only this time, Table y Equal to Tile y
Once again, Make sure "Set handling when conditions are not met" is NOT Checked


Now, the Event is saying that Table x and Tile x are occupying the same tile and the Table y and Tile y are occupying the same tile.
So, now that those two things are true, something will happen.
Control Switches Table in Place is ON.

The finished page will look like this:
Falling Chest  Conditional Branches.png


That is it. Place your character and push the Table into place.
Any problem or need help, leave message on the page and I'll get back asap. I check at least once a day.
Thanks

Original thread: https://forums.rpgmakerweb.com/threads/object-falling-from-ceiling-or-sky.134381/