MZ vs menu core - common event

I'm trying to get a common event to run within the item & equipment menu, ID 17, 18 & 19 etc for the events for example. These events would normally run parrallel in the game, and they amend the actors image in the menu, amongst others.

The aim is to have the menu images update from within the item screen or equipment screen to reflect changes. IE, if a healing item is used, then the character may not display bruises, for example.

I'm using their common event 1 example but cannot get it working, it doesn't appear to do anything. Has anyone got an example of working common events from this that they'd be willing to paste?

thank you

Just an example of something you described with no common events, and Visustella Main Menu Core
Pretty much that. Mine works except for within the menu scenes (like above where it updates in the menu itself), which I can't get to work.
Is using common events vital to the feature?
You can set this up without common events by adding a few lines of code.
Not vital no. If the same can be achieved by another method i'll happily use that if you're happy to share with me.
First, setup you image files:
Spoiler: Image Setup
1667437700288.png

all damaged images should have "_damage" at the end.
*NOTE: this can be changed, just update the code portion below

Once your image files are set, navigate to the plugin manager.
Since this example uses portraits, be sure to have Main Menu List Style and Inner-Menu List Style set to portrait.
Now to add the code:
VisuMZ_1_MainMenuCore > List Style Settings > JS: Portrait >
Find the
Code:
// Draw Actor Graphic
section and change it to this:
Spoiler: New Code
Code:
// Draw Actor Graphic
const gw = rect.width;
const gh = rect.height;
const gx = rect.x;
const gy = rect.y;

// This part is new!

const imageName = actor._menuImage.replace('_damage', '');
if (actor.hp !== actor.mhp) {
actor._menuImage = imageName + "_damage";
}
else {
actor._menuImage = imageName;
}

// End of new!

this.drawItemActorMenuImage(actor, gx, gy, gw, gh);
I've tried that just now and setup the image files right to my knowledge, but it isn't changing the graphic still on the menu. I put the damage image into the pictures folder also.
I pasted the code as you put above into the portrait region and amended the actor display to be portrait from vertical also. No errors come up in the console.

I'm guessing I'm overlooking something simple on the above.

Also, in the common event, I have it layed out like this:

IF: $gameActors.actor(1).hpRate() < 0.2

then: change actor image: blabla
else: keep original image.

Wondering if maybe it would be easier to just turn the above into a script call in the menu image.
I've tried that just now and setup the image files right to my knowledge, but it isn't changing the graphic still on the menu. I put the damage image into the pictures folder also.
I pasted the code as you put above into the portrait region and amended the actor display to be portrait from vertical also. No errors come up in the console.

I'm guessing I'm overlooking something simple on the above.

Also, in the common event, I have it layed out like this:

IF: $gameActors.actor(1).hpRate() < 0.2

then: change actor image: blabla
else: keep original image.

Wondering if maybe it would be easier to just turn the above into a script call in the menu image.
You should probably turn off/remove your common events.

As far as having the image change at 20% .. just modify the condition.
Code:
(actor.hp <= actor.mhp * 0.2)

EDIT: are you using the visustella menu portraits? This example requires
Code:
<Menu Portrait: filename>
tags on the actors
Unfortunately I was unable to get any of the above to do anything in the menu. I'm not sure what I'm doing wrong lol.

Code:
if ($gameActors.actor(3).hpRate() < 0.2) {actor.setFaceImage("Jimmy",1);}
else {actor.setFaceImage("Jimmy",0); }

EDIT (fixed the blank image issue)

I did however, use this, and to a degree it works. Issue now is the image changes for every single actor for some reason. I've got the above written for each actor, but it will change every actors image with whoever the last actor in the list is.
You don't need to check every actor.
Change $gameActors.actor(3) to just actor.
The variable actor will always reference the current actor.
I think I know what you're doing, but it's not the example I provided.

Are you using portraits or just face sheets?
Wouldn't that still make it change the image to Jimmy actor each time? I have 2 other actors that will need image adjustments also so the other scripts are for those specifically

Code:
if ($gameActors.actor(1).hpRate() < 0.2) {actor.setFaceImage("Jimmy",1);}
else {actor.setFaceImage("Jimmy",0); }

if ($gameActors.actor(2).hpRate() < 0.2) {actor.setFaceImage("Actor1",3);}
else {actor.setFaceImage("Actor1",3); }

if ($gameActors.actor(3).hpRate() < 0.2) {actor.setFaceImage("Cedric",0);}
else {actor.setFaceImage("Cedric",0); }

I'm still fairly new to learning JS if I'm totally misunderstanding something please bare with me. I've added the other actors stuff above so you can see the exact code I have added from start/end.

Currently, all actors are displaying the Cedric image.
UPDATE:


Follow the instructions, it will turn out as the example if you do.
It wont turn out as the example if you dont.
enjoy.

Original thread: https://forums.rpgmakerweb.com/threads/vs-menu-core-common-event.152411/