MV Custom Menu don't show

I'm trying to create a custom menu using two windows, but only the first window is showing. The code I'm using is this:
Spoiler: CODE
JavaScript:
Scene_VictoryBattle.prototype.createVictoryBattle = function() {
  this._victorybattle = new Window_VictoryBattle();
  this.addWindow(this._victorybattle);
  this._victorybattle.open();
};

Scene_VictoryBattle.prototype.createVictoryExp = function() {
  this._victorybattle.refresh(text_victorybattle_menu);
  this._victoryexp = new Window_VictoryExp();
  this.addWindow(this._victoryexp);
  this._victoryexp.open();
};

If I use this code below, both windows appear, but I need them to be called in different functions.

Spoiler: CODE
JavaScript:
Scene_VictoryBattle.prototype.create = function() {
  Scene_MenuBase.prototype.create.call(this);
  this._victorybattle = new Window_VictoryBattle();
  this.addWindow(this._victorybattle);
  this._victorybattle.open();
  this._victoryexp = new Window_VictoryExp();
  this.addWindow(this._victoryexp);
  this._victoryexp.open();
}

So I imagine that the problem is not the initialize of the window, so I have no idea what it could be.
It may be a good idea to show the entire plugin as it's clear the cause of the bug must be outside of what's shared here. Otherwise my best guess is that Scene_VictoryBattle.prototype.createVictoryExp was not actually called, the second code snippet works because the code actually executes
It may be a good idea to show the entire plugin as it's clear the cause of the bug must be outside of what's shared here. Otherwise my best guess is that Scene_VictoryBattle.prototype.createVictoryExp was not actually called, the second code snippet works because the code actually executes
Scene_VictoryBattle.prototype.createVictoryExp is being executed, as this._victorybattle.refresh(text_victorybattle_menu) works for some tests by changing the variable, only the windows that are not appearing.

The complete code:

Spoiler: CODE
JavaScript:
//=============================================================================
//Window_VictoryBattle
//=============================================================================

function Window_VictoryBattle() {
    this.initialize.apply(this, arguments);
}

Window_VictoryBattle.prototype = Object.create(Window_Base.prototype);
Window_VictoryBattle.prototype.constructor = Window_VictoryBattle;

Window_VictoryBattle.prototype.initialize = function () {
    var width = this.windowWidth();
    var height = this.windowHeight();
    Window_Base.prototype.initialize.call(this, 0, 0, width, height);
    this.refresh(text_victorybattle_menu);
};

Window_VictoryBattle.prototype.windowWidth = function() {
    return Graphics.boxWidth;
};

Window_VictoryBattle.prototype.windowHeight = function() {
    return this.fittingHeight(1);
};

Window_VictoryBattle.prototype.refresh = function(text) {
    this.contents.clear();
    this.drawText(text, 0, 0, this.contents.width, 'center');
};

//=============================================================================
// Window_VictoryExp
//=============================================================================

function Window_VictoryExp() {
    this.initialize.apply(this, arguments);
}

Window_VictoryExp.prototype = Object.create(Window_Selectable.prototype);
Window_VictoryExp.prototype.constructor = Window_VictoryExp;

Window_VictoryExp.prototype.initialize = function() {
    var wy = this.fittingHeight(1);
    var width = this.windowWidth();
    var height = this.windowHeight();
    this._showGainedSkills = eval(skill_aprendida);
    Window_Selectable.prototype.initialize.call(this, 0, wy, width, height);
    this.defineTickSound();
    this.refresh();
    AudioManager.playSe(this._tickSound);
    this._tick = 0;
    this.openness = 0;
};

Window_VictoryExp.prototype.windowWidth = function() {
    return Graphics.boxWidth;
};

Window_VictoryExp.prototype.windowHeight = function() {
    return Graphics.boxHeight - this.fittingHeight(1);
};

Window_VictoryExp.prototype.maxItems = function() {
    return 5;
};

Window_VictoryExp.prototype.standardFontSize = function() {
    return tamanho_fonte;
};

(...)

//=============================================================================
//Scene_VictoryBattle()
//=============================================================================

function Scene_VictoryBattle() {
  this.initialize.apply(this, arguments);
}

Scene_VictoryBattle.prototype = Object.create(Scene_MenuBase.prototype);
Scene_VictoryBattle.prototype.constructor = Scene_VictoryBattle;

Scene_VictoryBattle.prototype.initialize = function() {
  Scene_MenuBase.prototype.initialize.call(this);
 
};

Scene_VictoryBattle.prototype.update = function() {
    this.updateVictoryAftermath();
};

Scene_VictoryBattle.prototype.processNextVictoryStep = function() {
  var step = this._victorySteps.shift();
  if (step) {
    this.processVictoryStep(step.toUpperCase());
  } else {
    this.srpgVictoryFinish();
  }
};

Scene_VictoryBattle.prototype.processVictoryStep = function(step) {
  this._victoryStep = step;
};

Scene_VictoryBattle.prototype.srpgVictoryFinish = function() {
  this._victorybattle.close();
  this.eventVictoryPhase();
  $gameSystem.srpgVictoryFinish();
};

Scene_VictoryBattle.prototype.isVictoryStep = function(value) {
  return this._victoryStep && this._victoryStep === value;
};

Scene_VictoryBattle.prototype.updateVictoryAftermath = function() {
  this.activateVictoryStep();
  this.updateVictorySteps();
};

Scene_VictoryBattle.prototype.activateVictoryStep = function() {
  if (this._activateVictoryStep) return;
  this._activateVictoryStep = true;
  this.createVictoryBattle();
  this._victorySteps = this.createVictorySteps();
  this.createVictorySteps();
  this.processNextVictoryStep();
};

Scene_VictoryBattle.prototype.createVictorySteps = function() {
  var steps = vaOrdem.split(' ');
  var array = [];
  for (var i = 0; i < steps.length; ++i) {
    var step = steps[i];
    if (step.toUpperCase() === 'CUSTOM') {
      array = this.addCustomVictorySteps(array);
    } else {
      array.push(step.toUpperCase());
    }
  }
  return array;
};

Scene_VictoryBattle.prototype.addCustomVictorySteps = function(array) {
  return array;
};

Scene_VictoryBattle.prototype.updateVictorySteps = function() {
  if (this.isVictoryStep('EXP')) this.updateVictoryExp();
  if (this.isVictoryStep('DROPS')) this.updateVictoryDrops();
};

Scene_VictoryBattle.prototype.updateVictoryExp = function() {
  if (!this._victoryexp) {
    this.createVictoryExp();
  } else if (this._victoryexp.isReady()) {
    if (this.victoryTriggerContinue()) this.finishVictoryExp();
  }
};

Scene_VictoryBattle.prototype.createVictoryBattle = function() {
  this._victorybattle = new Window_VictoryBattle();
  this.addWindow(this._victorybattle);
  this._victorybattle.open();
};

Scene_VictoryBattle.prototype.createVictoryExp = function() {
  this._victorybattle.refresh(text_victorybattle_menu);
  this._victoryexp = new Window_VictoryExp();
  this.addWindow(this._victoryexp);
  this._victoryexp.open();
};
Does this code require certain plugins installed to work? If I were to install this into my own game I already know it will do nothing.
I would suggest aliasing this function to call Scene_VictoryBattle.prototype.createVictoryExp

Code:
_aliasCreateVictoryBattle = Scene_VictoryBattle.prototype.create;
Scene_VictoryBattle.prototype.create = function() {
  _aliasCreateVictoryBattle.create.call(this);
  this.createVictoryExp();
}
@Gensun I think it require SRPG plugin(s) or some of them to battle
on the map as strategy so far I know it, but there is also a function
that does nothing as I see it, so it is drawd somewhere else as well.

@adramalesh159753
both window might be showing from what I see, but while both windows
has graphic width, it seems the other window is outside your screen.

you can try to use a fix number to test for width (both on 250) or its height.
than adjust it with the width/height of the "this._victoryExp".

this can be seen if they are working correct in showing.
it would also be good to link the plugin to what you modify as you didn't
use "if (Imported pluginname)" to target that plugin or warn them if it isn't.
Does this code require certain plugins installed to work? If I were to install this into my own game I already know it will do nothing.
I would suggest aliasing this function to call Scene_VictoryBattle.prototype.createVictoryExp

Code:
_aliasCreateVictoryBattle = Scene_VictoryBattle.prototype.create;
Scene_VictoryBattle.prototype.create = function() {
  _aliasCreateVictoryBattle.create.call(this);
  this.createVictoryExp();
}
This plugin needs another plugin to run because only to called at a specific moment in the battle, but if you use SceneManager.push(Scene_VictoryBattle) the code will be executed.
@Gensun I think it require SRPG plugin(s) or some of them to battle
on the map as strategy so far I know it, but there is also a function
that does nothing as I see it, so it is drawd somewhere else as well.

@adramalesh159753
both window might be showing from what I see, but while both windows
has graphic width, it seems the other window is outside your screen.

you can try to use a fix number to test for width (both on 250) or its height.
than adjust it with the width/height of the "this._victoryExp".

this can be seen if they are working correct in showing.
it would also be good to link the plugin to what you modify as you didn't
use "if (Imported pluginname)" to target that plugin or warn them if it isn't.

I tried modifying the width and height, but it doesn't work. I disabled VictoryBattle so the script only calls VictoryExp, but the screen just has a blur.

Enable and disable VictoryBattle:
Spoiler: IMAGES
game_r5WcfsN7Kj.png


game_Ukc2eO5qP7.png

Using debug, the two windows are built at these values below:
Spoiler: IMAGES
game_TVBmOVuIaN.png



mspaint_M1xwAAvNRo.png

What I find strange is that both windows work normally if I use the create function and call both together using the width and height values as in the code I showed, but separately this strange error occurs.
why do you use
JavaScript:
var width = this.windowWidth; width = 816;

if you also have a function window width, this get overwritten (twice).
you can better do

JavaScript:
var width = this.windowWidth || width = 816;
or leave out "this.windowWidth"

also, try ruling out "this.openess = 0" to see what happend.
another thing to try is to remove all code below the initilize with
"/*
your code here
*/"

this rule the code below out to see if the window is popping up.
if this works, than remove the comment group section of /* and */
so you know the window is working correctly.

otherwise, we need to look deeper to the cause why it isn't showing.
You've overwritten the scene's update function without calling the original one, so new windows aren't going to be added properly. Replace it with
JavaScript:
Scene_VictoryBattle.prototype.update = function () {
    Scene_MenuBase.prototype.update.call(this);
    this.updateVictoryAftermath();
};
In general, when overriding existing functions like this remember to call the original one, unless you're sure you don't want the existing effects to trigger.

Fun trivia: why did the first window appear then? Because you didn't set openness to 0 in that one. So it instantly appears open. The second one is set to the beginning of its opening animation, but that animation cannot proceed because it's not getting updates, since the scene's update function responsible for that was removed.
why do you use
JavaScript:
var width = this.windowWidth; width = 816;

if you also have a function window width, this get overwritten (twice).
you can better do

JavaScript:
var width = this.windowWidth || width = 816;
or leave out "this.windowWidth"

also, try ruling out "this.openess = 0" to see what happend.
another thing to try is to remove all code below the initilize with
"/*
your code here
*/"

this rule the code below out to see if the window is popping up.
if this works, than remove the comment group section of /* and */
so you know the window is working correctly.

otherwise, we need to look deeper to the cause why it isn't showing.
The values that are in orange in the image are from DevTools when I was debugging. They are not part of the code. For example, widht = 816 is the returned value of var width.

You've overwritten the scene's update function without calling the original one, so new windows aren't going to be added properly. Replace it with
JavaScript:
Scene_VictoryBattle.prototype.update = function () {
    Scene_MenuBase.prototype.update.call(this);
    this.updateVictoryAftermath();
};
In general, when overriding existing functions like this remember to call the original one, unless you're sure you don't want the existing effects to trigger.

Fun trivia: why did the first window appear then? Because you didn't set openness to 0 in that one. So it instantly appears open. The second one is set to the beginning of its opening animation, but that animation cannot proceed because it's not getting updates, since the scene's update function responsible for that was removed.
It was something so simple... I should have noticed. Thank you very much, I learned a lot from this problem. Worked perfectly!

Original thread: https://forums.rpgmakerweb.com/threads/custom-menu-dont-show.164961/