Smart Doors

So lets say you don't want to have the player character to have to hit enter to go through a door, and you want them ALSO be able to walk past the door without exiting, and only be able to use the door when facing a certain direction. Here is a simple tutorial on how to set up Smart Doors as an event.

You might think this is simple, set up an event, triggered by player touch:
If: Player is facing Down (or any direction, but for example)
Transfer Player : (location here)​

The problem is, this only works if you force the player to approach while facing down.
If dose not work if the player turns down while touching the event.

Thus, I wrote a new event format that takes this into account. As a bonus, this event dose not have to be anywhere near the position of the door.

Here is a smart door example where I want the player facing down and the door at map coordinate 6,11. The player is being transferred to MAP003 (5,7).
(Green italic text is not part of the code):

Set Trigger as Parallel, Priority as Below Characters
Control Variables #0001 ChX = Map X of Player
Control Variables #0002 ChY = Map Y of Player
Wait : 15 frames

I recommend setting these variables anyway as they are very useful to have for all kinds of fun stuff.
If : CharX = 6

That is, when the Player's X Coordinate is equal to that of the door's.
Wait : 15 frames
If : CharY = 11

That is, when the Player's Y Coordinate is also equal to that of the door's.
Wait : 15 frames
If : Player is facing Down

Player is now at the door coordinate and is facing down.
Transfer Player : MAP003 (5,7)
You can also put any door animations before the transfer if you like. I like to insert the standard transfer event code of footsteps/walking.​
: Else
: End
​
: End​
: End

If you are using multiple smart doors, it is better to have them controlled by one of these events. Simply duplicate "if" statements with the appropriate checks. It is even possible to have a single "if" statement act as a trigger for multiple doors. For instance, if you have many doors that are triggered on the same X-Coordinate, you could put both Y-Coordinate triggers under the same X-Coordinate "if" statement.
(Thank you for the reminder about this note Engr. Adiktuzmiko)
Maybe you'd want to:

1) Add a few frames of wait so that it doesnt run per frame to reduce processing requirements. You dont really need it to run per frame.

2) You dont really need the jump to label because its already a parallel process event which continuously run anyways. Putting that jump to label just increases the amount of processing of the event.

3) Add a note suggesting that if you have more than one of these doors, its better to control them using a single one of this parallel event.
I don't get it. Why not just put a touch event on the door and be done with it?
Hmmm making the door itself as event/player touch would probably work. The player would always be on the right direction anyway since the player needs to be facing the door to walk towards it anyway.
Maybe you'd want to:

1) Add a few frames of wait so that it doesnt run per frame to reduce processing requirements. You dont really need it to run per frame.

2) You dont really need the jump to label because its already a parallel process event which continuously run anyways. Putting that jump to label just increases the amount of processing of the event.

3) Add a note suggesting that if you have more than one of these doors, its better to control them using a single one of this parallel event.

Thanks for the suggestions. I will say this event dose act very finicky so I'll test the suggestions before implementing them, but thank you!

I don't get it. Why not just put a touch event on the door and be done with it?

I did try that at first, but this was for a specific case in a one by one hallway where I wanted the player character to move past the the door and also be able to go through it, and because of where it was located I couldn't put a door event for the play to touch without it being in the hallway. It's a weird and specific circumstance but I made this door for this and other such occurrences.
Game Mechanics Design is for looking at aspects of game play at a more conceptual level. It is not about implementation. If you want to do a tutorial on this then please post in the Tutorials section - although, as has been pointed out, all you need to do is make the door player touch with a conditional check for which way the player is facing.

Moderator note: I am therefore closing this.

Original thread: https://forums.rpgmakerweb.com/threads/smart-doors.111391/