MV Script call to change name window x position?

Hello, so I'm aware that Yanfly's MessageCore has the plugin parameter "Name Box Buffer X" that allows you reposition the name box. While it works, I'm specifically looking for a way to change the position of the name window on the fly (as for why, I show bust images on both the left and right side of the screen, and I want to reposition the name box when the bust is on the left side only). I figured there had to be some sort of plugin command/script call to do so but I couldn't find anything after searching.

Here are some screenshots to demonstrate what I want to achieve:
1758146813344.png

What the name box looks like normally (bust on right side)
1758146839005.png

And what I want it to look like when the bust is on the left side

Any guidance would be greatly appreciated!
This one might be what you're searching for, AML_nameAlign


There are 3 presets for Left / Center / Right, but you could edit the plugin in notepad to change what the presets do. The "right" preset goes
this.x = messageWindow.x + messageWindow.width - this.width;

if you change that with this.x = messageWindow.x + (messageWindow.width / 4); that should be pretty close to the second screenshot!
Hey there!


You don't need script calls as I know.
There are textbox escapes.

May you should try \nr<Name> to align the Namebox .
1758174989619.png
This one might be what you're searching for, AML_nameAlign
Hi unfortunately I couldn't get it to work, I believe that plugin is only compatible with MZ

you should try \nr<Name> to align the Namebox
And I've tried the text codes. I can't center the name box because I have my choice windows in the middle and it'd look too cluttered, and when it's on the right side of the screen I think it just looks too odd on the opposite side of the text box. So moving the namebox only slightly to the right feels like the most natural-looking solution (sans removing the nameboxes altogether and showing names in the message window but that'd require me to go back and manually edit hundreds of messages :dizzy:)
Hi unfortunately I couldn't get it to work, I believe that plugin is only compatible with MZ


And I've tried the text codes. I can't center the name box because I have my choice windows in the middle and it'd look too cluttered, and when it's on the right side of the screen I think it just looks too odd on the opposite side of the text box. So moving the namebox only slightly to the right feels like the most natural-looking solution (sans removing the nameboxes altogether and showing names in the message window but that'd require me to go back and manually edit hundreds of messages :dizzy:)
You’re right – with Yanfly’s Message Core alone you only get left, center, and right alignment (\n, \nc, \nr).
There’s no built-in way to just move the namebox “a bit” to the right.

The only options without rewriting all your messages are:

• Use the global offset in the plugin parameters (affects all nameboxes)

• Or add a tiny addon plugin that lets you set X/Y offsets per message.

Sadly, vanilla YEP doesn’t support per-message fine-tuning out of the box. :/
Unsure if I should make a new thread, but I guess this would now be a MV plugin request?
Unsure if I should make a new thread, but I guess this would now be a MV plugin request?
You could post it there, of course.
If you have some time, I can take a look tomorrow and see what I can do.
It would also help to know how you currently handle the busts, so we can rebuild it and test the right solution.
If you have some time, I can take a look tomorrow and see what I can do.
It would also help to know how you currently handle the busts, so we can rebuild it and test the right solution.

Thanks I would really appreciate that! I use Galv's Message Busts to display my bust images with the following settings:
1758304633405.png


Also you and KyluxWolf's suggestions gave me the idea that I could just edit/replace one of the Yanfly name window text codes. There's this function on line 1137 of YEP_MessageCore that I assumed handles that, but nothing happened when I tried changing the alignment equations to something closer to what I want like this.x += this._parentWindow.width * 5 / 10;.
JavaScript:
Window_NameBox.prototype.adjustPositionX = function() {
    if (this._position === 1) {
      this.x = this._parentWindow.x;
      this.x += eval(Yanfly.Param.MSGNameBoxBufferX);
    } else if (this._position === 2) {
      this.x = this._parentWindow.x;
      this.x += this._parentWindow.width * 3 / 10;
      this.x -= this.width / 2;
    } else if (this._position === 3) {
      this.x = this._parentWindow.x;
      this.x += this._parentWindow.width / 2;
      this.x -= this.width / 2;
    } else if (this._position === 4) {
      this.x = this._parentWindow.x;
      this.x += this._parentWindow.width * 7 / 10;
      this.x -= this.width / 2;
    } else {
      this.x = this._parentWindow.x + this._parentWindow.width;
      this.x -= this.width;
      this.x -= eval(Yanfly.Param.MSGNameBoxBufferX);
    }
    this.x = this.x.clamp(0, Graphics.boxWidth - this.width);
};

I feel like the answer lies somewhere around line 1115 or 1305 but I just couldn't figure it out 😅 so maybe someone better at javascript could get it working.
Also you and KyluxWolf's suggestions gave me the idea that I could just edit/replace one of the Yanfly name window text codes. There's this function on line 1137 of YEP_MessageCore that I assumed handles that, but nothing happened when I tried changing the alignment equations to something closer to what I want like this.x += this._parentWindow.width * 5 / 10;.

I checked this out.
Editing Yanfly’s code directly (for example changing adjustPositionX) usually doesn’t work, because the name box position gets recalculated and clamped again during the message flow. Your changes get overwritten.:LZSsad:

So I wrote a tiny addon plugin instead. It simply nudges the name box after Yanfly has done his calculations. That way you don’t need to modify YEP_MessageCore or Galv’s plugin at all.

Usage:

  1. Place JAO_NameBoxNudge.js below YEP_MessageCore.
  2. Plugin Commands:
    • NameBoxAutoOffset <leftX> <leftY> <rightX> <rightY>
    • SetBustSide left / SetBustSide right
  3. The name box will then auto-adjust depending on your bust side.

I’ve attached the plugin and a short README with full instructions.
License: Free for commercial and non-commercial use.
Credit appreciated (Nusseysen).:LZSooo:

Have fun with it! :LZSwink:
If anything doesn’t work the way you expect, just let me know.
I’d also love to take a look at your project once it’s ready. 😀
JAO_NameBoxNudge.js
Wow it works perfectly you're a lifesaver! I really can't thank you enough! And of course I'll be sure to share my project here on the forums when it's done :LZSjoy:
Youre Welcome. 🙂
Glad it works fine for you.

Happy dev'ing 😉
I had exactly the same problem just now and it seems to be solved already but I found different solution and I'm just gonna post it here if someone stumbles upon this thread.

Yes Yanfly's plugin has \nc and \nr options but he also added \n1<> up to \n5<>

You can manually edit the start of the NameBox with this script:
Yanfly.Param.MSGNameBoxBufferX = "180"

This offsets the name box 180 pixels to the right. Some character portraits have different sizes and require different amount of pixels but it's annoying to have a common event every time a character says something, so you can edit the plugin like shown in the picture.

In the picture example, any time you type \n<> in Show Text, the NameBox will be offset by 180 pixels, any time you type \n1<> the name box will be offset by 0 pixels. Other options are unmodified in the example.

I use \n<> for characters and \n1<> for NPCs since they don't have portraits in my game, you can add different values for the different numbers, and add more numbers if needed, let's say certain character has bigger portrait, you can modify \n5<> to work for this character only. So anytime this character says something, use \n5 instead of \n

Original thread: https://forums.rpgmakerweb.com/threads/script-call-to-change-name-window-x-position.180125/