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

Status
Not open for further replies.

bishiba

Adept
Veteran
Joined
Apr 6, 2016
Messages
278
Reaction score
163
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
4,509
Reaction score
3,549
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
278
Reaction score
163
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
4,509
Reaction score
3,549
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
278
Reaction score
163
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
10,114
Reaction score
6,398
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

Damn, took a chance on a paid MV plugin working with MZ (FOSSIL) but didn't work :p Been lucky up until now so I got cocky!
Going to be streaming more RM game dev in about 20 minutes or so...

Hello, debt! But it matches my eyes, don't you think?

forester.jpg
Gnyaaaa! Invisible comments on YouTube!!!
When I learned about multithreading in C++, one of the first things was that while heap is shared, each thread has its own stack and it's impossible to access another thread's stack.
So I wrapped the variables into a static class and passed its address to another thread. And it worked.

Forum statistics

Threads
129,985
Messages
1,206,749
Members
171,219
Latest member
apkmodyinfo
Top