How do I make a picture disappear when opening menu?

Hello!
I have a picture which appears beneath the Display Name when a character enters a particular map. It's mainly cosmetic, and I've worked out how to get the picture to disappear around the same time as the display name vanishes.

One issue I've run across however is that if I open the menu right away the Display Name disappears but the picture still remains. I've tried experimenting with Conditional Branches trying to Erase the picture when a button is pressed but I haven't had any luck.

Any suggestions would be much appreciated 🙂

1698889657898.png
Hmm. The default menu background IIRC is a screenshot of the current map. Theoretically, you could just grab one of the menu background manager plugins and use a custom image instead.
Will your picture always be ID #1? If so, you can try this as a plugin:

JavaScript:
(() => {
    'use strict';
    const _Scene_Map_terminate = Scene_Map.prototype.terminate;
    Scene_Map.prototype.terminate = function() {
        $gameScreen.erasePicture(1);
        _Scene_Map_terminate.apply(this);
    }
})();

Edit: in case it's not always #1 and you want to clear all pictures. Wasn't sure what the appropriate method was when I initially posted.

JavaScript:
(() => {
    'use strict';
    const _Scene_Map_terminate = Scene_Map.prototype.terminate;
    Scene_Map.prototype.terminate = function() {
        $gameScreen.clearPictures();
        _Scene_Map_terminate.apply(this);
    }
})();
Hmm. The default menu background IIRC is a screenshot of the current map. Theoretically, you could just grab one of the menu background manager plugins and use a custom image instead.
Thanks for the suggestion!
Will your picture always be ID #1? If so, you can try this as a plugin:

JavaScript:
(() => {
    'use strict';
    const _Scene_Map_terminate = Scene_Map.prototype.terminate;
    Scene_Map.prototype.terminate = function() {
        $gameScreen.erasePicture(1);
        _Scene_Map_terminate.apply(this);
    }
})();

Edit: in case it's not always #1 and you want to clear all pictures. Wasn't sure what the appropriate method was when I initially posted.

JavaScript:
(() => {
    'use strict';
    const _Scene_Map_terminate = Scene_Map.prototype.terminate;
    Scene_Map.prototype.terminate = function() {
        $gameScreen.clearPictures();
        _Scene_Map_terminate.apply(this);
    }
})();
Hey, that worked wonderfully! It must be so handy being able to code!

Thanks for your time and help! Really appreciate it 😀
You’re welcome, and good luck with your project.

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-make-a-picture-disappear-when-opening-menu.162588/