RMMV Remove gold and other menu elements mid-game

Terakay

Veteran
Veteran
Joined
Aug 11, 2015
Messages
40
Reaction score
13
First Language
English
Primarily Uses
I'd like to remove the "gold" display, as well as MP/TP meters and MAT/MDF stats, in the menu partway through the game, then re-enable it again later on. Is this something I could do through scripting, or would I need a plugin? Does anyone have any tips on this?
 
Last edited:

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,986
Reaction score
2,304
First Language
EN
Primarily Uses
RMMZ
Yea, you'd want a plugin for this. I just wrote a very simple one, see the attached file.

You can toggle the gold window's visibility using a Script command:
  • $gameSystem._hideGoldWindow = true; - hides the gold window on the pause menu;
  • delete $gameSystem._hideGoldWindow; - shows the gold window again.
I did a quick test and it seemed OK, but let me know if it bugs out somehow~ :kaothx:

(Full code in spoiler below for ease of reference.)
JavaScript:
/*:
 * @plugindesc Hide/show the gold window mid-game.
 * @author Caethyril
 * @help Use this in a Script command to hide the gold window:
 *    $gameSystem._hideGoldWindow = true;
 * Use this to show it again:
 *    delete $gameSystem._hideGoldWindow;
 * 
 * Terms of use: free to use and/or modify for any project!
 */

(function(alias) {
    Scene_Menu.prototype.createGoldWindow = function() {
        alias.apply(this, arguments);
        if ($gameSystem._hideGoldWindow) this._goldWindow.hide();
    };
})(Scene_Menu.prototype.createGoldWindow);

Edit: oh wait you wanted to remove the MP/TP stuff too, that would need some extra code. :kaoslp:
 

Attachments

  • hideGoldWindow.js
    567 bytes · Views: 5

Terakay

Veteran
Veteran
Joined
Aug 11, 2015
Messages
40
Reaction score
13
First Language
English
Primarily Uses
Great, this works! Thanks you.

And yeah, I added the MP/TP gauge as well because I realized I'd want those gone too, as well as some stats (MAT, MDF).
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,986
Reaction score
2,304
First Language
EN
Primarily Uses
RMMZ
For the MP gauge, I think you could add something like this to the plugin's code:
JavaScript:
(function(alias) {
    Window_Base.prototype.drawActorMp = function(actor, x, y, width) {
        if (!$gameSystem._hideGoldWindow) alias.apply(this, arguments);
    };
})(Window_Base.prototype.drawActorMp);
I.e. "if the gold window is not hidden, then continue as usual". For TP, just make a copy of this and swap Mp for Tp.

To hide all parameters on the status screen, you could try a similar approach:
JavaScript:
(function(alias) {
    Window_Status.prototype.drawParameters = function() {
        if (!$gameSystem._hideGoldWindow) alias.apply(this, arguments);
    };
})(Window_Status.prototype.drawParameters);
If you only want to hide specific parameters, I think that would require you to copy+paste the original Window_Status.prototype.drawParameters method into a plugin (this creates an override for that method), then edit it so it skips certain parameter IDs when appropriate.

For reference, you can find the original method in rpg_windows.js. If you're already using a plugin to replace or change your status menu then you may have to refer to its version of that method instead, if it has one.

Also, if you make it more general-purpose like this then I'd suggest replacing _hideGoldWindow with something more appropriate, e.g. _hideMenuStats. Just helps make the code more readable~ :kaohi:
 

Terakay

Veteran
Veteran
Joined
Aug 11, 2015
Messages
40
Reaction score
13
First Language
English
Primarily Uses
Thanks for all the help; I've been working on editing the plugin you gave me to work with different parts of the menu. How would I skip certain parameter IDs, like you suggested? I can't quite figure that out.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,198
Reaction score
15,546
First Language
English
Primarily Uses
RMMV

I've moved this thread to Plugin Requests. Thank you.

 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,986
Reaction score
2,304
First Language
EN
Primarily Uses
RMMZ
No worries! This is the core script version of drawParameters:
JavaScript:
Window_Status.prototype.drawParameters = function(x, y) {
    var lineHeight = this.lineHeight();
    for (var i = 0; i < 6; i++) {
        var paramId = i + 2;
        var y2 = y + lineHeight * i;
        this.changeTextColor(this.systemColor());
        this.drawText(TextManager.param(paramId), x, y2, 160);
        this.resetTextColor();
        this.drawText(this._actor.param(paramId), x + 160, y2, 60, 'right');
    }
};
Here we see a "for loop":
JavaScript:
for (var i = 0; i < 6; i++) {
I.e. "start i at 0; loop while i < 6; +1 to i after each loop". The inside of the loop just draws parameter ID i + 2, and the condition makes it loop from param ID 2~7.

Basic parameter IDs are as follows:
0: MHP | 4: MAT 1: MMP | 5: MDF 2: ATK | 6: AGI 3: DEF | 7: LUK
So if you want to cut out MAT and MDF (i = 2 and 3) you can copy that method into the plugin and change the loop:
JavaScript:
Window_Status.prototype.drawParameters = function(x, y) {
    var lineHeight = this.lineHeight();
    var ix = $gameSystem._hideGoldWindow ? [0, 1, 4, 5] : [0, 1, 2, 3, 4, 5];   // added
    ix.forEach(function(i) {                                                    // changed
        var paramId = i + 2;
        var y2 = y + lineHeight * i;
        this.changeTextColor(this.systemColor());
        this.drawText(TextManager.param(paramId), x, y2, 160);
        this.resetTextColor();
        this.drawText(this._actor.param(paramId), x + 160, y2, 60, 'right');
    });
};
Here I've gone with an array of i values and a forEach loop. More info:

(This sort of thing is why I wish the core scripts would avoid using fixed values so much. If this method referenced a publicly-accessible list of parameter IDs, a plugin could simply modify that list rather than having to override the entire method. :kaoslp:)

Edit: if you want to avoid gaps where the parameters would normally be shown, you could try this instead~
JavaScript:
Window_Status.prototype.drawParameters = function(x, y) {
    var lineHeight = this.lineHeight();
    var ids = $gameSystem._hideGoldWindow ? [2, 3, 6, 7] : [2, 3, 4, 5, 6, 7];   // added
    ids.forEach(function(paramId, i) {                                           // changed
        var y2 = y + lineHeight * i;
        this.changeTextColor(this.systemColor());
        this.drawText(TextManager.param(paramId), x, y2, 160);
        this.resetTextColor();
        this.drawText(this._actor.param(paramId), x + 160, y2, 60, 'right');
    });
};
The array now lists the parameter IDs to draw. i is the index of each entry in the array, provided "for free" by the forEach method (see link above for details).
 
Last edited:

Terakay

Veteran
Veteran
Joined
Aug 11, 2015
Messages
40
Reaction score
13
First Language
English
Primarily Uses
Hmmm, I've added this part to the plugin but now when I open the status screen it says "this.systemColor is not a function." I double checked and I've copied everything correctly; any ideas?
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,986
Reaction score
2,304
First Language
EN
Primarily Uses
RMMZ
That suggests you're using a different version of the core scripts.

First:
  • Open your project's folder, e.g. Game > Open Folder from the editor's menu bar.
  • Find the rpg_windows.js file in the js subfolder.
  • Open that file in a text editor, e.g. Notepad. (You might have to use right-click > Open With.)
Now, a couple of things to check:
  1. What version of the core scripts are you using? Check the top couple of lines, you should see something like this:
    //=============================================================================
    // rpg_windows.js v1.6.2

  2. Search for Window_Status.prototype.drawParameters. I assume your version of this method is different to what I quoted in my post; if so, can you share your version of the method?
 

Terakay

Veteran
Veteran
Joined
Aug 11, 2015
Messages
40
Reaction score
13
First Language
English
Primarily Uses
It looks the same to me--I've copied that part here.

Code:
Window_Status.prototype.drawParameters = function(x, y) {
    var lineHeight = this.lineHeight();
    for (var i = 0; i < 6; i++) {
        var paramId = i + 2;
        var y2 = y + lineHeight * i;
        this.changeTextColor(this.systemColor());
        this.drawText(TextManager.param(paramId), x, y2, 160);
        this.resetTextColor();
        this.drawText(this._actor.param(paramId), x + 160, y2, 60, 'right');
    }
};
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,986
Reaction score
2,304
First Language
EN
Primarily Uses
RMMZ
Sorry! It was my mistake, after all. forEach constitutes its own scope, i.e. the this inside does not automatically match the this outside. :kaoslp:

It's an easy fix, though. Just change this part:
JavaScript:
    this.drawText(this._actor.param(paramId), x + 160, y2, 60, 'right');
});
...to this:
JavaScript:
    this.drawText(this._actor.param(paramId), x + 160, y2, 60, 'right');
}, this);
(This works because the second argument of forEach is used as the this value inside its function.)

For convenience, I've bundled up everything discussed so far into an updated plugin (attached). I also noticed that the stats appear on the Equip scene, so I added in an extra override to handle that, plus some tidying up. Did a quick test and it seemed OK! Full code below~
JavaScript:
/*:
 * @plugindesc Hide various elements on the pause/status menus.
 * @author Caethyril
 * @help Hides the following when active:
 *   • Gold window (pause menu)
 *   • MAT and MDF params (status & equip scenes)
 *   • Actor MP and TP gauges (all scenes)
 * 
 * Use this in a Script command to activate the plugin:
 *   $gameSystem._hideMenuStats = true;
 * Use this to deactivate the plugin:
 *   delete $gameSystem._hideMenuStats;
 *
 * Terms of use: free to use and/or modify for any project!
 */

(function() {   // avoids polluting the global scope

    // New! Returns true iff this plugin is active.
    var isActive = function() { return !!$gameSystem._hideMenuStats; };

    // New! Returns array of basic param IDs to show on relevant scenes.
    var ids = function() { return isActive() ? [2, 3, 6, 7] : [2, 3, 4, 5, 6, 7]; };

    // Overrides! Hide MAT and MDF params when active.
    Window_Status.prototype.drawParameters = function(x, y) {
        var lineHeight = this.lineHeight();
        ids().forEach(function(paramId, i) {               // changed
            var y2 = y + lineHeight * i;
            this.changeTextColor(this.systemColor());
            this.drawText(TextManager.param(paramId), x, y2, 160);
            this.resetTextColor();
            this.drawText(this._actor.param(paramId), x + 160, y2, 60, 'right');
        }, this);
    };
    Window_EquipStatus.prototype.refresh = function() {
        this.contents.clear();
        if (this._actor) {
            this.drawActorName(this._actor, this.textPadding(), 0);
            ids().forEach(function(paramId, i) {          // changed
                this.drawItem(0, this.lineHeight() * (1 + i), paramId);
            }, this);
        }
    };

    // Alias! Hide MP/TP gauges when active.
    (function(alias) {
        Window_Base.prototype.drawActorMp = function(actor, x, y, width) {
            if (!isActive()) alias.apply(this, arguments);
        };
    })(Window_Base.prototype.drawActorMp);
    (function(alias) {
        Window_Base.prototype.drawActorTp = function(actor, x, y, width) {
            if (!isActive()) alias.apply(this, arguments);
        };
    })(Window_Base.prototype.drawActorTp);

    // Alias! Hide gold window when active.
    (function(alias) {
        Scene_Menu.prototype.createGoldWindow = function() {
            alias.apply(this, arguments);
            if (isActive()) this._goldWindow.hide();
        };
    })(Scene_Menu.prototype.createGoldWindow);

})();
 

Attachments

  • hideMenuStats.js
    2.5 KB · Views: 3

Terakay

Veteran
Veteran
Joined
Aug 11, 2015
Messages
40
Reaction score
13
First Language
English
Primarily Uses
Excellent, this works great. Thanks for all the help!
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,986
Reaction score
2,304
First Language
EN
Primarily Uses
RMMZ
Yay! Happy RPG Making~ :kaojoy:
 

Terakay

Veteran
Veteran
Joined
Aug 11, 2015
Messages
40
Reaction score
13
First Language
English
Primarily Uses
I know it's been awhile since I posted on this thread, but I started using Yanfly's Equip Core plugin. Would it be possible to make this compatible? I've been messing around with the code a bit myself, trying to get it to work, but without any luck so far.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,986
Reaction score
2,304
First Language
EN
Primarily Uses
RMMZ
I had a quick look and it seems YEP_EquipCore replaces the default Window_EquipStatus with its own Window_StatCompare (roughly...the whole layout changes). :kaoslp:

I haven't tested but you could try replacing this part:
JavaScript:
    Window_EquipStatus.prototype.refresh = function() {
        this.contents.clear();
        if (this._actor) {
            this.drawActorName(this._actor, this.textPadding(), 0);
            ids().forEach(function(paramId, i) {          // changed
                this.drawItem(0, this.lineHeight() * (1 + i), paramId);
            }, this);
        }
    };
...with this:
JavaScript:
    Window_StatCompare.prototype.refresh = function() {
        this.contents.clear();
        if (this._actor) {
            ids().forEach(function(paramId, i) {
                this.drawItem(0, this.lineHeight() * i, paramId);
            }, this);
        }
    };
Also, make sure the plugin loads after Yanfly's Equip Core.
 

Terakay

Veteran
Veteran
Joined
Aug 11, 2015
Messages
40
Reaction score
13
First Language
English
Primarily Uses
Thanks for the help again, I really appreciate it.

I replaced the part you recommended and it works, but now the Max HP and Max MP stats are gone in the equip menu, even when I have "hideMenuStats" toggled off. Any ideas? Ideally I'd like Max HP to stay when it's toggled on as well.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,986
Reaction score
2,304
First Language
EN
Primarily Uses
RMMZ
Oh, whoops. Try this instead?
JavaScript:
    Window_StatCompare.prototype.refresh = function() {
        this.contents.clear();
        if (this._actor) {
            [0, 1].concat(ids()).forEach(function(paramId, i) {
                this.drawItem(0, this.lineHeight() * i, paramId);
            }, this);
        }
    };
 

Terakay

Veteran
Veteran
Joined
Aug 11, 2015
Messages
40
Reaction score
13
First Language
English
Primarily Uses
Can you make Max MP not appear when the plugin is toggled on? Both Max HP and Max MP are showing up now, but I'd like only Max HP to show up when it's toggled on.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,986
Reaction score
2,304
First Language
EN
Primarily Uses
RMMZ
I guess that makes sense, since you want to hide MP in that case! :kaoblush:

Is this more like what you were after?
JavaScript:
    Window_StatCompare.prototype.refresh = function() {
        this.contents.clear();
        if (this._actor) {
            (isActive() ? [0] : [0, 1]).concat(ids()).forEach(function(paramId, i) {
                this.drawItem(0, this.lineHeight() * i, paramId);
            }, this);
        }
    };
I.e.
  • Always show max HP (param 0);
  • Only show max MP (param 1) when $gameSystem._hideMenuStats is false.
 

Terakay

Veteran
Veteran
Joined
Aug 11, 2015
Messages
40
Reaction score
13
First Language
English
Primarily Uses
Perfect! Thanks again for all the help--I'm a little incompetent when it comes to coding so it means a lot.
 

Latest Threads

Latest Posts

Latest Profile Posts

aww man, color hex code #C4C4C4 doesn't work for the tint value in this scene I need something darker, which stinks just because I liked that one it was my favorite plastic explosive three times...#696969 (nice) should work better (WHY IS MY BRAIN LIKE THIS)
Tell it to me straight, doc. If I've been trying to piece together a "shorter" game to learn stuff outside of game jams... am I just running away from my WIP? :v
Well, I've got a party tomorrow, and my friends are coming over. I wanted to work a bit on the Fandom Scouts assets so I can be ready when that update arrives... in other news, Pizza Time Horror is getting a second teaser, and it shows Cabaret Helen's last performance before the location closed.
Also who used to be scared of Chuck E as a kid? I was! Now I love him!
The new cards and what they do:

(I am clearly not a youtuber... Haha)

Forum statistics

Threads
117,275
Messages
1,106,055
Members
153,450
Latest member
BRCMuller
Top