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

Status
Not open for further replies.

bishiba

Adept
Veteran
Joined
Apr 6, 2016
Messages
217
Reaction score
114
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
2,957
Reaction score
2,291
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
217
Reaction score
114
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
2,957
Reaction score
2,291
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
217
Reaction score
114
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,112
Reaction score
5,963
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

Sizzle sizzle sizzle...
zbf1dCZ.gif
Sharing my past was a mistake. Will delete the post when I get access to a working internet connection again.
TFW you get a plugin working correctly with your other plugins ♡\( ̄▽ ̄)/♡

(CW for minor gore - Einar's Y incision is gone for his test portrait)

Cs5kAbZ.png
Doing some winter related edits for a cozy cottage!
I think it's the third time I am changing my skill info plugin, but as I get better at programming, I want to fix the trash I made earlier :p

Streaming while I am programming the plugin. Join in if you wish :)

Forum statistics

Threads
116,981
Messages
1,103,496
Members
152,845
Latest member
Zynarith2
Top