MZ Best way to handle constant "show picture" commands?

In 2003, my friend showed me how they did Picture Bust Portrait events. They would make a Common Event, then designate a number for the Character's Portrait, then call that common event whenever needed, followed by another common event that cleared all images.

Like this:
1778453409496.png


So a dialog would be:
[Rina Nomral]
Hi there!
[Clear Girls - to remove the bust on the screen only]

Is there an ideal way to do some compacting like that in MZ too? I'm not even sure if there's a batch "erase picture" command. (Enjoy my terrible event name)
1778453518908.png


It would just be nice to have a "Character Happy(show picture)", "Character Sad (show picture)", & so on without having to go around doing "Show Picture 12" all the time. I'm not sure if MZ has ways to compress it further or better ways of doing it.
Without plugins, what you're doing might be the only way. Maybe you could find a plugin that modifies the standard message dialog to use a bust instead of a face image, though? I'm not sure if such a thing exists, but I think it wouldn't be too difficult to make… so I bet someone has already done it.
I think Solar_Flare is right, without plugins thats the way I'd do it too.

If you want to use a plugin, VS Core Engine added a feature for batch picture deletion:
1778458916683.png

There's a erase all there as you can see. And an erase range.

There might be others, but that's the one I know of IF you want to go the plugin solution.
If you want to use a plugin, VS Core Engine added a feature for batch picture deletion:
If the OP wants to use a plugin, why not one of the handful of bust plugins that would require 0 event commands? 🤣

Galv's gets talked about often.
Use this script:
JavaScript:
$gameScreen.clearPictures();
Edit: Wait mb you only want to delete certain pics

If all the bust pictures and all their itemized parts like eyes and mouths are properly named with the character's name, you can use this script:
JavaScript:
let pictures = $gameScreen._pictures;
let characterName = "rina"

for (let i = 1; i < pictures.length; i++) {
    if (pictures[i]._name.includes(characterName)) $gameScreen.erasePicture(i);
}

Otherwise I'd just recommend getting a plugin if it saves you time from writing all those events.
If you want to only erase a range of pictures you can use this script (as a script call):
JavaScript:
for (let pictureId = 1; pictureId <= 14; pictureId++) {
    $gameScreen.erasePicture(pictureId);
}
Replace 1 and 14 with the start and end of your range

If you want to erase a number of pictures, but not necessarily a full range, use this:
JavaScript:
for (const pictureId of [ 1, 2, 5, 19 ]) {
    $gameScreen.erasePicture(pictureId);
}
Again, replace the numbers in the first line with the list of your picture ids.
Thanks everyone, glad I can ask a great think tank of wise old nerds. :LZSproud:
If the OP wants to use a plugin, why not one of the handful of bust plugins that would require 0 event commands? 🤣

Galv's gets talked about often.
I feel so silly for using any scripts, to be honest. I still haven't taken the time to learn Javascript myself, and I feel bad not just trying to event properly on my own. There's so many people who've made great resources and I fear I'll bloat a game with them if I use them wrong & that's a disservice to them and the players. I'm an artist and writer at heart, I feel like a chimp banging on a computer with a hammer more than anything else. OTL
Basically, the more plug-ins I use and the more script I try to write with or without understanding it, the more worried I am of screwing something up. I think I'm just getting caught up in my own nerosis about "gam mak". OTL

Good news is I already used one of Galv's scripts with parallax mapping (please be patient with Grandma Gamera's terminology, she was a Yume Nikki fangame maker). I'm testing Galv's and since it works on the face system, I don't think I'll use it since I rather have pictures show up behind the messagebox. Great workaround though, might use it on something else. I'd consider the VisuStellaMZ plug-in, but I don't need all those effects and eventing might just be the answer.

Use this script:
JavaScript:
$gameScreen.clearPictures();
Edit: Wait mb you only want to delete certain pics

If all the bust pictures and all their itemized parts like eyes and mouths are properly named with the character's name, you can use this script:
JavaScript:
let pictures = $gameScreen._pictures;
let characterName = "rina"

for (let i = 1; i < pictures.length; i++) {
    if (pictures[i]._name.includes(characterName)) $gameScreen.erasePicture(i);
}

Otherwise I'd just recommend getting a plugin if it saves you time from writing all those events.
If you want to only erase a range of pictures you can use this script (as a script call):
JavaScript:
for (let pictureId = 1; pictureId <= 14; pictureId++) {
    $gameScreen.erasePicture(pictureId);
}
Replace 1 and 14 with the start and end of your range

If you want to replace a number of pictures, but not necessarily a full range, use this:
JavaScript:
for (const pictureId of [ 1, 2, 5, 19 ]) {
    $gameScreen.erasePicture(pictureId);
}
Again, replace the numbers in the first line with the list of your picture ids.
Thank you both, I'll test and consider these too. This might be the solution I'm looking for. 👍

Original thread: https://forums.rpgmakerweb.com/threads/best-way-to-handle-constant-show-picture-commands.183564/