This custom script (mostly) works...

boldpaste2

The Dragon Heretics
Veteran
Joined
Dec 7, 2013
Messages
797
Reaction score
439
First Language
English
Primarily Uses
I am trying to add several windows to the menu including location and 4 different currencies (or points) based on a variable. I pretty much got it functional but there is one problem I can't seem to crack. I am trying to specify two separate fonts for the currencies and the map name. The map name is supposed to be constantia (and it works) while the numbers are supposed to be Felix Titling (but it is coming out to be constantia). Even if I cut the map name font settings out I still have no control over them. Can someone please point out my goof :p .

Just do a search for #Not working as intended

Code:
#==============================================================================# ** Window_MapDisplay#------------------------------------------------------------------------------#  This window displays the map name.#==============================================================================class Window_MapDisplay < Window_Base  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  def initialize	super(0, 0, 500, 200)  self.back_opacity = 0  self.opacity = 0  Font.default_size = 30  Font.default_out_color = Color.new(0,0,0,0)  Font.default_name = ["Constantia"] 	refresh  end  #--------------------------------------------------------------------------  # * Get Window Width  #--------------------------------------------------------------------------  def window_width	return 160  end  #--------------------------------------------------------------------------  # * Refresh  #--------------------------------------------------------------------------  def refresh	contents.clear	draw_text_ex(x, y, $game_map.display_name)  end  #--------------------------------------------------------------------------  # * Open Window  #--------------------------------------------------------------------------  def open	refresh	super  endend # Window_MapDisplay#==============================================================================# ** Window_MapDisplay#------------------------------------------------------------------------------#  This window displays Actor 2 SP Switch 50.#==============================================================================class Window_Actor2Display < Window_Base  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  def initialize	super(0, 0, 500, 200)  self.back_opacity = 0  self.opacity = 0  self.z = 600  Font.default_size = 36 #Not working as intended  Font.default_out_color = Color.new(0,0,0,0) #Not working as intended  Font.default_name = ["Felix Titling"] #Not working as intended	refresh  end  #--------------------------------------------------------------------------  # * Get Window Width  #--------------------------------------------------------------------------  def window_width	return 160  end  #--------------------------------------------------------------------------  # * Refresh  #--------------------------------------------------------------------------  def refresh	contents.clear  text = $game_variables[50]	draw_text(x - line_height, y, width, line_height, text, 2)  end  #--------------------------------------------------------------------------  # * Open Window  #--------------------------------------------------------------------------  def open	refresh	super  endend # Window_MapDisplay#==============================================================================# ** Scene_Menu#------------------------------------------------------------------------------#  This class performs the menu screen processing.#==============================================================================class Scene_Menu < Scene_MenuBase  #--------------------------------------------------------------------------  # * Start Processing  #--------------------------------------------------------------------------  alias map_name_start start  def start	map_name_start	create_map_display_window  end  alias actor2_start start  def start	actor2_start	create_actor2_display_window  end  #--------------------------------------------------------------------------  # * Create Map Display Window  #--------------------------------------------------------------------------  def create_map_display_window	@map_display_window = Window_MapDisplay.new	@map_display_window.x = 365	@map_display_window.y = 496  end  def create_actor2_display_window	@create_actor2_display_window = Window_Actor2Display.new	@create_actor2_display_window.x = 365	@create_actor2_display_window.y = 300  endend # Scene_Menu
 
Last edited by a moderator:

Hudell

Dog Lord
Veteran
Joined
Oct 2, 2014
Messages
3,557
Reaction score
3,752
First Language
Java's Crypt
Primarily Uses
RMMZ
I think this is the way to do that. I can't really test it right now.

Code:
def refresh  contents.clear  contents.font.size = 36  contents.font.out_color = Color.new(0, 0, 0, 0)  contents.font.name = ["Felix Titling"]  text = $game_variables[50]  draw_text(x - line_height, y, width, line_height, text, 2)end
 

Neon Black

The Classy Prostitute
Veteran
Joined
Mar 17, 2012
Messages
1,149
Reaction score
375
First Language
Sarcasm
Primarily Uses
That is correct.  Anywhere you have "Font.default_" you want to change to "contents.font.".  Also worth noting, your window_width methods are doing nothing since you're explicitly defining a width of 500 in your initialize.
 

boldpaste2

The Dragon Heretics
Veteran
Joined
Dec 7, 2013
Messages
797
Reaction score
439
First Language
English
Primarily Uses
What I did was create several defs for several font settings and I would load the font needed before the draw, and the next font needed after the draw. I had also discovered that the font's were changing all the fonts in the other menues as well so after the script ran I had to run another font change to restore things back to normal. I thought fonts would only change the fonts of whats inside the class?

#-------------------------------------------------------------------------- # * Get Fonts #-------------------------------------------------------------------------- def refresh_fonts Font.default_size = 30 Font.default_out_color = Color.new(0,0,0,0) Font.default_name = ["Constantia"] end def restore_fonts Font.default_size = 36 Font.default_out_color = Color.new(0,0,0,120) Font.default_name = ["Felix Titling"] end def fix_fonts Font.default_size = 24 Font.default_out_color = Color.new(0,0,0,255) Font.default_name = ["Constantia"] end
Code:
  #--------------------------------------------------------------------------  # * Refresh  #--------------------------------------------------------------------------  def refresh	contents.clear  refresh_fonts	draw_text_ex(x, y, $game_map.display_name)  restore_fonts  end
@ Neon Black Yea, I know my window_width is doing nothing. Still has some of my trial and error stuff in there. xD
 
Last edited by a moderator:

Neon Black

The Classy Prostitute
Veteran
Joined
Mar 17, 2012
Messages
1,149
Reaction score
375
First Language
Sarcasm
Primarily Uses
You're changing the global properties of the font class as it's initialized.  By changing Font.default_ anything, it changes the default values when a new instance of Font class is created, which happens any time a new instance of Bitmap class is created, which is what "contents" is.  Despite this, you're able to change the properties of an instance of the Font class after it has been created, such as "bitmap_instance.font.size = 16".  So as mentioned, anywhere you have "Font.default_" anything in there needs to change to "contents.font." to work properly to only change the one bitmap's font properties.
 

boldpaste2

The Dragon Heretics
Veteran
Joined
Dec 7, 2013
Messages
797
Reaction score
439
First Language
English
Primarily Uses
You're changing the global properties of the font class as it's initialized.  By changing Font.default_ anything, it changes the default values when a new instance of Font class is created, which happens any time a new instance of Bitmap class is created, which is what "contents" is.  Despite this, you're able to change the properties of an instance of the Font class after it has been created, such as "bitmap_instance.font.size = 16".  So as mentioned, anywhere you have "Font.default_" anything in there needs to change to "contents.font." to work properly to only change the one bitmap's font properties.
AH ok. so its contents.font. I kept using content.font when I initially tried the method. Thanks for helping me out there ^^. By any chance you have any good references in learning rgss3? I am trying to learn it and this was my first attempt (while looking at a base).
 

Neon Black

The Classy Prostitute
Veteran
Joined
Mar 17, 2012
Messages
1,149
Reaction score
375
First Language
Sarcasm
Primarily Uses
I don't know any. I normally just look for references of classes and methods when I look at a new language. Otherwise, glad we could help get this taken care of.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Forum statistics

Threads
107,556
Messages
1,030,511
Members
139,672
Latest member
WDRS
Top