Hey ya'll ! Been a while
I'm working on Window_MenuBase, specifically the following function:
I've already figured out how to update the background image if the index is OK'd (thats the commented out `const backgroundImage = isPending` line; when doing formation changes).
What i'm struggling with is when the cursor simply on an index (in red here)
Triggering the image change. I initially thought hooking into `select` but I haven't been successful, as the imagge only updates on OK still lol.
SOLVED:
See fix explanation below:
I'm working on Window_MenuBase, specifically the following function:
Window_MenuStatus.prototype.drawItemImage = function(index) {
const actor = this.actor(index);
const rect = this.itemRect(index);
let width;
let height;
this.setBackgroundType(2);
// Background Image Setup
const isPending = this._pendingIndex === index;
// const backgroundImage = isPending ? "flyerB_trans" : "flyerB_trans_" + String(index);
const backgroundImage = "flyerB_trans_" + String(index);
const bgShadow = "flyerB_shadow";
const bgWidth = rect.width * 92/100;
let bgHeight = rect.height * 95/100;
const bgX = rect.x + rect.width * 2/100;/
const bgY = rect.y + rect.height - bgHeight;
const offSet = 4;
// Draw the background image BEFORE actor images
this.drawBackgroundImage(bgShadow, bgX + offSet, bgY + offSet, bgWidth, bgHeight); // draw Shadow first
this.drawBackgroundImage(backgroundImage, bgX, bgY, bgWidth, bgHeight);
// Actor Image Processing
let mPicture = ExMenuScreenBase.getImageName(actor.actorId());
if (mPicture && showStandingPicture) {
width = rect.width - 2;
height = rect.height - 2;
let x = rect.x - 10;// + 10;// - 18;// + 1;
let y = rect.y + 20;
let sx = (Number(mPicture.x) + menuWindowPictureX) * -1;
let sy = (Number(mPicture.y) + menuWindowPictureY) * -1;
let scaleX = Number(mPicture.scaleX) / 100;
let scaleY = Number(mPicture.scaleY) / 100;
// Global Scaling
scaleX *= menuWindowPictureScale / 100;
scaleY *= menuWindowPictureScale / 100;
this.drawStandingPicture(String(mPicture.imageName), x, y, width, height, sx, sy, scaleX, scaleY);
}
this.changePaintOpacity(true);
};
const actor = this.actor(index);
const rect = this.itemRect(index);
let width;
let height;
this.setBackgroundType(2);
// Background Image Setup
const isPending = this._pendingIndex === index;
// const backgroundImage = isPending ? "flyerB_trans" : "flyerB_trans_" + String(index);
const backgroundImage = "flyerB_trans_" + String(index);
const bgShadow = "flyerB_shadow";
const bgWidth = rect.width * 92/100;
let bgHeight = rect.height * 95/100;
const bgX = rect.x + rect.width * 2/100;/
const bgY = rect.y + rect.height - bgHeight;
const offSet = 4;
// Draw the background image BEFORE actor images
this.drawBackgroundImage(bgShadow, bgX + offSet, bgY + offSet, bgWidth, bgHeight); // draw Shadow first
this.drawBackgroundImage(backgroundImage, bgX, bgY, bgWidth, bgHeight);
// Actor Image Processing
let mPicture = ExMenuScreenBase.getImageName(actor.actorId());
if (mPicture && showStandingPicture) {
width = rect.width - 2;
height = rect.height - 2;
let x = rect.x - 10;// + 10;// - 18;// + 1;
let y = rect.y + 20;
let sx = (Number(mPicture.x) + menuWindowPictureX) * -1;
let sy = (Number(mPicture.y) + menuWindowPictureY) * -1;
let scaleX = Number(mPicture.scaleX) / 100;
let scaleY = Number(mPicture.scaleY) / 100;
// Global Scaling
scaleX *= menuWindowPictureScale / 100;
scaleY *= menuWindowPictureScale / 100;
this.drawStandingPicture(String(mPicture.imageName), x, y, width, height, sx, sy, scaleX, scaleY);
}
this.changePaintOpacity(true);
};
I've already figured out how to update the background image if the index is OK'd (thats the commented out `const backgroundImage = isPending` line; when doing formation changes).
What i'm struggling with is when the cursor simply on an index (in red here)
Triggering the image change. I initially thought hooking into `select` but I haven't been successful, as the imagge only updates on OK still lol.
SOLVED:
See fix explanation below:
So as I suspected and you pointed to, i def had to alias `select` however i needed to prevent the crash, quick fix was:
and for the actuual background image:
const Nowis_337_Window_MenuStatus_prototype_select = Window_MenuStatus.prototype.select;Window_MenuStatus.prototype.select = function(index){ Nowis_337_Window_MenuStatus_prototype_select.call(this, index); if (this._index >= 0) this.refresh();}and for the actuual background image:
const isCurrent = this._index === index;const backgroundImage = isCurrent ? "flyerB_trans" : "flyerB_trans_" + String(index);