Opening and closing a drawer? (Looping an interaction)

Hi! I'm a total newbie at RMMV here.


Basically, I'm trying to get a drawer to open and close: Player interacts->opens->player interacts->closes->loop. I used self-switches and different event pages, but I can't get it to loop once it closes. Once it closes, the event is over and I can't interact with it anymore.


I have like 3 event pages with self switches turning on and off with images of opened/closed drawers, but is there a simpler way to get this to work?


Thank you guys so much in advance! 🙂
can you provide some screenshots of your events? I don't use MV, but it would likely help others to know how to assist in debugging. my guess is that you do not reset the closed state/switch for the event and there could even be a logic issue with the conditions for the pages.
You only need 2 event pages.


Page 1 will have the drawer closed sprite, set to action button, direction fix ON.  In your event commands you will do a Set Move Route that contains Direction Fix OFF, Turn Left, Turn Right, Turn Up, Direction Fix ON, with a 3 frame wait between each one.  The move route will have Wait for Completion checked.  After that it will turn on a self switch.


Page 2 will have the drawer open sprite, set to action button, direction fix ON.  It will also be conditioned by the self switch.  In the event commands there should be a Set Move Route that contains Direction Fix OFF, Turn Right, Turn Left, Turn Down, Direction Fix ON, with a 3 frame wait between each one.  The move route will have Wait for Completion checked.  After that it will turn off the self switch.


If you want it to do other things as well (give you an item, show text, etc), you will put that between the move route and the self switch on the first page, or prior to the move route on the second page.


Create a quick event for a door or a chest (right-click on an empty tile and choose Quick Event from the list that appears).  Take a look at how they do the animation of the door or chest opening.


The direction changes are based on your having 4 different versions of the drawer - completely closed at the top, partially open next, almost fully open next, and completely open at the bottom.  Again, take a look at the door and chest spritesheets.


If you still have trouble, post screenshots of your event pages.  PLEASE make sure you use alt+printscreen to capture them, as this will include everything we need to see.  Too many people start with that and then the crop out the really important parts, and provide us with only half the story, which is next to useless for debugging purposes.
Wow, thanks so much! I got the self-switches to turn on and off on each event page, and it works perfectly.


I only had two sprites: a completely open drawer, and a completely closed one(using defaults provided in RMMV).


If you allow me to ask one more question, I initially tried the movement command you gave me, but it just rotated the player character instead of doing something with the drawers.


I know you said that "The direction changes are based on your having 4 different versions of the drawer - completely closed at the top, partially open next, almost fully open next, and completely open at the bottom.  Again, take a look at the door and chest spritesheets." <<this. I don't quite understand why the player is turning for me and how the movement command has to do with 4 different versions of the drawers. Could you please elaborate on this a bit?


Again, thank you very much for your help! I'm learning so much 🙂

You only need 2 event pages.


Page 1 will have the drawer closed sprite, set to action button, direction fix ON.  In your event commands you will do a Set Move Route that contains Direction Fix OFF, Turn Left, Turn Right, Turn Up, Direction Fix ON, with a 3 frame wait between each one.  The move route will have Wait for Completion checked.  After that it will turn on a self switch.


Page 2 will have the drawer open sprite, set to action button, direction fix ON.  It will also be conditioned by the self switch.  In the event commands there should be a Set Move Route that contains Direction Fix OFF, Turn Right, Turn Left, Turn Down, Direction Fix ON, with a 3 frame wait between each one.  The move route will have Wait for Completion checked.  After that it will turn off the self switch.


If you want it to do other things as well (give you an item, show text, etc), you will put that between the move route and the self switch on the first page, or prior to the move route on the second page.


Create a quick event for a door or a chest (right-click on an empty tile and choose Quick Event from the list that appears).  Take a look at how they do the animation of the door or chest opening.


The direction changes are based on your having 4 different versions of the drawer - completely closed at the top, partially open next, almost fully open next, and completely open at the bottom.  Again, take a look at the door and chest spritesheets.


If you still have trouble, post screenshots of your event pages.  PLEASE make sure you use alt+printscreen to capture them, as this will include everything we need to see.  Too many people start with that and then the crop out the really important parts, and provide us with only half the story, which is next to useless for debugging purposes.
can you provide some screenshots of your events? I don't use MV, but it would likely help others to know how to assist in debugging. my guess is that you do not reset the closed state/switch for the event and there could even be a logic issue with the conditions for the pages.



Yep, my use of self-switches to reset the event was weird. Got the problem solved for now, but next time when I ask any questions I'll make sure to include some screenshots. Thank you for replying!
When you do a Set Movement Route, there's a dropdown where you can select the player, "this event" or a specific other event.  Just select "this event" (just like the door and chest quick events do).


However, if you've just got a closed drawer and an open drawer, you don't need the move routes at all, because there's no animation.  So just turn on the self switch.  If you're giving an item and showing a message, give the item first, then turn on the self switch, then show the message.

Original thread: https://forums.rpgmakerweb.com/threads/opening-and-closing-a-drawer-looping-an-interaction.74284/