RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu

[RESOLVED]How would i change the color of text like "HP" in battle?

Started by gameo, May 24, 2008, 11:10:02 PM

0 Members and 1 Guest are viewing this topic.

gameo

I have a problem in-battle. I'm using the default battle system, (Yes, urgh! If there's the default battle system with battlers and a twist like hp bars or something, feel free to inform me!) and I have a problem because my character has a blue water glow around him, and that overlaps the HP and SP text since the font is blue! Can i change the color of the font?

Thanks in advance,
- David
Does 2+2 equal a peanut?

modern algebra

Yes, try adding this script right below Window_BattleStatus. This is untested, but it ought to work fine.


class Window_BattleStatus

  #--------------------------------------------------------------------------
  # * Draw HP
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : draw spot width
  #--------------------------------------------------------------------------
  def draw_actor_hp(actor, x, y, width = 144)
    # Draw "HP" text string
    #----------------------------------------------------------------------
    # EDITABLE:
    #    To set the new color, change around the numbers below after Color.new
    #    The format is Color.new (red, green, blue, opacity)
    #----------------------------------------------------------------------
    self.contents.font.color = Color.new (100, 100, 100, 255)
    self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
    # Calculate if there is draw space for MaxHP
    if width - 32 >= 108
      hp_x = x + width - 108
      flag = true
    elsif width - 32 >= 48
      hp_x = x + width - 48
      flag = false
    end
    # Draw HP
    self.contents.font.color = actor.hp == 0 ? knockout_color :
      actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
    self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
    # Draw MaxHP
    if flag
      self.contents.font.color = normal_color
      self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
      self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
    end
  end
end