Hello I'm looking to add a character image in the equip menu as well as other menus, I have gotten images to display but have been struggling to get things working the way I would like them too.
I have absolutely 0 knowledge in JS and have just kinda been winging it as I go. right now I have been just modifying the .js scripts in the project file as I don't know how plugins work which is probably a bad idea but what can you do...
I have this function I made in Window_StatusBase to draw pictures for me, I'm basically just taking a bunch of images an layering them on top each other to create the desired final image for the character
(note this code is the combination of like 4 or 5 different posts)
this almost does job although I'm wondering if there is a better way to do it as it seems to be very clunky in game... one of the hardest parts of this whole thing has been trying to get the image to scale and be in order, since this function is used in multiple menus I need to be able to scale it as need. besides that the real issue here is on the equip screen, the image needs to update when you change equipments which it does, the problem is the old image does not get removed. so you end up with a big stack of images and the game starts to lag until you leave that menu.
I just run the code here,
and would think that this.contents.clear(); would do everything but it does not seem too
(also drawActorBust() is the function draws the character with the drawPicture() function all it dose is draw the pictures in order based on what gear is equipped)
I have been trying to wrap my head around how this all works for a few days just messing with it, and googling things trying to find an answer to what I thought would be a simple problem lol. If anyone knows what is the issue or knows of a plugin or something that allows me to freely draw images in menus that would be very helpful.
(also sorry if this post is wrong in some way I have never posted here before)
I have absolutely 0 knowledge in JS and have just kinda been winging it as I go. right now I have been just modifying the .js scripts in the project file as I don't know how plugins work which is probably a bad idea but what can you do...
I have this function I made in Window_StatusBase to draw pictures for me, I'm basically just taking a bunch of images an layering them on top each other to create the desired final image for the character
(note this code is the combination of like 4 or 5 different posts)
JavaScript:
Window_StatusBase.prototype.drawPicture = function(filename, x, y, w, h) {
const Image = ImageManager.loadPicture(filename);
const sprite = new Sprite(Image);
Image.addLoadListener(function() {
var pw = Image.width;
var ph = Image.height;
var sx = 0;
var sy = 0;
var bitmap = new Bitmap(pw,ph)
bitmap.blt(Image, sx, sy, pw, ph, 0, 0, w, h);
sprite.bitmap = bitmap
sprite.setFrame(0,0,w,h)
sprite.x = x
sprite.y = y
}.bind(this));
SceneManager._scene.addChild(sprite);
};
I just run the code here,
JavaScript:
Window_EquipStatus.prototype.refresh = function() {
this.contents.clear();
if (this._actor) {
const nameRect = this.itemLineRect(0);
this.drawActorName(this._actor, nameRect.x, 0, nameRect.width);
this.drawActorFace(this._actor, nameRect.x, nameRect.height);
this.drawActorBust(this._actor,420,4,1069);
this.drawAllParams();
}
};
(also drawActorBust() is the function draws the character with the drawPicture() function all it dose is draw the pictures in order based on what gear is equipped)
I have been trying to wrap my head around how this all works for a few days just messing with it, and googling things trying to find an answer to what I thought would be a simple problem lol. If anyone knows what is the issue or knows of a plugin or something that allows me to freely draw images in menus that would be very helpful.
(also sorry if this post is wrong in some way I have never posted here before)