Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
611
Reaction score
203
First Language
English
Primarily Uses
RMMV
Hey there!

I was wondering if someone could help me with a plugin request. What I'm hoping to do is to create a layered MP bar for both in battle and in menus. By layered, I mean that for example, I have an actor with 200 max MP. The first 100 MP would fill the bar fully up with the normal blue color, however the MP between 101-200 would fill up the bar again, with a purple color going over the previous blue bar.

I hope I explained this all well enough. If you're not sure what I mean by something, definitely feel free to ask.

Thank you!
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
3,336
Reaction score
1,249
First Language
Dutch
Primarily Uses
RMMV
I know this can be done with SRD_HUDMaker, so it can be done with
the status screen as well. question more is to add,

1) is it constant 100 MP or does the amount change up to 500?

2) how many is the max layer to read?

3) what about overload MP (like a temporaly boost)? etc

I'm sure advance coders can help you with this.
 

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
611
Reaction score
203
First Language
English
Primarily Uses
RMMV
Hey there,

For my own purposes, I'm just looking for 2 layers (the normal blue, and a purple over top that), with each layer being half of the users MP total. I hadn't thought about temp MP boosts since I haven't used them personally.

If someone were to give the plugin a wider release, perhaps having an option on the plugin configuration to set how many layers they want would be ideal.
 

MechPen

Villager
Member
Joined
Nov 4, 2018
Messages
25
Reaction score
40
First Language
English
Primarily Uses
RMMV
Just put this in a text file and save it as something.js

Code:
Window_Base.prototype.drawActorMp = function(actor, x, y, width) {
    width = width || 186;
    var color1 = this.mpGaugeColor1();
    var color2 = this.mpGaugeColor2();
    var color3 = this.textColor(30);
    var color4 = this.textColor(31);
    this.drawDoubleGauge(x, y, width, actor.mpRate(), color1, color2, color3, color4);
    this.changeTextColor(this.systemColor());
    this.drawText(TextManager.mpA, x, y, 44);
    this.drawCurrentAndMax(actor.mp, actor.mmp, x, y, width,
                           this.mpColor(actor), this.normalColor());
};

Window_Base.prototype.drawDoubleGauge = function(x, y, width, rate, color1, color2, color3, color4) {
    var fillRate1 = Math.min(rate * 2.0, 1.0);
    var fillRate2 = Math.max((rate - 0.5) * 2.0, 0.0);
    var fillW1 = Math.floor(width * fillRate1);
    var fillW2 = Math.floor(width * fillRate2);
    var gaugeY = y + this.lineHeight() - 8;
    this.contents.fillRect(x, gaugeY, width, 6, this.gaugeBackColor());
    this.contents.gradientFillRect(x, gaugeY, fillW1, 6, color1, color2);
    this.contents.gradientFillRect(x, gaugeY, fillW2, 6, color3, color4);
};
 

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
611
Reaction score
203
First Language
English
Primarily Uses
RMMV
Thank you very much for your help!

Everything seems to work great on a fresh file. Just as a heads up, it seems to have incompatibility with one of the plugins I am using, Mjshi's Pretty Sleek Gauges. If a tweak to make the two compatible would be pretty easy, that'd be awesome, but don't feel that you have to make a compatibility patch. It completely slipped my mind that a request like this might have conflicts with other plugins that affect how the MP bar is drawn.
 

MechPen

Villager
Member
Joined
Nov 4, 2018
Messages
25
Reaction score
40
First Language
English
Primarily Uses
RMMV
Maybe try this instead then?

<Non working code was here. it's been removed so as not to confuse the audience>
 
Last edited:

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
611
Reaction score
203
First Language
English
Primarily Uses
RMMV
Hmm, I tried the new code, and it seems that this one doesn't seem to be changing the MP bar from the default. I did try it both with and without the Pretty Gauges plugin enabled, although the result was the same either way.
 

MechPen

Villager
Member
Joined
Nov 4, 2018
Messages
25
Reaction score
40
First Language
English
Primarily Uses
RMMV
Yeah sorry, that second code there didn't even run. This one should get you want you need. I even tested it this time;

Code:
(() => {
var parameters = PluginManager.parameters('PrettySleekGauges');
var defaultHeight = parseInt(parameters['Gauge Height'] || 8);
var defaultTinyHeight = parseInt(parameters['Tiny Gauge Height'] || 2);
var animatedNumbers = (parameters['Animated Numbers'] || "true") === "true";
var animatedGauges = (parameters['Animated Gauges'] || "true") === "true";
var gaugeOutColor = parameters['Outline Color'] || "#FFFFFF";
var textRightBuffer = parseInt(parameters['Text Right Buffer'] || 2);
var gaugeFontSize = parseInt(parameters['Text Font Size'] || 28)

var barTypeLeft = String(parameters['Bar Shape']).substring(0,1);
var barTypeRight = String(parameters['Bar Shape']).substring(1,2);
var saveBarTypeLeft = barTypeLeft;
var saveBarTypeRight = barTypeRight;
var hpBarTypeLeft = (parameters['HP Bar Shape'].length === 2) ? String(parameters['HP Bar Shape']).substring(0,1) : false;
var hpBarTypeRight = (parameters['HP Bar Shape'].length === 2) ? String(parameters['HP Bar Shape']).substring(1,2) : false;
var mpBarTypeLeft = (parameters['MP Bar Shape'].length === 2) ? String(parameters['MP Bar Shape']).substring(0,1) : false;
var mpBarTypeRight = (parameters['MP Bar Shape'].length === 2) ? String(parameters['MP Bar Shape']).substring(1,2) : false;
var tpBarTypeLeft = (parameters['TP Bar Shape'].length === 2) ? String(parameters['TP Bar Shape']).substring(0,1) : false;
var tpBarTypeRight = (parameters['TP Bar Shape'].length === 2) ? String(parameters['TP Bar Shape']).substring(1,2) : false;
var expBarTypeLeft = (parameters['EXP Bar Shape'].length === 2) ? String(parameters['EXP Bar Shape']).substring(0,1) : false;
var expBarTypeRight = (parameters['EXP Bar Shape'].length === 2) ? String(parameters['EXP Bar Shape']).substring(1,2) : false;

Special_Gauge.prototype.drawGauge = function() {
    var fill_w = Math.round((this._width - 2) * this._curRate);
    var fill_ww = Math.round((this._width - 2) * this._maxRate);
    var gy = this._y + this._window.lineHeight() - this._height - 1;

    switch (this._type) {
        case "hp":
            barTypeLeft = hpBarTypeLeft || barTypeLeft;
            barTypeRight = hpBarTypeRight || barTypeRight;
            break;
        case "mp":
            barTypeLeft = mpBarTypeLeft || barTypeLeft;
            barTypeRight = mpBarTypeRight || barTypeRight;
            break;
        case "tp":
            barTypeLeft = tpBarTypeLeft || barTypeLeft;
            barTypeRight = tpBarTypeRight || barTypeRight;
            break;

    }

    this._window.contents.drawTrap(this._x, gy, this._width - 2, this._height, this._window.gaugeBackColor(), true);
    if (this._type == "mp") {
        var fillRate1 = Math.min(this._curRate * 2.0, 1.0);
        var fillRate2 = Math.max((this._curRate - 0.5) * 2.0, 0.0);
        var fillW1 = Math.round((this._width - 2) * fillRate1);
        var fillW2 = Math.round((this._width - 2) * fillRate2);
        var color3 = this._window.textColor(30);
        var color4 = this._window.textColor(31);
        this._window.contents.drawTrap(this._x, gy, fillW1, this._height, this._color[0], this._color[1], "atop");
        this._window.contents.drawTrap(this._x, gy, fillW2, this._height, color3, color4, "atop");
    } else {
        this._window.contents.drawTrap(this._x, gy, fill_w, this._height, this._color[0], this._color[1], "atop");
    }
    this._window.contents.drawTrap(this._x, gy, this._width - 2, this._height, gaugeOutColor);

    barTypeLeft = saveBarTypeLeft;
    barTypeRight = saveBarTypeRight;
};

})();
// EOF
 

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
611
Reaction score
203
First Language
English
Primarily Uses
RMMV
Haha, no problem. After a bit of testing, it looks like the newest code is working great! Thank you very much for all your help, and your patience with all the revisions I ended up needing. (^///^)
 

Latest Threads

Latest Profile Posts

I have a tendency to immediately close folders after using them. Every day, I waste soooo much time reopening and navigating through folders again because of that.
Ok, Black Jack attempt 2: Time to die via brain hemorrhage.
I'm still looking for some people who have skills on scripts and map design if somebody read this.

My mind is dying with the effort trying to understand how scripts work, and why they are so complicated for a little brain as mine.

I just need a hero :,c

Forum statistics

Threads
108,891
Messages
1,040,359
Members
141,333
Latest member
Sarge_Vince
Top