MZ How to Make a Battle Message/Log/Bar Thing?

Truth be told, I have no clue what this is called. I want my skills to be more easily read while in battle, regardless of battleback. Cuz atm, I just get text displayed with no background when an actor uses a skill in battle.

If there's no way to do it vanilla, what plugins do you recommend?

Example image below:

hq720.jpg
Cuz atm, I just get text displayed with no background when an actor uses a skill in battle.
I'm not sure what you mean by "no background". The battle log window by default uses the "dimmed" background, which puts a dark rectangle behind it but doesn't draw a window border.

If you wanted, you could make it use the standard window border. I'm not completely sure how you'd do that, but it's probably not that hard by editing the core scripts (or with a mini-plugin). My first guess would be to comment out the this.opacity = 0 line. I haven't tried this though.
If you want bordered window you can put something like this in as a plugin (copy paste to notepad, save as .js file and add as plugin). But when you put borders it's going to fill a lot of space so I reduced lines here to 4. That means you might miss some information in some cases because it's normally 10 lines. (Not even sure if that maxLines is used anywhere, but since it's in base code I changed that too.)

Scene_Battle.prototype.logWindowRect = function() {
const wx = 0;
const wy = 0;
const ww = Graphics.boxWidth;
const wh = this.calcWindowHeight(4, false);
return new Rectangle(wx, wy, ww, wh);
};

Window_BattleLog.prototype.maxLines = function() {
return 4;
};

Window_BattleLog.prototype.drawBackground = function() {

};

const _myEdit1_WindowBattleLog_addText = Window_BattleLog.prototype.addText;
Window_BattleLog.prototype.addText = function(text) {
_myEdit1_WindowBattleLog_addText.call(this, text);
this.opacity = 255;
};

const _myEdit1_WindowBattleLog_clear = Window_BattleLog.prototype.clear;
Window_BattleLog.prototype.clear = function() {
_myEdit1_WindowBattleLog_clear.call(this);
this.opacity = 0;
};
If you want bordered window you can put something like this in as a plugin (copy paste to notepad, save as .js file and add as plugin). But when you put borders it's going to fill a lot of space so I reduced lines here to 4. That means you might miss some information in some cases because it's normally 10 lines. (Not even sure if that maxLines is used anywhere, but since it's in base code I changed that too.)

Scene_Battle.prototype.logWindowRect = function() {
const wx = 0;
const wy = 0;
const ww = Graphics.boxWidth;
const wh = this.calcWindowHeight(4, false);
return new Rectangle(wx, wy, ww, wh);
};

Window_BattleLog.prototype.maxLines = function() {
return 4;
};

Window_BattleLog.prototype.drawBackground = function() {

};

const _myEdit1_WindowBattleLog_addText = Window_BattleLog.prototype.addText;
Window_BattleLog.prototype.addText = function(text) {
_myEdit1_WindowBattleLog_addText.call(this, text);
this.opacity = 255;
};

const _myEdit1_WindowBattleLog_clear = Window_BattleLog.prototype.clear;
Window_BattleLog.prototype.clear = function() {
_myEdit1_WindowBattleLog_clear.call(this);
this.opacity = 0;
};
It works! Though I had to make the max line height into 2 instead of 4. Though is there some way to fix the spacing?

It should probably say something like "Kara attacks" instead of "Karaattacks"

Asides from that small issue, its workin like a charm!

1777852660764.png
It works! Though I had to make the max line height into 2 instead of 4. Though is there some way to fix the spacing?

It should probably say something like "Kara attacks" instead of "Karaattacks"

Asides from that small issue, its workin like a charm!

View attachment 365502
wait i might have found a fix- some of the skill messages didnt have spaces- that's on me

with this fixed- is there some kind of way in the code to make it so the text is centered?
Yeah the texts are coming from your skill settings.

For center text it's using the drawTextEx which I don't think has alignment in base code. So you'd have to modify the code or make it use "basic" drawText with center aligment, but that one doesn't do text codes and icons etc I think.
Or if you just want to make text start more toward the center without actually centering it, you can just add to the x value where it starts drawing (as an example I added +100):
Window_BattleLog.prototype.drawLineText = function(index) {
const rect = this.lineRect(index);
this.contents.clearRect(rect.x, rect.y, rect.width, rect.height);
this.drawTextEx(this._lines[index], rect.x + 100, rect.y, rect.width);
};

Anyway if you're using just two lines I think you're gonna miss a lot of information there, unless you modify the whole system.
Yeah the texts are coming from your skill settings.

For center text it's using the drawTextEx which I don't think has alignment in base code. So you'd have to modify the code or make it use "basic" drawText with center aligment, but that one doesn't do text codes and icons etc I think.
Or if you just want to make text start more toward the center without actually centering it, you can just add to the x value where it starts drawing (as an example I added +100):
Window_BattleLog.prototype.drawLineText = function(index) {
const rect = this.lineRect(index);
this.contents.clearRect(rect.x, rect.y, rect.width, rect.height);
this.drawTextEx(this._lines[index], rect.x + 100, rect.y, rect.width);
};

Anyway if you're using just two lines I think you're gonna miss a lot of information there, unless you modify the whole system.


This is all good to hear, 100%

I also just tested the plugin in a project of mine that has vizustella stuff in it- and it works thankfully; saves me having to ask.

Am I able to use this plugin in my [unannounced] commercial project? If so, how shall I credit you? Do you have an itch page I can link to?
For center text it's using the drawTextEx which I don't think has alignment in base code.
There is a plugin called RS_MessageAlign that implements centered text in drawTextEx. I don't know if it works in MZ though. It doesn't officially support MZ but there's a chance it may work anyway, so it could be worth a try.

If you were using that plugin, you'd modify the function as follows:
JavaScript:
Window_BattleLog.prototype.drawLineText = function(index) {
    const rect = this.lineRect(index);
    this.contents.clearRect(rect.x, rect.y, rect.width, rect.height);
    this.drawTextEx('\\TA[1]' + this._lines[index], rect.x, rect.y, rect.width);
};
@RaineDesidia Cool. If you want to credit me you can just put 'rpgLord69' in there, but it's not necessary.
@RaineDesidia Cool. If you want to credit me you can just put 'rpgLord69' in there, but it's not necessary.
I insist, no worries. I wanna make sure I provide as much credit as I can when I can for my project, even if it results in the credits being 30 minutes long-----
That's a good approach to credits. Make sure everyone who contributed is credited.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-a-battle-message-log-bar-thing.183471/