ccoa's UMS name box position add-on

ccoa's UMS Name Box Position Add-on
by Black Mage
​

Introduction
I wanted to change the position of the name box in some situations, but UMS doesn't have an option for it.
I had Black Mage create this add-on, so it's possible now.
It works for both normal mode and FIT_WINDOW_TO_TEXT mode.

Screenshots
Spoiler
Game_16ZP17dJF8.png

Game_zZqHf7E97d.png

Game_NVEFRPcPYk.png

How to Use
Install: Copy and paste the script above Main and below UMS.

Changing the value of $game_system.nb_align through script call.
For example:
Ruby:
$game_system.nb_align = 1
This will make the name box aligned to the center of the message window.
Available values:
0 = Left
1 = Center
2 = Right

Script
Spoiler
Ruby:
#-------------------------------------------------------------------------------
# CCOA's UMS Addon By Black Mage
# Version: 1.0
#
# https://burningwizard.wordpress.com/
#-------------------------------------------------------------------------------
#
# This script is an addon for CCOA's UMS. It adds a function to change the
# alignment of the name box by changing the value of
#
#   $game_system.nb_align
#
# through script call. For example:
#
#   $game_system.nb_align = 1
#
# This will make the name box aligned to the center of the message window.
#
# Available values:
# 0 = Left
# 1 = Center
# 2 = Right
#
#-------------------------------------------------------------------------------

module BM_UMS_Addon
  def self.set_pos(alignment, x, y, w1, w2)
    case alignment
    when 0
      pos = [x, y - 36]
    when 1
      pos = [x + ((w1 - w2 + 12)/2), y - 36]
    when 2
      pos = [x + w1 - w2 + 12, y - 36]
    end
    pos
  end
end

class Game_System
  attr_accessor :nb_align
  alias b_init initialize
  def initialize; b_init; @nb_align = 0; end
end

class Window_Message < Window_Selectable
  alias b_r_w reset_window
  def reset_window(change_opacity = true)
    b_r_w(change_opacity)
    if $game_system.name != ""
      @name_window.set_name(@name)
      pos = BM_UMS_Addon.set_pos($game_system.nb_align, self.x, self.y, self.width, @name_window.width)
      @name_window.x = pos[0]; @name_window.y = pos[1]
      @name_window.set_name($game_system.name)
    end
  end
end

class Window_Slave < Window_Base
  alias b_r_w reset_window
  def reset_window(change_opacity = true)
    b_r_w(change_opacity)
    if @name != "" and @name != nil
      @name_window.set_name(@name)
      pos = BM_UMS_Addon.set_pos($game_system.nb_align, self.x, self.y, self.width, @name_window.width)
      @name_window.x = pos[0]; @name_window.y = pos[1]
    end
  end
end


Credits and Thanks
- Black Mage
You are the best, Dan! Thank you very much! It's exactly what I needed 😍

Original thread: https://forums.rpgmakerweb.com/threads/ccoas-ums-name-box-position-add-on.165602/