MV How to add a stats window for the active battler ?

Hello Makers,

I'm currently struggling on how to add a window during battles.

I would like to create a window that shows various stats such as , Attack, Defense, etc., for the character currently in action. I've tried exploring different plugins and attempted a few approaches on my own, but I haven't been able to achieve the desired outcome.

If anyone has experience or knowledge in implementing a character stats window specifically for battles in RPG Maker MV, I would greatly appreciate your guidance. Any recommendations on plugins, code snippets, or step-by-step instructions would be incredibly helpful in helping me accomplish this task.
You might be able to do this by setting up an info window through SRD's Window Upgrade plugin.
You might be able to do this by setting up an info window through SRD's Window Upgrade plugin.
Thanks a lot but the required Game Upgrade Plugin make my game crash 🙁

Here what I have drafted

JavaScript:
(function() {
    var parameters = PluginManager.parameters('ParamBattleWindow');

    var windowX = Number(parameters['WindowX'] || 800);
    var windowY = Number(parameters['WindowY'] || 450);
    var windowWidth = Number(parameters['WindowWidth'] || 300);
    var windowHeight = Number(parameters['WindowHeight'] || 300);
    var windowFontSize = Number(parameters['WindowFontSize'] || 24);
    var windowOpacity = Number(parameters['WindowOpacity'] || 255);
    var windowTextColor = String(parameters['WindowTextColor'] || '#ffffff');
    var windowOutlineColor = String(parameters['WindowOutlineColor'] || '#000000');
    var windowOutlineWidth = Number(parameters['WindowOutlineWidth'] || 4);
    var windowOutlineOpacity = Number(parameters['WindowOutlineOpacity'] || 128);

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

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

    Window_ParamBattleWindow.prototype.initialize = function(x, y, width, height) {
        Window_Base.prototype.initialize.call(this, x, y, width, height);
        this.refresh();
    };

    Window_ParamBattleWindow.prototype.refresh = function() {
        this.contents.clear();
        this.contents.fontSize = windowFontSize;
        this.contents.paintOpacity = windowOpacity;
        this.contents.textColor = windowTextColor;
        this.contents.outlineColor = windowOutlineColor;
        this.contents.outlineWidth = windowOutlineWidth;
        this.contents.outlineOpacity = windowOutlineOpacity;

        var activeActor = BattleManager.actor();
        if (activeActor && activeActor.actorId()) {
            var actorName = activeActor.name();
            var actorAtk = activeActor.atk;
            var actorMat = activeActor.mat;
            var actorAgi = activeActor.agi;
            var actorLuk = activeActor.luk;

            this.drawText(actorName, 0, 0, this.contentsWidth(), 'left');
            this.drawText('ATK: ' + actorAtk, 0, this.lineHeight(), this.contentsWidth(), 'left');
            this.drawText('MAT: ' + actorMat, 0, this.lineHeight() * 2, this.contentsWidth(), 'left');
            this.drawText('AGI: ' + actorAgi, 0, this.lineHeight() * 3, this.contentsWidth(), 'left');
            this.drawText('LUK: ' + actorLuk, 0, this.lineHeight() * 4, this.contentsWidth(), 'left');
        }
    };

    Window_ParamBattleWindow.prototype.update = function() {
        Window_Base.prototype.update.call(this);
        if (BattleManager.isInputting() && this.isOpen()) {
            this.refresh();
        }
    };

    var _Scene_Battle_createAllWindows = Scene_Battle.prototype.createAllWindows;
    Scene_Battle.prototype.createAllWindows = function() {
        _Scene_Battle_createAllWindows.call(this);
        if (BattleManager.actor() && BattleManager.actor().actorId()) {
            this.createParamBattleWindow();
        }
    };

    Scene_Battle.prototype.createParamBattleWindow = function() {
        this._paramBattleWindow = new Window_ParamBattleWindow(windowX, windowY, windowWidth, windowHeight);
        this.addWindow(this._paramBattleWindow);
    };
})();

But I think that BattleManager.actor() is null when the commands are active (I used VE_Battle Commands fyi).
What is the problem? Is it not creating a window at all or is it creating a window but not displaying the right information? Are there any errors in the console log?
What is the problem? Is it not creating a window at all or is it creating a window but not displaying the right information? Are there any errors in the console log?
It is not creating a window at all. When I switch BattleManager.actor() for $gameParty.members()[0], the code work (see image, positions are WIP). No error in the console log to help me but I think that BattleManager.actor() is empty for some reason.


Capture d’écran 2023-05-20 235553.png
Capture d’écran 2023-05-20 235731.png


EDIT :

I did some manipulations and it worked 🙂
Thanks for your time !

Original thread: https://forums.rpgmakerweb.com/threads/how-to-add-a-stats-window-for-the-active-battler.157679/