DoubleX RMMV Status Bars

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,470
Reaction score
545
First Language
Chinese
Primarily Uses
N/A
Purpose
Lets you use bars to show battler statuses on their sprites

Games using this plugin
None so far

Parameters
Code:
 * @param isEnabled
 * @desc Sets whether this plugin will be enabled
 *       It'll be stored as a boolean, and will be regarded as true if and only
 *       if it's true
 *       Don't change this during the same battle unless you really know what
 *       you're truly foing
 *       E.g.: Setting isEnabled as false will disable this plugin
 * @default true

Notetags
Code:
 *    # Actor/Class/Weapon/Armor/Enemy/State Notetags:
 *      State notetags take the highest priority, followed by enemy, weapon,
 *      armor, class and actor
 *      1. <status status bar: SBX>
 *         - Sets the battler to setup a status bar of status using
 *           configurations set in function name SBX, which can only be edited
 *           in this plugin js file directly
 *         - status must be included in STATUSES, which can only be edited in
 *           this plugin js file directly
 *         - E.g.:
 *           <hp status bar: HP> will set the battler to setup a hp status bar
 *           using configurations set in HP, which can only be edited in this
 *           plugin js file directly
 *         - Only the 1st effective notetag among all having the same status
 *           will be used(Reference tag: NOTETAG_MONO)

Plugin Calls
Code:
 *    # Configuration manipulations
 *      1. $gameSystem.statusBars.param
 *         - Returns the stored value of param listed in the plugin manager
 *         - E.g.:
 *           $gameSystem.statusBars.isEnabled will return a Boolean indicating
 *           whether this plugin's enabled
 *      2. $gameSystem.statusBars.param = val
 *         - Sets the stored value of param listed in plugin manager as val
 *         - E.g.:
 *           $gameSystem.statusBars.isEnabled = false will set the stored
 *           value of parameter isEnabled shown on the plugin manager as false
 *         - All $gameSystem.statusBars.param changes will be saved
 *    # Actor/Class/Weapon/Armor/Enemy/State notetag manipulations
 *      1. meta.statusBars[status]
 *         - Returns the function name SBX for String status specified in
 *           <status status bar: SBX> if there's any
 *         - E.g.:
 *           $dataStates[1].meta.statusBars[hp] will return the function SBX
 *           specified in <hp status bar: SBX> notetag of state with id 1
 *      2. meta.statusBars[status] = SBX
 *         - Sets the String status in <status status bar: SBX> notetag to use
 *           the function with name SBX which is a String
 *         - E.g.:
 *           $dataEnemies[2].meta.statusBars['mp'] = 'MP' will set the SBX
 *           specified in <mp status bar: SBX> notetag of enemy with id 2 as
 *           MP
 *         - All meta.statusBars changes can be saved if
 *           DoubleX RMMV Dynamic Data is used
 *    # Battler manipulations
 *      1. isStatusBarChanged[status] = true
 *         - Notifys the status status bar of the battler to use a new
 *           configuration object
 *         - It'll be reset as false once a new configuration object's used
 *         - E.g.:
 *           $gameParty.aliveMembers()[0].isStatusBarChanged['tp'] = true will
 *           notify the tp status bar of the battler to use a new
 *           configuration object
 *    # Status bar manipulations
 *      1. new Window_Status_Bar(battler, status)
 *         - Creates a new status bar showing the status status of battler
 *           battler
 *         - E.g.:
 *           new Window_Status_Bar($gameTroop.aliveMembers()[0], 'hp') will
 *           create a new status bar showing the hp status of the 1st troop
 *           member

Configurations
Code:
    /* Setups the list of statuses that can have their status bars drawn
     * Each status must be represented by the name of its battler getter
     */
    STATUSES: [
        'hp',
        'mp',
        'tp'
    ],

    /*------------------------------------------------------------------------
     *    Status Bar Functions
     *    - Setups SBX used by <status bar: SBX>
     *------------------------------------------------------------------------*/
    /* SBX are used by Window_Status_Bar at this._cfg = SB[this._cfgName](); in
     * _updateCfg
     * SBX are Javascript functions which must return an Object having at least
     * the following:
     * {
     *     visible: function(battler), // Hotspot
     *     opacity: function(battler), // Hotspot
     *     backColor: function(battler), // Hotspot
     *     color1: function(battler), // Hotspot
     *     color2: function(battler), // Hotspot
     *     x: function(battler), // Hotspot
     *     y: function(battler), // Hotspot
     *     w: function(battler), // Hotspot
     *     h, function(battler), // Hotspot
     *     text, function(battler), // Hotspot
     *     textX: function(battler), // Hotspot
     *     textY: function(battler), // Hotspot
     *     textSize: function(battler), // Hotspot
     *     textColor: function(battler), // Hotspot
     *     min: function(battler), // Hotspot
     *     max: function(battler), // Hotspot
     *     (v1.01a+)showProc: function(battler), // Hotspot
     *     (v1.01a+)procUpdateRate: function(battler) // Hotspot
     * }
     * All functions will be bound to the Window_Status_Bar upon its creation
     * and must take the battler and database item using the SBX as their
     * arguments
     *
     * Status bar configuration functions:
     * The function result of visible, which is the status bar visibility, will
     * be interpreted as truthy or falsy only
     * The function of opacity, which is the status bar opacity, must return a
     * Number between 0 and 255
     * The functions of backColor, color1 and color2, which are the status bar
     * back, 1st and 2nd colors respectively, must return a Number between
     * #00000000 and #FFFFFFFF
     * The functions of x and y, which are the status bar x and y offsets from
     * the battler sprites respectively, must return a Number
     * The functions of w and h, which are the status bar width and height
     * respectively, must return a positive Number
     * The function of text, which is the status bar description text, must
     * return a String
     * The functions of textX, textY and textSize, which are the status bar
     * description text x and y offset from the status bar, and size
     * respectively, must return a positive Number
     * The functions of min and max, which are the minimum and maximum value of
     * the status respiectively, must return a Number that must be not greater
     * than and not less than all the possible values of the current value
     * respectively
     * (v1.01a+)The functions of showProc, which is whether the stat change
     * processes will be shown on the status bars, will be interpreted as truthy
     * or falsy only
     * (v1.01a+)The functions of procUpdateRate, which is the rate relative to
     * the max length of the stat bar per second, must return a Number between 0
     * and 1
     * (v1.01a+)The functions of procColor1 and procColor2, which are the status
     * bar 1st and 2nd stat change colors respectively, must return a Number
     * between #00000000 and #FFFFFFFF
     *
     * SBX names can only use alphanumeric characters
     * The below SBX are examples added to help you set your SBX
     * You can freely use, rewrite and/or delete these examples
     *
     * Advanced:
     * The status bar prototype's inherited from Window_Base.prototype
     * All status bar configuration functions are used by Window_Status_Bar
     * visible and opacity are used in _updateBarVisibility
     * backColor, color1, color2, textColor, text, textX and textY are used in
     * _updateSetting
     * x, y, w and h are used in initialize
     * x is also used in _updateX
     * y is also used in _updateY
     * w is also used in _updateW
     * h is also used in _updateH
     * min and max are used in _updateFillW
     * (v1.01a+)showProc
     */

    // Sets the status bar to display the battler's hp statuses
    HP: function() { // v1.00a - v1.01a; Potential Hotspot
        return {
            // Sets the hp bar to be always visible only for alive battlers
            visible: function(battler) { return battler.isAlive(); }, // Hotspot
            // Sets the hp bar opacity to be always 255
            opacity: function(battler) { return 255; }, // Hotspot
            // Sets the hp bar color 1 to be always text color 15
            backColor: function(battler) { // Hotspot
                return this.textColor(15);
            },
            // Sets the hp bar color 1 to be always text color 20
            color1: function(battler) { return this.textColor(20); }, // Hotspot
            // Sets the hp bar color 2 to be always text color 21
            color2: function(battler) { return this.textColor(21); }, // Hotspot
            // Sets the hp bar x offset from battler sprite to be always 0
            x: function(battler) { return 0; }, // Hotspot
            // Sets the hp bar y offset from battler sprite to be always 16
            y: function(battler) { return 16; }, // Hotspot
            // Sets the hp bar width to be always 87
            w: function(battler) { return 87; }, // Hotspot
            // Sets the hp bar height to be always 16
            h: function(battler) { return 16; }, // Hotspot
            // Sets the hp bar description text to be always hp/mhp
            text: function(battler) { // Hotspot
                return battler.hp.toString() + '/' + battler.mhp.toString();
            },
            // Sets the hp bar description text size to be always 0
            textX: function(battler) { return 0; }, // Hotspot
            // Sets the hp bar description text size to be always 0
            textY: function(battler) { return 0; }, // Hotspot
            // Sets the hp bar description text size to be always 13
            textSize: function(battler) { return 13; }, // Hotspot
            // Sets hp bar description text color to be always text color 0
            textColor: function(battler) { // Hotspot
                return this.textColor(0);
            },
            // Sets the minimum hp to be shown on the hp bar to be always 0
            min: function(battler) { return 0; }, // Hotspot
            // Sets the maximum hp to be shown on the hp bar to be always mhp
            max: function(battler) { return battler.mhp; }, // Hotspot
            // (v1.01a+)Sets the hp change processes to be always shown
            showProc: function(battler) { return true; }, // Hotspot
            // (v1.01a+)Sets the hp change processes rate to be 100% of the
            // max length of the hp bar per second
            procUpdateRate: function(battler) { return 0.2; }, // Hotspot
            // Sets the hp change process color 1 to be always text color 6
            procColor1: function(battler) { return this.textColor(6); },
            // Hotspot
            // Sets the hp change process color 2 to be always text color 17
            procColor2: function(battler) { return this.textColor(17); }
            // Hotspot
        };
    },

    // Sets the status bar to display the battler's mp statuses
    MP: function() { // v1.00a - v1.01a; Potential Hotspot
        return {
            // Sets the mp bar to be always visible only for alive battlers
            visible: function(battler) { return battler.isAlive(); }, // Hotspot
            // Sets the mp bar opacity to be always 255
            opacity: function(battler) { return 255; }, // Hotspot
            // Sets the mp bar color 1 to be always text color 15
            backColor: function(battler) { // Hotspot
                return this.textColor(15);
            },
            // Sets the mp bar color 1 to be always text color 22
            color1: function(battler) { return this.textColor(22); }, // Hotspot
            // Sets the mp bar color 2 to be always text color 23
            color2: function(battler) { return this.textColor(23); }, // Hotspot
            // Sets the mp bar x offset from battler sprite to be always 0
            x: function(battler) { return 0; }, // Hotspot
            // Sets the mp bar y offset from battler sprite to be always 32
            y: function(battler) { return 32; }, // Hotspot
            // Sets the mp bar width to be always 87
            w: function(battler) { return 87; }, // Hotspot
            // Sets the mp bar height to be always 16
            h: function(battler) { return 16; }, // Hotspot
            // Sets the mp bar description text to be always mp/mmp
            text: function(battler) { // Hotspot
                return battler.mp.toString() + '/' + battler.mmp.toString();
            },
            // Sets the mp bar description text size to be always 0
            textX: function(battler) { return 0; }, // Hotspot
            // Sets the mp bar description text size to be always 0
            textY: function(battler) { return 0; }, // Hotspot
            // Sets the mp bar description text size to be always 13
            textSize: function(battler) { return 13; }, // Hotspot
            // Sets mp bar description text color to be always text color 0
            textColor: function(battler) { // Hotspot
                return this.textColor(0);
            },
            // Sets the minimum mp to be shown on the hp bar to be always 0
            min: function(battler) { return 0; }, // Hotspot
            // Sets the maximum mp to be shown on the hp bar to be always mmp
            max: function(battler) { return battler.mmp; }, // Hotspot
            // (v1.01a+)Sets the mp change processes to be always shown
            showProc: function(battler) { return true; }, // Hotspot
            // (v1.01a+)Sets the mp change processes rate to be 100% of the
            // max length of the mp bar per second
            procUpdateRate: function(battler) { return 0.2; }, // Hotspot
            // Sets the mp change process color 1 to be always text color 1
            procColor1: function(battler) { return this.textColor(1); },
            // Hotspot
            // Sets the mp change process color 2 to be always text color 4
            procColor2: function(battler) { return this.textColor(4); }
            // Hotspot
        };
    },

    // Sets the status bar to display the battler's tp statuses
    TP: function() { // v1.00a - v1.01a; Potential Hotspot
        return {
            // Sets the tp bar to be always visible
            visible: function(battler) { return battler.isAlive(); }, // Hotspot
            // Sets the tp bar opacity to be always 255
            opacity: function(battler) { return 255; }, // Hotspot
            // Sets the tp bar color 1 to be always text color 15
            backColor: function(battler) { // Hotspot
                return this.textColor(15);
            },
            // Sets the tp bar color 1 to be always text color 28
            color1: function(battler) { return this.textColor(28); }, // Hotspot
            // Sets the tp bar color 2 to be always text color 29
            color2: function(battler) { return this.textColor(29); }, // Hotspot
            // Sets the tp bar x offset from battler sprite to be always 0
            x: function(battler) { return 0; }, // Hotspot
            // Sets the tp bar y offset from battler sprite to be always 48
            y: function(battler) { return 48; }, // Hotspot
            // Sets the tp bar width to be always 87
            w: function(battler) { return 87; }, // Hotspot
            // Sets the tp bar height to be always 16
            h: function(battler) { return 16; }, // Hotspot
            // Sets the tp bar description text to be always tp/maxTp()
            text: function(battler) { // Hotspot
                return battler.tp.toString() + '/' + battler.maxTp().toString();
            },
            // Sets the tp bar description text size to be always 0
            textX: function(battler) { return 0; }, // Hotspot
            // Sets the tp bar description text size to be always 0
            textY: function(battler) { return 0; }, // Hotspot
            // Sets the tp bar description text size to be always 13
            textSize: function(battler) { return 13; }, // Hotspot
            // Sets tp bar description text color to be always text color 0
            textColor: function(battler) { // Hotspot
                return this.textColor(0);
            },
            // Sets the minimum tp to be shown on the hp bar to be always 0
            min: function(battler) { return 0; }, // Hotspot
            // Sets maximum tp to be shown on the hp bar to be always maxTp()
            max: function(battler) { return battler.maxTp(); }, // Hotspot
            // (v1.01a+)Sets the tp change processes to be always shown
            showProc: function(battler) { return true; }, // Hotspot
            // (v1.01a+)Sets the mp change processes rate to be 100% of the
            // max length of the mp bar per second
            procUpdateRate: function(battler) { return 0.2; }, // Hotspot
            // Sets the tp change process color 1 to be always text color 3
            procColor1: function(battler) { return this.textColor(3); },
            // Hotspot
            // Sets the tp change process color 2 to be always text color 24
            procColor2: function(battler) { return this.textColor(24); }
            // Hotspot
        };
    },

    // Adds new SBX here

Video

Prerequisites
Abilities:
1. Nothing special for most rudimetary use cases
2. Little RMMV plugin development proficiency for most ordinary uses
3. Some RMMV plugin development proficiency to fully utilize this

Instructions
Code:
 * You're supposed to open this plugin js file to edit its configurations
 * The default plugin file name is DoubleX RMMV Status Bars v101b
 * If you want to change that, you must edit the value of
 * DoubleX_RMMV.Status_Bars_File, which must be done via opening this plugin
 * js file directly

Terms Of Use
Code:
 *      1. Commercial use's always allowed and crediting me's always optional.
 *      2. You shall keep this plugin's Plugin Info part's contents intact.
 *      3. You shalln't claim that this plugin's written by anyone other than
 *         DoubleX or my aliases. I always reserve the right to deny you from
 *         using any of my plugins anymore if you've violated this.
 *      4. CC BY 4.0, except those conflicting with any of the above, applies
 *         to this plugin, unless you've my permissions not needing follow so.
 *      5. I always reserve the right to deny you from using this plugin
 *         anymore if you've violated any of the above.

Changelog
Code:
 *      v1.01b(GMT 1200 7-7-2019):
 *      1. Fixed the invisible status bars not being able to be visible again
 *      2. Fixed the equips, classes and actors status bar data not being used
 *      v1.01a(GMT 1400 12-8-2017):
 *      1. Lets you set the status bars to show the stat change processes via
 *         showProc, procUpdateRate, procColor1 and procColor2 in SBX
 *      2. Fixed crashes for status bars having the same minimum and maximum
 *      v1.00a(GMT 1700 16-9-2016):
 *      1. 1st version of this plugin finished

Download
DoubleX RMMV Status Bars
 

Attachments

Last edited:

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,470
Reaction score
545
First Language
Chinese
Primarily Uses
N/A
Updates
Code:
 *      v1.01a(GMT 1400 12-8-2017):                                           
 *      1. Lets you set the status bars to show the stat change processes via
 *         showProc, procUpdateRate, procColor1 and procColor2 in SBX         
 *      2. Fixed crashes for status bars having the same minimum and maximum
 

Lnik3500

Master Troll
Veteran
Joined
Feb 26, 2015
Messages
304
Reaction score
47
First Language
French
Primarily Uses
RMMV
Nice one! Easy to get any plugins that does this, but you made it pretty flexible :)
 

EthanFox

Veteran
Veteran
Joined
Oct 15, 2018
Messages
360
Reaction score
282
First Language
English
Primarily Uses
RMMV
Hey DoubleX, question - is it possible to show/hide these bars via a plugin call?

I want to show/hide a bar in a battle page to make it flash as part of a tutorial.
 

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,470
Reaction score
545
First Language
Chinese
Primarily Uses
N/A
Hey DoubleX, question - is it possible to show/hide these bars via a plugin call?

I want to show/hide a bar in a battle page to make it flash as part of a tutorial.
Because of this:
Code:
 * @param isEnabled
 * @desc Sets whether this plugin will be enabled
 *       It'll be stored as a boolean, and will be regarded as true if and only
 *       if it's true
 *       Don't change this during the same battle unless you really know what
 *       you're truly foing
 *       E.g.: Setting isEnabled as false will disable this plugin
I'm afraid that you've to change the visible function of your corresponding SBX. For instance, let's say you haven't changed that of HP:
Code:
            // Sets the hp bar to be always visible only for alive battlers
            visible: function(battler) { return battler.isAlive(); }, // Hotspot
You can change it to be something like this:
Code:
            // Sets the hp bar to be always visible only for alive battlers when game switch with id x is on
            visible: function(battler) {
                return $gameSwitches.value(x) && battler.isAlive();
            }, // Hotspot
Then you can simply turn on game switch with id x to show the corresponding bar and turn it off to hide it. The same can apply to MP and TP :)
 

EthanFox

Veteran
Veteran
Joined
Oct 15, 2018
Messages
360
Reaction score
282
First Language
English
Primarily Uses
RMMV
Then you can simply turn on game switch with id x to show the corresponding bar and turn it off to hide it. The same can apply to MP and TP :)
Hey, thanks so much for your help - but unfortunately that doesn't work.

Code:
    // Sets the status bar to display the battler's hp statuses
    HP: function() { // v1.00a - v1.01a; Potential Hotspot
        return {
            // Sets the hp bar to be always visible only for alive battlers
            //visible: function(battler) { return battler.isAlive(); }, // Hotspot
            
            // Sets the hp bar to be always visible only for alive battlers when game switch with id x is on
            visible: function(battler) {
                return $gameSwitches.value(33) && battler.isAlive();
            }, // Hotspot
            
            
            // Sets the hp bar opacity to be always 255
            opacity: function(battler) { return 255; }, // Hotspot
I added that, commenting out the old function in the process, and added three switches, 33, 34 and 35 (I've just given the HP part above as the others are identical save for those numbers).

Unfortunately, this seems to work if I change the switch before the battle, but it doesn't work if I change it during the battle. What I wanted to do was...

1) Start the battle with it turned off
2) Have a character explain "You have health points, this is what they do"
3) Turn the bar on and off several times with an SE so it "flashes"
4) Finish with the bar turned on
5) Have a character explain "You have mana points, this is what they do"
6) Turn the bar on and off ...
etc.

It's OK if this simply isn't possible due to the architecture of the plugin, I can work around it.
 

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,470
Reaction score
545
First Language
Chinese
Primarily Uses
N/A
Updates
Code:
 *      v1.01b(GMT 1200 7-7-2019):
 *      1. Fixed the invisible status bars not being able to be visible again
 *      2. Fixed the equips, classes and actors status bar data not being used
 

EthanFox

Veteran
Veteran
Joined
Oct 15, 2018
Messages
360
Reaction score
282
First Language
English
Primarily Uses
RMMV
Thanks so much, DoubleX! Thanks to your changes I was able to make this:
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

buinguyenhoangtho wrote on fizzly's profile.
Hello @fizzly, i would like to use your asset/ resource for my project ( is maybe commercial ). May i have your permission? Thanks you !
Working on breaking the limits of RPGMaker! :cool:
I have 470+ hours on RMMV but have only made a demo game, is this normal? :kaoswt: (I lose motivation a lot plus I use a 32gb laptop, so..)
I like Iron Maiden.
Benku wrote on Magnus0808's profile.
Hey man you helped me out a long time ago with a plugin i was wondering if you can help me out one more time since its literally the last thing i need help with if not is cool but id figured id ask you one more soild.

Forum statistics

Threads
95,427
Messages
929,082
Members
125,659
Latest member
AphoticAmaranth
Top