Creating a Window in Battle Scene that shows the actor States

Ok, so I've been bothering you all here in the forum all the weekend with this, but I almost got it.

The thing is that I'm tryng to create a Window in the Battle Scene that shows the actor States.
Ok, so I was able to create a window on the Battle Scene and I can show the gauges or delete them, and also I was able to make the Status Icons don't show on the Battle Status Window.

But for some reason I can't make the Actor Icons show in the window tha I've created.
I don't understand where does the program store the states that affect one actor.


Well, thank you all.

Here is my code:

Code:
function Window_ActorState() {
    this.initialize.apply(this, arguments);
}

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

Window_ActorState.prototype.initialize = function() {
    var width = 800;
    var height = 200;
    var x = 0;
    var y = 0;
    Window_Selectable.prototype.initialize.call(this, x, y, width, height);
    this.refresh();
    this.openness = 0;
};

Window_ActorState.prototype.windowWidth = function() {
    return Graphics.boxWidth - 192;
};

Window_ActorState.prototype.windowHeight = function() {
    return this.fittingHeight(this.numVisibleRows());
};

Window_ActorState.prototype.numVisibleRows = function() {
    return 4;
};

Window_ActorState.prototype.maxItems = function() {
    return $gameParty.battleMembers().length;
};

Window_ActorState.prototype.refresh = function() {
    this.contents.clear();
    this.drawAllItems();
 
};

Window_ActorState.prototype.drawItem = function(index) {
    var actor = $gameParty.battleMembers()[index];
    this.drawBasicArea(this.basicAreaRect(index), actor);
 
};

Window_ActorState.prototype.basicAreaRect = function(index) {
    var rect = this.itemRectForText(index);
    rect.width -= 200;
    return rect;
};

Window_ActorState.prototype.gaugeAreaRect = function(index) {
    var rect = this.itemRectForText(index);
    rect.x += rect.width - this.gaugeAreaWidth();
    rect.width = this.gaugeAreaWidth();
    return rect;
};

Window_ActorState.prototype.gaugeAreaWidth = function() {
    return 330;
};

Window_ActorState.prototype.drawBasicArea = function(rect, actor) {
    this.drawActorIcons(actor, rect.x + 156, rect.y, rect.width - 156);
};




//=========================================================================

var old_createAllWindows = Scene_Battle.prototype.createAllWindows
Scene_Battle.prototype.createAllWindows = function() {
    old_createAllWindows.call(this)
    this.createActorStateWindow();

};
Scene_Battle.prototype.createActorStateWindow = function() {
    this._actorStateWindow = new Window_ActorState();
    this.addWindow(this._actorStateWindow);
    this._actorStateWindow.open();
//sin esta línea no se abre la ventana
};



//=======================================================================

Window_BattleStatus.prototype.drawItem = function(index) {
    var actor = $gameParty.battleMembers()[index];
    this.drawGaugeArea(this.gaugeAreaRect(index), actor);
};
If you're interested, you can reference a Plugin I made for developers to use that creates status icon windows. You can find it here.

A few important areas you may want to look at are Game_Actor.prototype.states and Game_Actor.prototype.allIcons, as well as the _states property on instances of Game_Actor. Some of those methods or properties might exist on Game_Battler, instead, but Game_Actor extends Game_Battler.

The states() method will return an Array of objects representing each State.
The _states property will return an Array of the state IDs currently affecting the Actor.
The allIcons() method should return an Array of all the icon indexes currently affecting the Actor. This is what I used in that Plugin I linked.
Oh, thank you very much, I kind of solve it my self.
I was not able to make the icons to show in the window I'va created, but I gave that window the propietis and functions of the Battle Status Window and left this one only for displaying the State Icons.
So now I have a window that displays de gauges and another taht displays the State Icons witch is pretty much what I intended.
The code:

Code:
function Window_ActorState() {
    this.initialize.apply(this, arguments);
}

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

Window_ActorState.prototype.initialize = function() {
    var width = 800;
    var height = 200;
    var x = 0;
    var y = 0;
    Window_Selectable.prototype.initialize.call(this, x, y, width, height);
    this.refresh();
    this.openness = 0;
};

Window_ActorState.prototype.windowWidth = function() {
    return Graphics.boxWidth - 192;
};

Window_ActorState.prototype.windowHeight = function() {
    return this.fittingHeight(this.numVisibleRows());
};

Window_ActorState.prototype.numVisibleRows = function() {
    return 4;
};

Window_ActorState.prototype.maxItems = function() {
    return $gameParty.battleMembers().length;
};

Window_ActorState.prototype.refresh = function() {
    this.contents.clear();
    this.drawAllItems();
  
};

Window_ActorState.prototype.drawItem = function(index) {
    var actor = $gameParty.battleMembers()[index];
    this.drawBasicArea(this.basicAreaRect(index), actor);
    this.drawGaugeArea(this.gaugeAreaRect(index), actor);
};

Window_ActorState.prototype.basicAreaRect = function(index) {
    var rect = this.itemRectForText(index);
    rect.width -= 200;
    return rect;
};

Window_ActorState.prototype.gaugeAreaRect = function(index) {
    var rect = this.itemRectForText(index);
    rect.x += rect.width - this.gaugeAreaWidth();
    rect.width = this.gaugeAreaWidth();
    return rect;
};
Window_ActorState.prototype.gaugeAreaWidth = function() {
    return 330;
};

Window_ActorState.prototype.drawBasicArea = function(rect, actor) {
    this.drawActorIcons(actor, rect.x + 156, rect.y, rect.width - 156);
};

Window_ActorState.prototype.drawGaugeArea = function(rect, actor) {
    if ($dataSystem.optDisplayTp) {
        this.drawGaugeAreaWithTp(rect, actor);
    } else {
        this.drawGaugeAreaWithoutTp(rect, actor);
    }
};

Window_ActorState.prototype.drawGaugeAreaWithTp = function(rect, actor) {
    this.drawActorHp(actor, rect.x + 0, rect.y, 108);
    this.drawActorMp(actor, rect.x + 123, rect.y, 96);
    this.drawActorTp(actor, rect.x + 234, rect.y, 96);
};

Window_ActorState.prototype.drawGaugeAreaWithoutTp = function(rect, actor) {
    this.drawActorHp(actor, rect.x + 0, rect.y, 201);
    this.drawActorMp(actor, rect.x + 216,  rect.y, 114);
};




//=========================================================================

var old_createAllWindows = Scene_Battle.prototype.createAllWindows
Scene_Battle.prototype.createAllWindows = function() {
    old_createAllWindows.call(this)
    this.createActorStateWindow();

};
Scene_Battle.prototype.createActorStateWindow = function() {
    this._actorStateWindow = new Window_ActorState();
    this.addWindow(this._actorStateWindow);
    this._actorStateWindow.open();
//sin esta línea no se abre la ventana
};



//=======================================================================

Window_BattleStatus.prototype.drawItem = function(index) {
    var actor = $gameParty.battleMembers()[index];
    this.drawBasicArea(this.basicAreaRect(index), actor);
};

Window_BattleStatus.prototype.drawBasicArea = function(rect, actor) {
    this.drawActorIcons(actor, rect.x + 156, rect.y, rect.width - 156);
};

The next step is diferenciate two kinds of states, ones that show in the Battle Status window in the form of text and ones that show in the other in the form of icons.

Oh boy, this is going to be hard. But I was able to kind of figuire it out by my self, with the help of the community. I feel like I've learned a lot.
The next step is diferenciate two kinds of states, ones that show in the Battle Status window in the form of text and ones that show in the other in the form of icons.

You could use notetags on your states. If you do, you should have meta and note properties on a given state to reference.

Oh boy, this is going to be hard. But I was able to kind of figuire it out by my self, with the help of the community. I feel like I've learned a lot.

Glad to hear!

Original thread: https://forums.rpgmakerweb.com/threads/creating-a-window-in-battle-scene-that-shows-the-actor-states.105762/