RMMV Change windows that are part of a screen? (SOLVED)

Status
Not open for further replies.

bishiba

Adept
Veteran
Joined
Apr 6, 2016
Messages
261
Reaction score
155
First Language
Swedish
Primarily Uses
N/A
So, looking at a screen there are different Windows that are involved.
So my question is this:
When I open say Shop:Buy, what function determine which Windows are to be opened for that screen?
Currently it opens the following windows, where I would like to delete ShopInfo and ShopStatus:
1634549247918.png
Windows modified by YEP_ShopMenuCore.
And I want to add the highlighted window.
1634549179103.png
Window_StatCompare is from SRD_EquipCompareUpgrade.
Any suggestions or any help is highly appreciated!
Thanks!
 
Last edited:

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,045
Reaction score
2,358
First Language
EN
Primarily Uses
RMMZ
"Screens" are scenes in RMMV's code (rpg_scenes.js). I'm assuming that:

Windows are typically added to a scene when it is created, e.g.
JavaScript:
Scene_Shop.prototype.create = function() {
    Scene_MenuBase.prototype.create.call(this);
    this.createHelpWindow();
    this.createGoldWindow();
    this.createCommandWindow();
    this.createDummyWindow();
    this.createNumberWindow();
    this.createStatusWindow();
    this.createBuyWindow();
    this.createCategoryWindow();
    this.createSellWindow();
};
Instead of completely removing certain window(s), consider hiding them instead.
  • If you remove a window, you also need to remove all references to that window;
  • If you hide it, you only need to remove any remaining input handlers it might have.
Window_ShopStatus and Window_ShopInfo are both non-interactive windows, i.e. just for display. Removing them (e.g. by overriding the corresponding create_x_Window method with an empty function) might be simple in this case, and would reduce RAM usage slightly, but I hide them in the example below just to be safe. :kaoslp:

Untested example:
JavaScript:
// Adjust shop windows after scene creation
(function(alias) {
  Scene_Shop.prototype.create = function() {
    alias.apply(this, arguments);
    this.createCompareWindow();
    this._statusWindow.hide();
    this._infoWindow.hide();
  };
})(Scene_Shop.prototype.create);

// Create, associate, and add a "stat compare window" to the shop scene
Scene_Shop.prototype.createCompareWindow = function() {
  var x = this._statusWindow.x;
  var y = this._statusWindow.y;
  var w = this._statusWindow.width;
  var h = this._statusWindow.height;
  this._compareWindow = new Window_StatCompare(x, y, w, h);
  this._buyWindow.setStatusWindow(this._compareWindow);
  this._sellWindow.setStatusWindow(this._compareWindow);
  this.addWindow(this._compareWindow);
};
 

bishiba

Adept
Veteran
Joined
Apr 6, 2016
Messages
261
Reaction score
155
First Language
Swedish
Primarily Uses
N/A
"Screens" are scenes in RMMV's code (rpg_scenes.js). I'm assuming that:

Windows are typically added to a scene when it is created, e.g.
JavaScript:
Scene_Shop.prototype.create = function() {
    Scene_MenuBase.prototype.create.call(this);
    this.createHelpWindow();
    this.createGoldWindow();
    this.createCommandWindow();
    this.createDummyWindow();
    this.createNumberWindow();
    this.createStatusWindow();
    this.createBuyWindow();
    this.createCategoryWindow();
    this.createSellWindow();
};
Instead of completely removing certain window(s), consider hiding them instead.
  • If you remove a window, you also need to remove all references to that window;
  • If you hide it, you only need to remove any remaining input handlers it might have.
Window_ShopStatus and Window_ShopInfo are both non-interactive windows, i.e. just for display. Removing them (e.g. by overriding the corresponding create_x_Window method with an empty function) might be simple in this case, and would reduce RAM usage slightly, but I hide them in the example below just to be safe. :kaoslp:

Untested example:
JavaScript:
// Adjust shop windows after scene creation
(function(alias) {
  Scene_Shop.prototype.create = function() {
    alias.apply(this, arguments);
    this.createCompareWindow();
    this._statusWindow.hide();
    this._infoWindow.hide();
  };
})(Scene_Shop.prototype.create);

// Create, associate, and add a "stat compare window" to the shop scene
Scene_Shop.prototype.createCompareWindow = function() {
  var x = this._statusWindow.x;
  var y = this._statusWindow.y;
  var w = this._statusWindow.width;
  var h = this._statusWindow.height;
  this._compareWindow = new Window_StatCompare(x, y, w, h);
  this._buyWindow.setStatusWindow(this._compareWindow);
  this._sellWindow.setStatusWindow(this._compareWindow);
  this.addWindow(this._compareWindow);
};
Yes, thank you. I didn't post which plugins they were from originally as I didn't find it relevant.
I am commonly editing(trying to) Windows and such. But upon changing "Window_Help" which I wanted to change specifically for "Scene_Skill", it also changed the layout of "Window_Help" for everything else. So I realized that I am changing how every Scene interacts with the "Window_Help" and not just the one in "Scene_Skill".

The Windows in this post are for another reason, but I felt it'd apply as I figured I'll just "hide"(thanks) the Window_Help in the Scene_Skill and use another: Window_SkillDesc(Mine).

But thanks a lot for your help, I shall add what plugins are related to the Scenes, as the statcompare is not YEP, rather it is SRD. But both EquipCore and ShopMenuCore are included in my plugins and the Window_Shop is modified by YEP.

I shall play abit of Halo and then I'll be applying what you showed me. It was the prototype.create() I was looking for. Can't believe I didn't find it myself though, I was so stuck looking through the Windows :p Thank you again.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,045
Reaction score
2,358
First Language
EN
Primarily Uses
RMMZ
I'm guessing SRD's plugin uses the same constructor arguments (x, y, width, height) for its Window_StatCompare, but if not then you'll need to change that part of the code.

Good luck! :kaohi:
 

bishiba

Adept
Veteran
Joined
Apr 6, 2016
Messages
261
Reaction score
155
First Language
Swedish
Primarily Uses
N/A
I'm guessing SRD's plugin uses the same constructor arguments (x, y, width, height) for its Window_StatCompare, but if not then you'll need to change that part of the code.

Good luck! :kaohi:
Running into some issues, naturally, trying to place the equip compare into the shop compare might not be that easy :p

But I'm sure I'll be able to figure it out :)

Thanks!
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
9,186
Reaction score
5,994
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

Hi everyone! Enjoying this nice long weekend. How are you all doing? :)
I just successfully tested having events check if specific actors are in a particular party slot and then changing image to match. This will let me make scenes take into account who is in the party at the time and arrange them accordingly - this is important since I'll have extra actors beyond current party. The script used is the same from MV and is compatible with my current core plugin setup in MZ. Thank goodness.
That awkward moment when you're talking about thinking about writing a limited shop stock plugin for MZ and then find out you already wrote one...last May. My memory is so bad.
When I open my project and I'm like, hell yeah.
Some drawings I made in Lapis, one day I intend to involve them in some RPG Maker project.
* maybe two wall frames
*or some sprite flower tiara, or maybe it inspires someone to do something.
bdd19b62e539d17b3b00cc3d63034f7d.jpg

fcca5c8471b34483da8e032cfe579275.jpg

Forum statistics

Threads
118,424
Messages
1,115,846
Members
155,375
Latest member
CrazyCream
Top