Need help with stand on button puzzle

Hi, I'm trying to make a button puzzle where standing on the correct buttons will clear the obstacles and allow you to progress. Moving off of the button will deactivate the switch. I started by making one of the buttons, however it doesn't work properly. While stepping on it the first time will make it work as intended, stepping off of it will not immediately trigger the deactivation event. I'm not sure what the problem could be here, so maybe someone here can help me.

I attached the code I have for this button (I plan to make an original sprite later). Since there are multiple buttons you have to press (basically, the idea is each party member has to stand on a button, you can decide where they stand by pressing the action button when on the button), and this puzzle will appear in multiple rooms, I thought making the coordinates of the button a variable would save time. On second thought, though, I figure I would have to manually set each coordinate to the event location to prevent conflicts, so I do plan to change that. But I want to see what everyone else has to say.
A few things.

First, the manipulation of your variable isn't going to work correctly - as soon as you turn the self switch on or off, it changes the event's page, so the Control Variables after it won't happen.

Second, your logic on the second page is wrong. You have the button turning off if the player's x is different and the player's y is different - the only way that will be true is if they moved off the button diagonally (or took multiple steps). The button should deactivate if either is true.

Third, I wouldn't use any parallel events or variables for this at all. However...

each party member has to stand on a button, you can decide where they stand by pressing the action button when on the button

How are you doing this? This isn't something you can normally do, and it's going to significantly affect your event code since you're checking the player's coordinates.

But I'm going to ignore that part for now and just give you what I think is a better approach.

Player Touch event activates as soon as the player walks on top of it.

1729737871728.png


Second page is the button depressed.

1729737886008.png


Then a player touch event that turns the button off.

1729737980225.png


Copy and paste that around the button.

1729738006924.png


I used the script call to toggle another event's self switch. You can do that, you can use @Mac15001900's plugin that gives you shorthand commands for it, or you can change the self switch to reference a global switch or variable.

I just think that between the reduction in variables and having 0 parallel events running, this is much more efficient (and it will work correctly 😉 ).

I'll leave you with this,
I enjoy your username.
Haikus are quite neat.
@ATT_Turan After consulting the script call list, I can say the solution you gave me worked! Thank you. I did end up using the Player XY variables to make the depress animation play, but I was able to figure out a way to make it work correctly.

As for your third point, I did figure it out, but I'll answer it anyways:
How are you doing this? This isn't something you can normally do, and it's going to significantly affect your event code since you're checking the player's coordinates.
I made it so when Self Switch A is on for the button, you can press the action button to give you a choice on if you want the party member (ordered by their actor ID, and given there's only three party members, that's workable) to stand on that button or not. If you say yes, another self switch activates depending on which one you're asking. You can talk to them again to add them back to your party, but once the correct buttons are pressed, a cutscene will play, and they are automatically added back to your party.

To account for the possibility a party member could be standing on a button when the "depress" event activates, I did put a conditional branch that checks if any of the other self switches are on before playing the animation.

So, once again, thank you! I don't think I could've figured that all out without your post.
I did end up using the Player XY variables to make the depress animation play
Just out of curiosity, why? The Player Touch event can only be triggered if the player is on that tile, checking their location is superfluous. The depress movement was accounted for in the sample I showed you.

I made it so when Self Switch A is on for the button, you can press the action button to give you a choice on if you want the party member to stand on that button or not. If you say yes, another self switch activates
That sounds perfect, because then the surrounding events turning self switch A off won't have any effect if the third page with self switch B is active.
Just out of curiosity, why? The Player Touch event can only be triggered if the player is on that tile, checking their location is superfluous. The depress movement was accounted for in the sample I showed you.
Because the animation would play every time you step on that tile, even if you did not move onto that tile from the button. It's true I could forego the animation and have it immediately switch frames, therefore not having to check the location, but I figured it would be odd to not have the depress animation play when other switches in the game were animated. So basically: it was for consistency.
Because the animation would play every time you step on that tile, even if you did not move onto that tile from the button.
I...don't understand. "that tile" should be the button, as I illustrated above. And its on its first page, which is the upright button with no switches active. So it could only possibly do the move route when the button is not activated and the player steps onto it.

But if you got something that works for you, whatever 🤣

Original thread: https://forums.rpgmakerweb.com/threads/need-help-with-stand-on-button-puzzle.172794/