MZ Add picture to battle HUD request

I am wondering if anyone can create me a very simple plugin that lets me add an image to my game that sits behind all HUD elements.

Since visustella's plugins are neigh impossible to edit, I basically just want to add to the frontview battle UI by throwing in an image that will sit behind the action points.

1731215600031.png

In this mockup you see the grey bar. I dont need anything fancy. Just want to be able to add an image and move it around so I can place it where I need it. Just needs to be the first thing drawn so that it appears behind everything.
Not sure what you are trying to convey with your image. You seem to be highlighting the gray polygon that looks like a gauge background, but you're pointing towards gauges that already have backgrounds... ?

Maybe I'm just not getting it, or maybe you should try showing what your full HUD looks like and what you want it to look like, instead of whatever it is that you initially posted.

What are you specifically trying to accomplish? And how did you arrive at the conclusion that sandwiching an independent image into the HUD was the way to accomplish it?

And, FWIW, something that was "the first thing drawn" in the battle spriteset or even Scene_Battle would end up behind the battle backs, so it would be helpful to have more context.
Like I said, I just need a plugin that lets me add an image to the battle system with the ability to move its x y coords. That grey bar is the image I want to add and move to behind where the blue icons are. I just need something that let's me add that.

Edit with second example

1731218893711.png


Also, it's because I'm using visustella that this is the only alternative I could come up with. I can't just add to their code and create the object I need. So instead I just need it drawn before the other objects are drawn. I merely stated that so that it would appear behind the hud. Since no z axis means I need it drawn just before that other stuff is drawn. Not the battle back obviously, but before any other objects are drawn.
The right approach would be to create the gauge background as a child of the Visustella status HUD, so I would try asking this question in Visustella's support discord if it were me.

You can try adding the gauge backgrounds independently, but you're likely going to run into issues getting things layered properly or ensuring the background's visibility and other parameters remain synchronized with the status HUD.

But, in the interest of answering your question as presented, this would be a very basic way to do it:

JavaScript:
(() => {
    const coords = {
        0: {x: 0, y: 0}, // gauge coords for actor index 0
        1: {x: 200, y: 0},
        2: {x: 400, y: 0},
        3: {x: 600, y: 0},
    }
    const filename = 'gauge_bg'; // image filename without extension, in /img/pictures directory
    function createGaugeBacks(spriteset) {
        const bitmap = ImageManager.loadPicture(filename)
        $gameParty.battleMembers().forEach((actor, index) => {
            const x = coords[index].x;
            const y = coords[index].y;
            const sprite = new Sprite();
            sprite.bitmap = bitmap;
            sprite.move(x, y);
            spriteset.addChild(sprite);
        })
    }
    // may need to hook a different method for correct layering w/ Visustella
    const alias = Spriteset_Battle.prototype.createLowerLayer;
    Spriteset_Battle.prototype.createLowerLayer = function() {
        alias.apply(this);
        createGaugeBacks(this);
    }
})();
The right approach would be to create the gauge background as a child of the Visustella status HUD, so I would try asking this question in Visustella's support discord if it were me.

You can try adding the gauge backgrounds independently, but you're likely going to run into issues getting things layered properly or ensuring the background's visibility and other parameters remain synchronized with the status HUD.

But, in the interest of answering your question as presented, this would be a very basic way to do it:

JavaScript:
(() => {
    const coords = {
        0: {x: 0, y: 0}, // gauge coords for actor index 0
        1: {x: 200, y: 0},
        2: {x: 400, y: 0},
        3: {x: 600, y: 0},
    }
    const filename = 'gauge_bg'; // image filename without extension, in /img/pictures directory
    function createGaugeBacks(spriteset) {
        const bitmap = ImageManager.loadPicture(filename)
        $gameParty.battleMembers().forEach((actor, index) => {
            const x = coords[index].x;
            const y = coords[index].y;
            const sprite = new Sprite();
            sprite.bitmap = bitmap;
            sprite.move(x, y);
            spriteset.addChild(sprite);
        })
    }
    // may need to hook a different method for correct layering w/ Visustella
    const alias = Spriteset_Battle.prototype.createLowerLayer;
    Spriteset_Battle.prototype.createLowerLayer = function() {
        alias.apply(this);
        createGaugeBacks(this);
    }
})();

I swear I replied to this but I don't see it. And don't like to leave thanks hanging.

But that did exactly what I needed it to do. It was really that simple, I just didn't know how to make the code myself. It was basically my last option because I can't edit visustella plugins and no one on the discord ever helps me. I gave up on discord since either i am ignored or no one can answer or help me. The forums i tend to get results 90% of the time and in short turn around. I tried so many other alternatives, but I boiled it down to something so basic that a simple plugin that would add the one small thing I needed was the best solution.

It works like a charm with no hiccups or issues. Went right behind everything so I could place it exactly how I wanted it. Normally if ask for this code to be added to the battle plugin but yeah. Visustella code XD

It was merely meant to serve as a way to distinguish the max number of actions as well as see the black empty squares as you use up actions.

Appreciate the js!
Sorry to hear about the lack of help on their discord, but glad this worked out for you. Feel free to ask if you need any tweaks.
Hi!
The right approach would be to create the gauge background as a child of the Visustella status HUD, so I would try asking this question in Visustella's support discord if it were me.

You can try adding the gauge backgrounds independently, but you're likely going to run into issues getting things layered properly or ensuring the background's visibility and other parameters remain synchronized with the status HUD.

But, in the interest of answering your question as presented, this would be a very basic way to do it:

JavaScript:
(() => {
    const coords = {
        0: {x: 0, y: 0}, // gauge coords for actor index 0
        1: {x: 200, y: 0},
        2: {x: 400, y: 0},
        3: {x: 600, y: 0},
    }
    const filename = 'gauge_bg'; // image filename without extension, in /img/pictures directory
    function createGaugeBacks(spriteset) {
        const bitmap = ImageManager.loadPicture(filename)
        $gameParty.battleMembers().forEach((actor, index) => {
            const x = coords[index].x;
            const y = coords[index].y;
            const sprite = new Sprite();
            sprite.bitmap = bitmap;
            sprite.move(x, y);
            spriteset.addChild(sprite);
        })
    }
    // may need to hook a different method for correct layering w/ Visustella
    const alias = Spriteset_Battle.prototype.createLowerLayer;
    Spriteset_Battle.prototype.createLowerLayer = function() {
        alias.apply(this);
        createGaugeBacks(this);
    }
})();

Hi! I tested the code, and it works great! =) Now, the only issue is that when there's a screen shake mid-battle, the image displayed by this plugin shakes as well... which looks a bit odd considering it's part of the battle HUD (and the rest of the elements don't shake). Do you have any idea how to make it stop shaking? Maybe make it a proper "HUD" element rather than something drawn in the "background" of the battle?


Thank you in advance for your response
SRD HUD Maker might be a good alternative. I've manage to make a Battle HUD with that.
Hi!


Hi! I tested the code, and it works great! =) Now, the only issue is that when there's a screen shake mid-battle, the image displayed by this plugin shakes as well... which looks a bit odd considering it's part of the battle HUD (and the rest of the elements don't shake). Do you have any idea how to make it stop shaking? Maybe make it a proper "HUD" element rather than something drawn in the "background" of the battle?


Thank you in advance for your response

Hey, I suggest posting your own support thread and describing what you are trying to do. It's hard to address your question otherwise.

I commented this out in the code that I posted, but the layering requires some specific information to get right.

You're also welcome to PM me if you have something specific and small that you want to do, but as I think I mentioned above, I cannot help with anything related to VisuStella.
SRD HUD Maker might be a good alternative. I've manage to make a Battle HUD with that.
Thank you so much for the idea! I checked, and it seems a bit complicated to do for something this small, but if I have no other option, I'll look into it to see if it works =)

Hey, I suggest posting your own support thread and describing what you are trying to do. It's hard to address your question otherwise.

I commented this out in the code that I posted, but the layering requires some specific information to get right.

You're also welcome to PM me if you have something specific and small that you want to do, but as I think I mentioned above, I cannot help with anything related to VisuStella.
Thank you so much for your response. I think I’m going to try the HUD Maker that Martin_Arcainess mentioned, as it seems to be exactly what I need.


If I can’t manage it, I’ll take your suggestion and start a new thread explaining what I need.


As for the other thing you mentioned, since it involves dealing with a VisuStella plugin (Battle Core), I’ll choose not to bother you because there are probably going to be issues hahaha (95% of the time, there are). But I really appreciate your willingness to help! =) 😀
Thank you so much for your response. I think I’m going to try the HUD Maker that Martin_Arcainess mentioned, as it seems to be exactly what I need.


If I can’t manage it, I’ll take your suggestion and start a new thread explaining what I need.


As for the other thing you mentioned, since it involves dealing with a VisuStella plugin (Battle Core), I’ll choose not to bother you because there are probably going to be issues hahaha (95% of the time, there are). But I really appreciate your willingness to help! =) 😀
If you need a hand with the HUD Maker let me know o/
If you need a hand with the HUD Maker let me know o/
Ok, thank you!!! I'll reach out if needed 😀

Original thread: https://forums.rpgmakerweb.com/threads/add-picture-to-battle-hud-request.173125/