Change player image when opening menu?

Right now I have a common event for if X is pressed a variable +1, and then a conditional branch for if the variable is even (meaning the player has pressed X once since I set the variable to 1 at the start) the player image will change, and else (if the variable is odd, meaning the player has pressed X twice) the player image will change back to the default. However I've found some inconsistencies with this, like if you open the menu to save, and load the save file again, you'll have to open the menu again for the sprite to change back to the default, and in cutscenes where you can't open the menu pressing X still changes the player image; so I'm wondering if there's a more efficient and simple way to do this.

Sorry for the long explanation, I'm not sure if it made any sense so here's the screenshots:
Spoiler: Common Event
1673740951906.png
Spoiler: Actor Image
1673741018600.png

^ and there's the sprite if you were curious

It's not to big of a problem but some help would be nice!
You first tell the event to do var3 +1
Then, if var3 = 0 do this
else do that.

But var 3 will never be 0, since the second condition will only run after you did +1... Unless you start with a negative value ofcourse
Sorry I wasn't clear, I want the player to have a certain sprite while the menu is open, and then change back to the default one after closing the menu. I'm not sure if I'm misunderstanding but your solution won't work for if I want to open the menu multiple times right?
Sorry I wasn't clear, I want the player to have a certain sprite while the menu is open, and then change back to the default one after closing the menu. I'm not sure if I'm misunderstanding but your solution won't work for if I want to open the menu multiple times right?
Like this?
1673744470240.png


This way, if the player presses once, the image will change and the variable will become one. The main menu will be open during this time.
Then, if the player closes it by pressing the button again, the image will change and reset the variable to zero, placing the original sprite back.

Will this suffice?


(Edit: I just read about the problems you found. To stop the image from changing, you can put the "if cancel is being pressed" in another conditional branch that checks for a switch being off. You then set the switch as on in cutscenes and the like. This way, the event won't activate when unwanted. As for the save problem, you can disable the save in menu or you can set a switch to be on after the sprite changes and run a secondary event that is always checking for that switch. And, if the event finds it, it will turn the switch off and the sprite back to the original. And to avoid it changing the sprite when unwanted. Just set a "erase event" at the end of it. This way, the event will only activate once when you load the game.)
I will try your advice, thank you!

Original thread: https://forums.rpgmakerweb.com/threads/change-player-image-when-opening-menu.154107/