Jump to content
Taiki.

Need help for Yanfly Ace Message System

Recommended Posts

I was able to do what you want but its a little sloppy.

In the Module I added in     NAME_FONT = 10   at line 193 after NAME_WINDOW_COLOUR

then

on line 528 I changed     super(0, 0, Graphics.width, fitting_height(1))

to 

    super(0, 0, Graphics.width, fitting_height($game_variables[YEA::MESSAGE::NAME_FONT]))
 

then at the start of the game I changed the variable to the value of 2. And for some reason I needed to open a menu, so I forced an open save window.

then

in the message box to display the name I used

\n<\{\n[4]>This is me

\n<\{\n[4]>This is me

\n<    > # show name box

\{    # increase font size

\n[4]   # display actor 4's name. You could put in text if you wanted.

\n<\{Big Bob>This is me

 

The down size. Whenever you change the variable to another value you have to open a menu or something (it's what I found worked)

 

Of course if you want a large name window all the time just set the fitting_height(1) to 2 -> fitting_height(2)

and use the code \{ to make the font bigger.

Share this post


Link to post
Share on other sites

I believe this should to fine:

\n<\fn[font_name]actor_name>

 

YEA has an error on this though. Sometimes the escape character width are calculated as a string, thus an error happened. If by chance you stumbled upon this error, change this line (if it's the one that cause the error):

   dw += calculate_size(text.slice!(0, 1), text) until text.empty?

into

   dw += calculate_size(text.slice!(0, 1), text).to_i until text.empty?

 

Hope this solve your problem. :)

Edited by Black Mage

Share this post


Link to post
Share on other sites

It works thanks but there would not be a way to make it easier by putting directly in the script : NAME_WINDOW_FONT_NAME = ["Arial"] for exemple

as there is already for the message MESSAGE_WINDOW_FONT_NAME = ["Sans"]

and so do the same thing for the font size like : NAME_WINDOW_FONT_SIZE    = 24

Share this post


Link to post
Share on other sites

Ok I gave it another crack, with some more knowledge of the code I was able to do this.

Spoiler

#==============================================================================
# ■ Window_NameMessage
#==============================================================================

class Window_NameMessage < Window_Base
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(message_window)
    @message_window = message_window
    super(0, 0, Graphics.width, Graphics.height)
    self.opacity = YEA::MESSAGE::NAME_WINDOW_OPACITY
    self.z = @message_window.z + 1
    self.openness = 0
    setup_message_font
    @close_counter = 0
    deactivate
  end
  
  alias r2_setup_message_font_hn4m setup_message_font
  def setup_message_font
    r2_setup_message_font_hn4m
    @message_font = true
    change_color(normal_color)
    contents.font.out_color = Font.default_out_color
    contents.font.name = YEA::MESSAGE::MESSAGE_NAME_WINDOW_FONT_NAME
    contents.font.size = YEA::MESSAGE::MESSAGE_NAME_WINDOW_FONT_SIZE
    contents.font.bold = YEA::MESSAGE::MESSAGE_NAME_WINDOW_FONT_BOLD
    contents.font.italic = YEA::MESSAGE::MESSAGE_NAME_WINDOW_FONT_ITALIC
    contents.font.outline = YEA::MESSAGE::MESSAGE_NAME_WINDOW_FONT_OUTLINE
    contents.font.shadow = YEA::MESSAGE::MESSAGE_NAME_WINDOW_FONT_SHADOW
  end

  #--------------------------------------------------------------------------
  # update
  #--------------------------------------------------------------------------
  def update
    super
    return if self.active
    return if self.openness == 0
    return if @closing
    @close_counter -= 1
    return if @close_counter > 0
    close
  end
  
  #--------------------------------------------------------------------------
  # start_close
  #--------------------------------------------------------------------------
  def start_close
    @close_counter = 4
    deactivate
  end
  
  #--------------------------------------------------------------------------
  # force_close
  #--------------------------------------------------------------------------
  def force_close
    @close_counter = 0
    deactivate
    close
  end
  
  #--------------------------------------------------------------------------
  # start
  #--------------------------------------------------------------------------
  def start(text, x_position)
    @text = text.clone
    set_width
    set_height
    create_contents
    set_x_position(x_position)
    set_y_position
    refresh
    activate
    open
  end
  
  def set_height
    text = @text.clone
    dh = text_size(text).height
    dh += YEA::MESSAGE::NAME_WINDOW_PADDING * 2
    self.height = dh
  end
  
  #--------------------------------------------------------------------------
  # set_width
  #--------------------------------------------------------------------------
  def set_width
    text = @text.clone
    dw = standard_padding * 2 + text_size(text).width
    dw += YEA::MESSAGE::NAME_WINDOW_PADDING * 2
    dw += calculate_size(text.slice!(0, 1), text) until text.empty?
    self.width = dw
  end
  
  #--------------------------------------------------------------------------
  # calculate_size
  #--------------------------------------------------------------------------
  def calculate_size(code, text)
    case code
    when "\e"
      return calculate_escape_code_width(obtain_escape_code(text), text)
    else
      return 0
    end
  end
  
  #--------------------------------------------------------------------------
  # calculate_escape_code_width
  #--------------------------------------------------------------------------
  def calculate_escape_code_width(code, text)
    dw = -text_size("\e").width - text_size(code).width
    case code.upcase
    when 'C', 'OC', 'OO'
      dw += -text_size("[" + obtain_escape_param(text).to_s + "]").width
      return dw
    when 'I'
      dw += -text_size("[" + obtain_escape_param(text).to_s + "]").width
      dw += 24
      return dw
    when '{'
      make_font_bigger
    when '}'
      make_font_smaller
    when 'FZ'
      contents.font.size = obtain_escape_param(text)
    when 'FN'
      text.sub!(/\[(.*?)\]/, "")
      font_name = $1.to_s
      font_name = Font.default_name if font_name.nil?
      contents.font.name = font_name.to_s
    when 'AMSF'
      case obtain_escape_param(text)
      when 0; reset_font_settings
      when 1; contents.font.bold = !contents.font.bold
      when 2; contents.font.italic = !contents.font.italic
      when 3; contents.font.outline = !contents.font.outline
      when 4; contents.font.shadow = !contents.font.shadow
      end
    else
      return dw
    end
  end
  
  #--------------------------------------------------------------------------
  # set_y_position
  #--------------------------------------------------------------------------
  def set_x_position(x_position)
    case x_position
    when 1 # Left
      self.x = @message_window.x
      self.x += YEA::MESSAGE::NAME_WINDOW_X_BUFFER
    when 2 # 3/10
      self.x = @message_window.x
      self.x += @message_window.width * 3 / 10
      self.x -= self.width / 2
    when 3 # Center
      self.x = @message_window.x
      self.x += @message_window.width / 2
      self.x -= self.width / 2
    when 4 # 7/10
      self.x = @message_window.x
      self.x += @message_window.width * 7 / 10
      self.x -= self.width / 2
    when 5 # Right
      self.x = @message_window.x + @message_window.width
      self.x -= self.width
      self.x -= YEA::MESSAGE::NAME_WINDOW_X_BUFFER
    end
    self.x = [[self.x, Graphics.width - self.width].min, 0].max
  end
  
  #--------------------------------------------------------------------------
  # set_y_position
  #--------------------------------------------------------------------------
  def set_y_position
    case $game_message.position
    when 0
      self.y = @message_window.height
      self.y -= YEA::MESSAGE::NAME_WINDOW_Y_BUFFER
    else
      self.y = @message_window.y - self.height
      self.y += YEA::MESSAGE::NAME_WINDOW_Y_BUFFER
    end
  end
  
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    reset_font_settings
    @text = sprintf("\eC[%d]%s", YEA::MESSAGE::NAME_WINDOW_COLOUR, @text)
    draw_text_ex(YEA::MESSAGE::NAME_WINDOW_PADDING, 0, @text)
  end
  
end # Window_NameMessage

 

With this in the header module

Spoiler

    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Message Font Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # Ace Message System separates the in-game system font form the message
    # font. Adjust the settings here for your fonts.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # This array constant determines the fonts used. If the first font does not
    # exist on the player's computer, the next font in question will be used
    # in place instead and so on.
    MESSAGE_WINDOW_FONT_NAME = ["Verdana", "Arial", "Courier New"]
    MESSAGE_NAME_WINDOW_FONT_NAME = ["Times New Roman", "Arial", "Courier New"]

    # These adjust the other settings regarding the way the game font appears
    # including the font size, whether or not the font is bolded by default,
    # italic by default, etc.
    MESSAGE_WINDOW_FONT_SIZE    = 24       # Font size.
    MESSAGE_WINDOW_FONT_BOLD    = false    # Default bold?
    MESSAGE_WINDOW_FONT_ITALIC  = false    # Default italic?
    MESSAGE_WINDOW_FONT_OUTLINE = true     # Default outline?
    MESSAGE_WINDOW_FONT_SHADOW  = false    # Default shadow?
    MESSAGE_NAME_WINDOW_FONT_SIZE    = 36       # Font size.
    MESSAGE_NAME_WINDOW_FONT_BOLD    = false    # Default bold?
    MESSAGE_NAME_WINDOW_FONT_ITALIC  = false    # Default italic?
    MESSAGE_NAME_WINDOW_FONT_OUTLINE = true     # Default outline?
    MESSAGE_NAME_WINDOW_FONT_SHADOW  = false    # Default shadow?

 

 

Edited by roninator2
forgot part of code

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×