RMMV Help with hiding and showing window

JUICY_PINEFIELDS

はい!
Member
Joined
Jan 7, 2019
Messages
6
Reaction score
2
First Language
English
Primarily Uses
RMMV
Hi! I'm currently editing a script to hide a window, specifically Window_BattleStatus when you escape from battle. This is because when my windows fade in and out, there's an extra second of Window_BattleStatus fading that looks sloppy. Sometimes it doesn't show up, sometimes it does.
The script I'm editing is AutoBattlePlus. Here is what I have so far:
Code:
//=============================================================================
// AutoBattlePlus.js
//=============================================================================

/*:
* @plugindesc add 'auto' and 'repeat' to battle party command
* @author Sasuke KANNAZUKI (thx to tomoaky)
*
* @param Auto Command Name
* @desc Command name of Auto
* @default Auto
*
* @param Repeat Command Name
* @desc Command name of Repeat
* @default Repeat
*
* @help This plugin does not provide plugin commands.
*
* - Choose "Auto" to all actors determine automatically their actions
*   at the turn.
* - Choose "Repeat" to make actors the same action as the previous turn.
*
* note:
* - At "Repeat" mode, when the actor cannot perform the same action
* (ex. MP has run out), perform normal attack instead.
* - When choose "Repeat" at first turn, let all actions be normal attack.
*
* copyright: this plugin is based on tomoaky's RGSS3 script material.
* see "Hikimoki" http://hikimoki.sakura.ne.jp/
* Thanks to tomoaky.
*
* This plugin is released under MIT license.
* http://opensource.org/licenses/mit-license.php
*/


(function() {

var parameters = PluginManager.parameters('AutoBattlePlus');
var autoName = parameters['Auto Command Name'] || 'Auto';
var repeatName = parameters['Repeat Command Name'] || 'Repeat';


Window_PartyCommand.prototype.makeCommandList = function() {
this.addCommand(autoName,           'auto');
this.addCommand(TextManager.escape, 'escape');
};

var _Scene_Battle_createPartyCommandWindow =
Scene_Battle.prototype.createPartyCommandWindow;
Scene_Battle.prototype.createPartyCommandWindow = function() {
_Scene_Battle_createPartyCommandWindow.call(this);
this._partyCommandWindow.setHandler('auto', this.commandAuto.bind(this));
this._partyCommandWindow.setHandler('escape', this.commandEscape.bind(this));
};

Scene_Battle.prototype.commandAuto = function() {
$gameParty.members()[0].addState(11);
$gameParty.members()[0].makeAutoBattleActions();
BattleManager.startTurn();
};

Scene_Battle.prototype.commandEscape = function() {
BattleManager.processEscape();
Window_BattleStatus.prototype.update = function() {
this.visible = false;};
};

})()

Using this.visible = false gives me the effect that I want at first, but when entering another battle Window_BattleStatus is as expected, not visible. I'm not really sure how to get it to appear normally again. Or should I just do something else entirely?
Any and all help is appreciated, thanks in advance.
 
Last edited:

Felski

Veteran
Veteran
Joined
Jan 5, 2018
Messages
113
Reaction score
96
First Language
german
Primarily Uses
Other
As you already said, the issue is with the this.visible = false part. Normally you would want to use one of the window functions to hide the window instead of permanently changing the update function of Window_BattleStatus.

this._statusWindow.hide() or this._statusWindow.close() should do the trick.

Best regards,
Felski
 

JUICY_PINEFIELDS

はい!
Member
Joined
Jan 7, 2019
Messages
6
Reaction score
2
First Language
English
Primarily Uses
RMMV
As you already said, the issue is with the this.visible = false part. Normally you would want to use one of the window functions to hide the window instead of permanently changing the update function of Window_BattleStatus.

this._statusWindow.hide() or this._statusWindow.close() should do the trick.

Best regards,
Felski
Thank you so much! This worked.
It's funny, I knew about those functions before and one of things I tried in the beginning was put those under the update function. I don't know what was going through my head.
I'll be sure to keep this in mind in future scripts and editing.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,050
Members
137,571
Latest member
grr
Top