Help - Search - Members - Calendar
Full Version: Outline HP/SP in battle?
RPG RPG Revolution Forums > Game Engines > RPG Maker XP Discussion
Lord_Moonstone
Hey everyone, I'm just getting started in actually seeing a game through to fruition in RMXP, and I stumbled into something seemingly simple that's left me dumbstruck. All I want to do is add an outline to HP/SP values and names of actors in a battle since the battler portraits make them incredibly frustrating and difficult to discern. I already added a script to make some bars for HP/SP, but it still would be nice to see the numbers.

Anyone know how to accomplish this?

Here's a screenshot for reference:
Reference Picture




You can see with the second battler how irritating it is to try and discern what his status is during a battle. Any help would be appreciated!
Redd
Maybe you can try to change the colour to an easy colour to see, like yellow or green. Something bright, but not white.
Lord_Moonstone
QUOTE (Redd @ Jul 10 2011, 04:04 PM) *
Maybe you can try to change the colour to an easy colour to see, like yellow or green. Something bright, but not white.


Alright, I'll tinker around and see if I can get only the HP/SP values/Names that color. Thanks for the advice.
Redd
No problem smile.gif if you can't do it, I might be able to... my scripting skills are a bit rusty as I haven't scripted for a while now.
Legacy
I know there was a script i spotted sometime ago, that allowed you to put an outline around certain text. Not too sure where it was, but i have a feeling it's in the MACL. Ill do a little digging later for you, if your still looking for that outline.
Lord_Moonstone
Yea, I was able to get names working. It outlines them for every instance: but it works. I just defined an outline at the bottom of Window_Base:

CODE
  #--------------------------------------------------
  # * Draw Outline
  #     x    : draw spot x-coordinate
  #     y    : draw spot y-coordinate
  #     w    : width
  #     h    : height
  #     text : text to display
  #---------------------------------------------------
  def draw_outline(x, y, w, h, text)
    self.contents.draw_text(x + 1, y * 32 + 1, w, h, text, 1)
    self.contents.draw_text(x - 1, y * 32 + 1, w, h, text, 1)
    self.contents.draw_text(x + 1, y * 32 - 1, w, h, text, 1)
    self.contents.draw_text(x - 1, y * 32 - 1, w, h, text, 1)
    self.contents.font.color = Color.new(255, 255, 255, 255)
    self.contents.draw_text(x, y * 32, w, h, text, 1)
  end


And then I changed Draw Name to do draw_outline instead of self.contents.draw_text.

CODE
  #--------------------------------------------------------------------------
  # * Draw Name
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #--------------------------------------------------------------------------
  def draw_actor_name(actor, x, y)
    self.contents.font.color = outline_color
    draw_outline(x, y, 120, 32, actor.name)
  end


I tried doing the same thing with HP and SP wherever self.contents.draw_text appeared, but it never works. :S Any ideas?
Legacy
Try this, not sure if it works..

CODE
#--------------------------------------------------------------------------
  # * Draw EXP
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #--------------------------------------------------------------------------
  def draw_actor_exp(actor, x, y)
    self.contents.font.color = outline_color
    draw_outline(x , y, 24, 32, "E")
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 24, y, 84, 32, actor.exp_s, 2)
    self.contents.draw_text(x + 108, y, 12, 32, "/", 1)
    self.contents.draw_text(x + 120, y, 84, 32, actor.next_exp_s)
  end
  #--------------------------------------------------------------------------
  # * 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
    self.contents.font.color = outline_color
    draw_outline(x, y, 32, 32, $data_system.words.hp)
    # Calculate if there is draw space for MaxHP
    if width - 32 >= 108
      hp_x = x + width - 98
      flag = true
    elsif width - 32 >= 48
      hp_x = x + width - 38
      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
  #--------------------------------------------------------------------------
  # * Draw SP
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : draw spot width
  #--------------------------------------------------------------------------
  def draw_actor_sp(actor, x, y, width = 144)
    # Draw "SP" text string
    self.contents.font.color = outline_color
    draw_outline(x, y, 32, 32, $data_system.words.sp)
    # Calculate if there is draw space for MaxHP
    if width - 32 >= 108
      sp_x = x + width - 98
      flag = true
    elsif width - 32 >= 48
      sp_x = x + width - 38
      flag = false
    end
    # Draw SP
    self.contents.font.color = actor.sp == 0 ? knockout_color :
      actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
    self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
    # Draw MaxSP
    if flag
      self.contents.font.color = normal_color
      self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
      self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
    end
  end
Lord_Moonstone
Blegh, got nothin' with that Legacy. Thanks for trying though. That plugin you mentioned: do you know where I could try digging it up?
Legacy
I've updated the script slightly, if that doesn't work, then you can look at the MACL and see how they did the outline method.

http://etheon.net/public/dl/macl_complete.txt

Just do a search for outline, and you should see something that helps.
Lord_Moonstone
Thanks Legacy, I tried everything out but it still wouldn't work. I resigned to using the drop shadow effect from Blizzard's Tons of Add-ons. It kinda gets the job done, but still not as good as I'd like. Maybe I'll mess around with that drop shadow effect to make it more akin to an outline.

Do people just avoid this problem by not using battlers? tongue.gif I see a lot of side-view systems nowadays. I might try out some font change to see if that'll help.
Redd
I use ABS systems or sideview versions of the battle system. The standard one sucks xD
Night_Runner
Enjoy a new piece of code smile.gif
code
CODE
#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
#  This window displays the status of all party members on the battle screen.
#==============================================================================

class Window_BattleStatus
  #--------------------------------------------------------------------------
  # * Draw Name
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #--------------------------------------------------------------------------
  def draw_actor_name(actor, x, y)
    self.contents.font.color = normal_color
    draw_outline(x, y, 120, 32, actor.name)
  end
  #--------------------------------------------------------------------------
  # * Draw State
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : draw spot width
  #--------------------------------------------------------------------------
  def draw_actor_state(actor, x, y, width = 120)
    text = make_battler_state_text(actor, width, true)
    self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
    draw_outline(x, y, width, 32, text)
  end
  #--------------------------------------------------------------------------
  # * 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
    self.contents.font.color = system_color
   draw_outline(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
    draw_outline(hp_x, y, 48, 32, actor.hp.to_s, 2)
    # Draw MaxHP
    if flag
      self.contents.font.color = normal_color
      draw_outline(hp_x + 48, y, 12, 32, "/", 1)
      draw_outline(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw SP
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : draw spot width
  #--------------------------------------------------------------------------
  def draw_actor_sp(actor, x, y, width = 144)
    # Draw "SP" text string
    self.contents.font.color = system_color
    draw_outline(x, y, 32, 32, $data_system.words.sp)
    # Calculate if there is draw space for MaxHP
    if width - 32 >= 108
      sp_x = x + width - 108
      flag = true
    elsif width - 32 >= 48
      sp_x = x + width - 48
      flag = false
    end
    # Draw SP
    self.contents.font.color = actor.sp == 0 ? knockout_color :
      actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
    draw_outline(sp_x, y, 48, 32, actor.sp.to_s, 2)
    # Draw MaxSP
    if flag
      self.contents.font.color = normal_color
      draw_outline(sp_x + 48, y, 12, 32, "/", 1)
      draw_outline(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
    end
  end
  #--------------------------------------------------
  # * Draw Outline
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     w     : width
  #     h     : height
  #     text  : text to display
  #     align : text alignment
  #---------------------------------------------------
  def draw_outline(x, y, w, h, text, align = 0)
    origC = self.contents.font.color.clone
    bgC = Color.new(255, 255, 255, origC.alpha)
    self.contents.font.color = bgC
    self.contents.draw_text(x + 1, y + 1, w, h, text, align)
    self.contents.draw_text(x - 1, y + 1, w, h, text, align)
    self.contents.draw_text(x + 1, y - 1, w, h, text, align)
    self.contents.draw_text(x - 1, y - 1, w, h, text, align)
    self.contents.font.color = origC
    self.contents.draw_text(x, y, w, h, text, align)
  end
end
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.