Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Showing Max HP

This sounds not too complicated to me, a bit silly even, but then again I know nothing of scripts, so yeah. It seems kind of basic, but whatever.

Basically, what I'd like, is that in battle it doesn't only show how much HP your character has left, but also how much his max HP is. This is something that disturbs me about some RPGs where you can only see in battle that they're still "in the green" for example, but it won't show the max HP. However, I'd like that it did.

Now before I start repeating myself too much, I'll stop talking. If anybody knows of such a script/has made one/can do one, that'd be greatly appreciated.
 
Bumpity-bumpity-bump-bump?

Just so it's clear, I'd like it to show something looking like
HP: 200/510
In case that wasn't as clear as it it now. It's not really required but I think it's just that little extra thing that I'd like and that would make battle easier (personally, that's what it does for me)
 
This didn't take very long. Hopefully it's what you're looking for. Since you didn't specify you were using any custom battle scripts, I made this to be compatible with the default system. It rewrites the refresh method in the Battle Status Window, but that's it. Shouldn't give you any bugs, but let me know if it does.

Code:
#----------------------------------------------------------------------------
# Battle Status Window Edit
#
# by Second_Crimson
# 11/8/2007
# Please Credit
#
#
# Purpose: Causes Max HP to always appear on the battle screen
#----------------------------------------------------------------------------

class Window_Base < Window

  #--------------------------------------------------------------------------
  # * Draw HP
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : draw spot width
  #--------------------------------------------------------------------------
  def draw_actor_bhp(actor, x, y, width = 144)
    # Draw "HP" text string
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
    # Draw HP
    self.contents.font.color = actor.hp == 0 ? knockout_color :
      actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
    self.contents.draw_text(x + 40, y, 48, 32, actor.hp.to_s, 2)
    # Draw MaxHP
      self.contents.font.color = normal_color
      self.contents.draw_text(x+88, y, 12, 32, "/", 1)
      self.contents.draw_text(x+100, y, 48, 32, actor.maxhp.to_s)
  end
  #--------------------------------------------------------------------------
  # * Draw SP
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : draw spot width
  #--------------------------------------------------------------------------

  def draw_actor_bsp(actor, x, y, width = 144)
    # Draw "SP" text string
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
    # Draw SP
    self.contents.font.color = actor.hp == 0 ? knockout_color :
      actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
    self.contents.draw_text(x + 40, y, 48, 32, actor.sp.to_s, 2)
    # Draw MaxHP
      self.contents.font.color = normal_color
      self.contents.draw_text(x+88, y, 12, 32, "/", 1)
      self.contents.draw_text(x+100, y, 48, 32, actor.maxsp.to_s)
  end
end

#================================
class Window_BattleStatus < Window_Base
  def refresh
      self.contents.clear
      @item_max = $game_party.actors.size
      for i in 0...$game_party.actors.size
        actor = $game_party.actors[i]
        actor_x = i * 160 + 4
        draw_actor_name(actor, actor_x, 0)
        draw_actor_bhp(actor, actor_x, 32, 120)
        draw_actor_bsp(actor, actor_x, 64, 120)
        if @level_up_flags[i]
          self.contents.font.color = normal_color
          self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
        else
          draw_actor_state(actor, actor_x, 96)
        end
      end
    end
  end
#End of Script
 
w00t, that's great, awesome. Pretty simple indeed, but it does the trick just like I wanted it to. Thankyou! I did forget to mention the systems I was using extra. It did delete the Cogwheel HP/SP bars now in battle - they're alright in the menu (placing of the script in the database is unimportant, I noticed.), but I'm guessing those would've made the screen a bit too crowded... I still liked them, so maybe you could take a quick look at that?
 
That should be simple enough. I just changed this so now the menu and the battle status screen write the Hp the same way. In other words, now draw_actor_hp and draw_actor_sp are overwritten, not refresh.

Replace my old script with this one:
Code:
#----------------------------------------------------------------------------
# Battle Status Window Edit (v1.01)
#
# by Second_Crimson
# 11/8/2007
# Please Credit
#
#
# Purpose: Causes Max HP to always appear on the battle screen
#----------------------------------------------------------------------------

class Window_Base < Window

  #--------------------------------------------------------------------------
  # * 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
    self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
    # Draw HP
    self.contents.font.color = actor.hp == 0 ? knockout_color :
      actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
    self.contents.draw_text(x + 40, y, 48, 32, actor.hp.to_s, 2)
    # Draw MaxHP
      self.contents.font.color = normal_color
      self.contents.draw_text(x+88, y, 12, 32, "/", 1)
      self.contents.draw_text(x+100, y, 48, 32, actor.maxhp.to_s)
  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
    self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
    # Draw SP
    self.contents.font.color = actor.hp == 0 ? knockout_color :
      actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
    self.contents.draw_text(x + 40, y, 48, 32, actor.sp.to_s, 2)
    # Draw MaxHP
      self.contents.font.color = normal_color
      self.contents.draw_text(x+88, y, 12, 32, "/", 1)
      self.contents.draw_text(x+100, y, 48, 32, actor.maxsp.to_s)
  end
end
 
i dont mean to be rude...but..
u screwed up my game..!
don kno wats wrong with it but it givs me this syntax error and it has a problem with a section that u didn't even edit..so..
thanks!!
 
eskuppe;315025":1rialbyd said:
i dont mean to be rude...but..
u screwed up my game..!
don kno wats wrong with it but it givs me this syntax error and it has a problem with a section that u didn't even edit..so..
thanks!!

second_crimson didn't screw up your game, but instead, took time our of their life to help you. And is spelling so damn hard? How much harder is it to type it out? This is what your post should have said

I hate to ask for further assistance, but I have ran into some trouble with this. When I run the game now, I get this syntax error: <insert the syntax error as it EXACTLY appears in the error window>. This is the code where the error occurred, and the error line is <insert the exact code line>

Code:
<insert entire code section>

Can you or anyone else help me? Thanks in advanced.

I don't want to hear you can't do that, because I just did and I am not even the one asking for help. Learn how to ask for help, or don't expect to receive any. :mad:
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top