Create Two Instances of Window Status Menu

deykuzor

Korean Guy Screaming in Italian American
Member
Joined
Sep 7, 2017
Messages
23
Reaction score
5
First Language
English
Primarily Uses
RMMV
I want to create two instances of Status Menu that would both operate on the same inputs, but take two different constructors. One would be used like most bust menu versions of a Main Menu, and the other would operate like a normal list of the party members, without the faces. I've somehow managed to make this (see attached) but I can't get the list view to display more entries, and iterating through $gameParty.members only displays the last party member, rather than the first. I'm aiming for something akin to the image labeled menumockup.png. The list in that mockup does not include meters mostly because I hadn't decided to include them yet. Please assume that I want the meters in the list window.

this is what I have relating to that window:

var _Scene_Menu_create = Scene_Menu.prototype.create;
Scene_Menu.prototype.create = function() {
_Scene_Menu_create.call(this);
this.createMeterWindow(this._statusWindow);
this.createListWindow(this._statusWindow1);
this._statusWindow.x = eval(bwX);
this._statusWindow.y = eval(bwY);
this._commandWindow.x = eval(comX);
this._commandWindow.y = eval(comY);
this._goldWindow.x = eval(goldX);
this._goldWindow.y = eval(goldY);
this._hpWindow.x = eval(hpX);
this._hpWindow.y = eval(hpY);
};

Scene_Menu.prototype.createListWindow = function(window) {

this._statusWindow1 = new Window_Party_List(0, 0, window);
this._statusWindow1.x = 420;
this._statusWindow1.y = 140;
this.addWindow(this._statusWindow1);
};


//=============================================================================
// Window_Party_List
//=============================================================================

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


Window_Party_List.prototype = Object.create(Window_Base.prototype);
Window_Party_List.prototype.constructor = Window_Party_List;
Window_Party_List.prototype.initialize = function(x, y) {
var width = this.windowWidth();
var height = this.windowHeight();
Window_Base.prototype.initialize.call(this, x, y, width, height);
this._index = 0;
this._name = '';
this._actor = $gameParty.members()[this._index];
this._isWindow = false;
this.refresh();
};


Window_Party_List.prototype.windowWidth = function() {
return 379;
};
Window_Party_List.prototype.windowHeight = function() {
return this.itemHeight() * 5.6;
};
Window_Party_List.prototype.numVisibleRows = function() {
return Math.min($gameParty.maxItems(), sumListRows);
};
Window_Party_List.prototype.maxCols = function() {
return sumListColumns;
};
Window_Party_List.prototype.itemHeight = function() {
return sumItemHeight;
};
Window_Party_List.prototype.itemWidth = function() {
return sumItemWidth;
};
Window_Party_List.prototype.drawItem = function(index) {
this.drawItemBackground(index);
this.drawItemStatus(index);
};
Window_Party_List.prototype.drawItemStatus = function(index) {
var actor = $gameParty.members()[index];
var rect = this.itemRect(index);
var width = (rect.width / 3) - 20;
this.drawActorName(actor, rect.x + 10, rect.y, width);
this.drawActorHp(actor, rect.x + width + 30, rect.y, width);
this.drawActorMp(actor, rect.x + width * 2 + 50, rect.y, width);
};
Window_Party_List.prototype.refresh = function() {
var x = this.textPadding();
var y = 0;
var width = this.contents.width - this.textPadding() * 2;
var meterWidth = 20;
var actor = $gameParty.members()[this._index];
this._name = actor.name();
this.contents.clear();
this.drawActorName(actor, x, y);
this.drawActorHp(actor, x + (meterWidth*9), y, (width/4.5));
var i = 2;
this.drawActorMp(actor, x + (meterWidth*13), y, (width/4.5));
i += 1;
};



admittedly, a lot of this is jerry-rigged from limited knowledge of Javascript, the kinoar github, and other plugin's changes to the status menu that accomplished similar things, so while I can kinda follow along with what I wrote, I'm not 100 percent sure what I wrote that's necessary, or was stuff that was superfluous to my goal here. Any variables or parameters that are used in whatever function, but I didn't seem to define were defined at the top of my javascript file, so don't worry about that.
 

Attachments

Gongylus

Villager
Member
Joined
Apr 4, 2020
Messages
15
Reaction score
5
First Language
English
Primarily Uses
RMMV
I'm taking a guess here, but I think you need to set the maxItems in Window_Party_List .

DrawAllItems in Window_Selectable uses it to know how many times to iterate through index, but it is set as 0 by default in Window_Selectable.

Just need to pinch the function from Window_MenuStatus :

Window_Party_List .prototype.maxItems = function() {
return $gameParty.size();
}

Dunno how it will effect the rest of your code, but you could also make Window_Party_List from the Window_MenuStatus instead of Window_Base and that will pull all the functions from there into Window_Party_List

Window_Party_List.prototype = Object.create(Window_MenuStatus.prototype);
Window_Party_List.prototype.constructor = Window_Party_List;
 

Gongylus

Villager
Member
Joined
Apr 4, 2020
Messages
15
Reaction score
5
First Language
English
Primarily Uses
RMMV
Just thought, Window_Base probably won't work anyway. I imagine it needs to be Window_Selectable or better yet built from Window_MenuStatus for all of its functionality.
 

deykuzor

Korean Guy Screaming in Italian American
Member
Joined
Sep 7, 2017
Messages
23
Reaction score
5
First Language
English
Primarily Uses
RMMV
I really appreciate your responses as always. It's currently 1am in Japan so I'll have to try this tomorrow.
I DID try to use Window_MenuStatus before instead of Window_Base but i got a pagedown not found in Window_MenuStatus if I recall from my work a few hours ago....

I'll see if I can figure out a way to get Window_MenuStatus extended properly by my Window_Party_List first since you've recommended it, and then add a maxItems property to the prototype. I'll get back to you in about 7 or 8 hours with my results. Thanks again!
 

deykuzor

Korean Guy Screaming in Italian American
Member
Joined
Sep 7, 2017
Messages
23
Reaction score
5
First Language
English
Primarily Uses
RMMV
Just thought, Window_Base probably won't work anyway. I imagine it needs to be Window_Selectable or better yet built from Window_MenuStatus for all of its functionality.
Window_Party_List.prototype = Object.create(Window_MenuStatus.prototype);
Window_Party_List.prototype.constructor = Window_Party_List;
Window_Party_List.prototype.initialize = function(x, y) {
var width = this.windowWidth();
var height = this.windowHeight();
var maxItems = this.maxItems();
Window_Selectable.prototype.initialize.call(this, 0, y, width, height);
this._index = 0;
this._name = '';
this._actor = $gameParty.members()[this._index];
this._isWindow = false;
this.refresh();
};

I GOT IT!
Thank you so much! My problem with constructing form Window_MenuStatus was I blindly was initializing a Window_Base prototype instead of a Selectable prototype. I KNEW I was loading the wrong scene somehow.

I also added the maxItems function like you suggested, so, again, thank you so much!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.
time for a new avatar :)

Forum statistics

Threads
106,017
Messages
1,018,356
Members
137,802
Latest member
rencarbali
Top