How to use Doors

Doors are among the most fundamental of Cave Story modding operations. Creating your own door will be one of the first steps in learning to modify Cave Story. With that said, let's begin. Start by building your own map, and placing a door in your desired position.

The sending event

After that, go to the entity's its flag properties. Be sure to tick flag number 2000 (PC presses down to run script). Next, give it an event number no lower than one hundred. Then, in your script, add an event corresponding to the number you assigned to your door; in this example, we'll set this door's event number to one hundred. The first thing to do is use either the <PRI or <KEY command, which will keep our hero from moving. Next, we want to use the <CNP0100:0000:0000 command. The first parameter corresponds to your door's event number, so make sure they match. This part animates the door to look like it's opening. You could use the <DNP command, but it's generally better yo use <CNP for doors. Next, put <SOU0011, which will make the opening door sound play. Then, make the room fade out in your desired direction. In this example, we'll make it fade out from the center. So we'll add <FAO0004. Finally, we need to add the command that makes you go to the next room. In this example, we'll use <TRA0012:0094:0037:0011. The twelve means it will send you to room number twelve, the ninety-four is the event that is ran upon arrival in the next room. And the thirty-seven and eleven are the respective X and Y values for where you are teleported in the next room. So, in the end, your script for the door should look like this:

#0100
<PRI<CNP0100:0000:0000
<SOU0011<FAO0004
<TRA0012:0094:0037:0011

The receiving Event

It's important to never forget to have an event on the map you need to go to. Pixel had a set of generic receiving events that he more or less copy-pasted across all his scripts, those being #0090-#0094. You can follow the same technique, or use seperate events for each door / situation - it is up to you. This receiving event would relate to our code above:

#0094
<FAIxxxx<CMUxxxx<END

It doesn't matter what the x's are, but the receiving event must have an <END or equivalent (<EVE, <TRA, etc.)

Author: HaydenStudios