MZ Probably an easy question to solve but..

I'm using Visustella's core, battle, message, etc plugins and i'd just like my in battle names to be my actors nicknames instead of their full names as they bleed into each other. can anyone help? I've been digging abit through this and even used two different ai's to help and I'd think this would be something simple.
I think this might work (untested).

JavaScript:
(function(old) {
Sprite_Name.prototype.name = function() {
    if($gameParty.inBattle() && this._battler.isActor() && this._battler.nickname()) {
        return this._battler.nickname();
    }
    return old.call(this);
};
})(Sprite_Name.prototype.name);

Save it as a .js file (make sure type is *.* if you're using Notepad) and enable it as a plugin.
I think this might work (untested).

JavaScript:
(function(old) {
Sprite_Name.prototype.name = function() {
    if($gameParty.inBattle() && this._battler.isActor() && this._battler.nickname()) {
        return this._battler.nickname();
    }
    return old.call(this);
};
})(Sprite_Name.prototype.name);

Save it as a .js file (make sure type is *.* if you're using Notepad) and enable it as a plugin.
do I alter this code in some way? When I launched my game to test it i got a " typeerror cannot read property 'isactor' of null " message
Oh, looks like I missed a case. I think adding a single question mark before .isActor should fix it, so it looks like this: this._battler?.isActor().
Oh, looks like I missed a case. I think adding a single question mark before .isActor should fix it, so it looks like this: this._battler?.isActor().
Hey! awesome it works! you wouldn't believe the time i spent with chatgpt trying to fix this. thanks so much!

Original thread: https://forums.rpgmakerweb.com/threads/probably-an-easy-question-to-solve-but.179819/