elleonard/RPGtkoolMV-Plugins

DarkPlasma_HideMenuStatusWindow.js

Closed this issue · 6 comments

こんにちは、elleonard、

DarkPlasma_HideMenuStatusWindow.jsに関連するいくつかの質問があります。 戦闘中にSRPGメニューを作成するのに最適なプラグインです。 プラグインを編集しようとしていますが、Javascriptを初めて使用するため、完全には理解できないことがいくつかあります。

  1. const _Scene_Menu_onFormationCancel = Scene_Menu.prototype.onFormationCancel;にバグがあり、フォーメーションをキャンセルした後、ステータスウィンドウが非表示になりません。 this._statusWindow.show();this._statusWindow.hide();に置き換えるだけで修正します。

2.メニューコマンドとアクターステータスウィンドウを切り替えるためにステータスウィンドウが表示または非表示になるたびに、 this._commandWindow.hide();または this._commandWindow.show();を追加します。

3.私の質問:「メニューコマンドとアクターコマンドの両方を**に配置するにはどうすればよいですか?」

ご清聴ありがとうございました。

Hi, elleonard,

I have some questions related to your DarkPlasma_HideMenuStatusWindow.js. It is a perfect plugin for creating SRPG Menu during battle. I am trying to edit your plugin, but since I am new in Javascript there are some things that I don't fully understand:

1.There is a bug in const _Scene_Menu_onFormationCancel = Scene_Menu.prototype.onFormationCancel; which prevent Status Window won't hide after cancelling Formation. I fix it with just replacing this._statusWindow.show(); with this._statusWindow.hide();

  1. I add this._commandWindow.hide(); or this._commandWindow.show(); whenever the Status Window is shown or hidden to switch between Menu Command and Actor Status Window.

  2. My question: "How to both Menu Command and Actor Command to be positioned on the center?"

Thank you very much for your attention.

Hi,

I want to inform you that I already find the answer.
I can change the position by adding this._commandWindow.x =nnn

But, I still have 1 more question.

How to make the change only affect when a Switch is ON?
So when a Switch is OFF, the menu will return to normal.

Thank you.

Hi, RyanBram.
Thank you for your report and question.

1. bug on formation cancel

I fixed and updated plugin now, please download version 1.0.1.

2. show command window when only status window is hidden

You could create additional (and simple enough you can read/write) plugin for implementation.
The code can be written as shown below.

(function() {
  'use strict';
  const _Scene_Menu_commandPersonal = Scene_Menu.prototype.commandPersonal;
  Scene_Menu.prototype.commandPersonal = function () {
    _Scene_Menu_commandPersonal.call(this);
    this._commandWindow.hide();
  };

  const _Scene_Menu_commandFormation = Scene_Menu.prototype.commandFormation;
  Scene_Menu.prototype.commandFormation = function () {
    _Scene_Menu_commandFormation.call(this);
    this._commandWindow.hide();
  };
})();

3. display command window and status window at center.

Your answer is right. I suggest that you could write simple plugin as follows.

(function() {
  'use strict';
  const _Scene_Menu_createCommandWindow = Scene_Menu.prototype.createCommandWindow;
  Scene_Menu.prototype.createCommandWindow = function() {
    _Scene_Menu_createCommandWindow.call(this);
    this._commandWindow.x = (Graphics.boxWidth - this._commandWindow.width)/2;
  };

  const _Scene_Menu_createStatusWindow = Scene_Menu.prototype.createStatusWindow;
  Scene_Menu.prototype.createStatusWindow = function() {
    _Scene_Menu_createStatusWindow.call(this);
    this._statusWindow.x = (Graphics.boxWidth - this._statusWindow.width)/2;
  };
})();

4. display menu windows normally when switch is off.

Not to hide status window and to display on default position, you need a little bit difficult plugin.
I show the example as below.
https://gist.github.com/elleonard/6a658a4cef9c152313340e08539e16de

If you use this plugin, you need not use DarkPlasma_HideMenuStatusWindow.js.

Hi @elleonard .
I am really surprise that you helped me with example that actually worth as a complete plugin.

Honestly this really help me a lot and with your permission I want to use your code.

I got an error when I was trying for the first time and fixed it by replacing keyword getValue with value.

I also added:

Window_MenuCommand.prototype.addMainCommands = function() {
    var enabled = this.areMainCommandsEnabled();
    if (this.needsCommand('item') && !$gameSwitches.value(switchId)) {
        this.addCommand(TextManager.item, 'item', enabled);
    }
    if (this.needsCommand('skill')  && !$gameSwitches.value(switchId)) {
        this.addCommand(TextManager.skill, 'skill', enabled);
    }
    if (this.needsCommand('equip')  && !$gameSwitches.value(switchId)) {
        this.addCommand(TextManager.equip, 'equip', enabled);
    }
    if (this.needsCommand('status')  && !$gameSwitches.value(switchId)) {
        this.addCommand(TextManager.status, 'status', enabled);
    }  else {
        this.addCommand("Units", 'status', enabled);
    }
  };

Window_MenuCommand.prototype.addFormationCommand = function() {
    var enabled = this.isFormationEnabled();
    if (this.needsCommand('formation') && !$gameSwitches.value(switchId)) {
        this.addCommand(TextManager.formation, 'formation', enabled);
    }
  }; 

To hide or rename some specific Command that isn't used during SRPG Battle.

Thank you very much for your valuable support.
And I am really sorry for taking your time.

Best regards,
Ryan

Hi, @RyanBram .

Honestly this really help me a lot and with your permission I want to use your code.

You can use the code freely if you want. 👍

I got an error when I was trying for the first time and fixed it by replacing keyword getValue with value.

Thank you for your nice bug fix. I merged the fix to my gist.

To hide or rename some specific Command that isn't used during SRPG Battle.

It looks pretty good, but I'd do this without discarding original method, like shown as below.

const _Window_MenuCommand_addMainCommands = Window_MenuCommand.prototype.addMainCommands;
Window_MenuCommand.prototype.addMainCommands = function() {
  if ($gameSwitches.value(switchId)) {
    this.addCommand("Units", 'status', this.areMainCommandsEnabled());
  } else {
    _Window_MenuCommand_addMainCommands.call(this);
  }
};

const _Window_MenuCommand_addFormationCommand = Window_MenuCommand.prototype.addFormationCommand;
Window_MenuCommand.prototype.addFormationCommand = function() {
  if (!$gameSwitches.value(switchId)) {
    _Window_MenuCommand_addFormationCommand.call(this);
  }
};

Hi, @elleonard .
At the end most of code in my plugin are come from you.

I doubt that I can be called the author.
I will put your name for my plugin and will let you know if my SRPG Demo has finished.

Once more, really thank you very much and sorry for taking your time.

Best regards,
RyanBram