Change actor's face image in main menu depending on condition, such as less than full health.
Plugin Required: Visustella Main Menu Core
Updated to support both Face Sets and Bust Portraits(if actor has no bust portrait set, face set will be used).
Prepare: Images
Have the original 'healthy' face images.. make a copy and add '_damage' to the file name.
Edit the images to represent damaged, etc.
Navigate to the Plugin Manager(F10).
VisuMZ_1_MainMenuCore >
Double-click on List Style Settings
Double-click on the style(s) you want to use and replace corresponding code section.
Find the section
Code:
// Draw Actor Graphic
Code:
// Draw Actor Graphic
const gx = rect.x + (this.graphicType() === 'face' ? 1 : 0);
const gy = rect.y + (this.graphicType() === 'face' ? 1 : 0);
const gw = Math.min(rect.width, ImageManager.faceWidth);
const gh = Math.min(rect.height, ImageManager.faceHeight);
const portraitName = actor._menuImage.replace('_damage', '');
const faceImage = actor._faceName.replace('_damage', '');
if (actor.hp !== actor.mhp) {
if (actor.getMenuImage() !== '') {
actor._menuImage = portraitName + "_damage";
}
actor._faceName = faceImage + "_damage"
}
else {
if (actor.getMenuImage() !== '') {
actor._menuImage = portraitName;
}
actor._faceName = faceImage;
}
this.drawActorGraphic(actor, gx, gy, gw, gh);
Do NOT replace anything after
Code:
// Draw Status Stuff
Code:
// Draw Actor Graphic
const gw = rect.width;
const gh = Math.min(rect.height, ImageManager.faceHeight);
const gx = rect.x;
const gy = Math.max(rect.y, rect.y + (rect.height - totalHeight - gh) / 2);
const portraitName = actor._menuImage.replace('_damage', '');
const faceImage = actor._faceName.replace('_damage', '');
if (actor.hp !== actor.mhp) {
if (actor.getMenuImage() !== '') {
actor._menuImage = portraitName + "_damage";
}
actor._faceName = faceImage + "_damage"
}
else {
if (actor.getMenuImage() !== '') {
actor._menuImage = portraitName;
}
actor._faceName = faceImage;
}
this.drawActorGraphic(actor, gx, gy, gw, gh);
Do NOT replace anything after
Code:
// Draw Actor Name
Code:
// Draw Actor Graphic
const gw = rect.width;
const gh = rect.height;
const gx = rect.x;
const gy = rect.y;
const portraitName = actor._menuImage.replace('_damage', '');
const faceImage = actor._faceName.replace('_damage', '');
if (actor.hp !== actor.mhp) {
if (actor.getMenuImage() !== '') {
actor._menuImage = portraitName + "_damage";
}
actor._faceName = faceImage + "_damage"
}
else {
if (actor.getMenuImage() !== '') {
actor._menuImage = portraitName;
}
actor._faceName = faceImage;
}
if (actor.getMenuImage() !== '') {
this.drawItemActorMenuImage(actor, rect.x, rect.y, rect.width, rect.height);
}
else {
this.drawActorGraphic(actor, gx, gy, gw, gh);
}
Do NOT replace anything after
Code:
// Draw Dark Rectangle
Code:
// Draw Actor Graphic
let sx = rect.x;
let sy = rect.y;
let sw = rect.width;
let sh = rect.height;
const portraitName = actor._menuImage.replace('_damage', '');
const faceImage = actor._faceName.replace('_damage', '');
if (actor.hp !== actor.mhp) {
if (actor.getMenuImage() !== '') {
actor._menuImage = portraitName + "_damage";
}
actor._faceName = faceImage + "_damage"
}
else {
if (actor.getMenuImage() !== '') {
actor._menuImage = portraitName;
}
actor._faceName = faceImage;
}
// Portrait
if (actor.getMenuImage() !== '') {
this.drawItemActorMenuImage(actor, rect.x, rect.y, rect.width, rect.height);
// Everything Else
} else {
const gx = Math.max(0, rect.x + Math.floor(((rect.width / 2) - ImageManager.faceWidth) / 2));
const gy = Math.max(0, rect.y + rect.height - Math.ceil(lineHeight * 4.5) - ImageManager.faceHeight);
this.drawActorGraphic(actor, gx, gy, ImageManager.faceWidth, ImageManager.faceHeight);
}
Do NOT replace anything after
Code:
// Draw Dark Rectangle
Code:
// Draw Actor Graphic
const gx = rect.x + (this.graphicType() === 'face' ? 1 : 0);
const gy = rect.y + (this.graphicType() === 'face' ? 1 : 0);
const gw = Math.min(rect.width, ImageManager.faceWidth);
const gh = Math.min(rect.height, ImageManager.faceHeight);
const portraitName = actor._menuImage.replace('_damage', '');
const faceImage = actor._faceName.replace('_damage', '');
if (actor.hp !== actor.mhp) {
if (actor.getMenuImage() !== '') {
actor._menuImage = portraitName + "_damage";
}
actor._faceName = faceImage + "_damage"
}
else {
if (actor.getMenuImage() !== '') {
actor._menuImage = portraitName;
}
actor._faceName = faceImage;
}
this.drawActorGraphic(actor, gx, gy, gw, gh);
Do NOT replace anything after
Code:
// Draw Status Stuff
Code:
// Draw Actor Graphic
const gx = rect.x + (this.graphicType() === 'face' ? 1 : 0);
const gy = rect.y + (this.graphicType() === 'face' ? 1 : 0);
const gw = Math.min(rect.width, ImageManager.faceWidth);
const gh = Math.min(rect.height, ImageManager.faceHeight);
const portraitName = actor._menuImage.replace('_damage', '');
const faceImage = actor._faceName.replace('_damage', '');
if (actor.hp !== actor.mhp) {
if (actor.getMenuImage() !== '') {
actor._menuImage = portraitName + "_damage";
}
actor._faceName = faceImage + "_damage"
}
else {
if (actor.getMenuImage() !== '') {
actor._menuImage = portraitName;
}
actor._faceName = faceImage;
}
this.drawActorGraphic(actor, gx, gy, gw, gh);
Do NOT replace anything after
Code:
// Draw Status Stuff
Save all changes and test.
adjust the condition which will change the image.
Examples:
Code:
actor.hp !== actor.mhp // Not at full health.
actor.hp <= actor.mhp * 0.2 // 20% of max health.