Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0
Sign in to follow this  
Spence607

HP/SP Script Help

Question

Hey, I was just wondering if someone could help me make a script to show max HP and SP in battle. Something like this:

HP 1267/1500

SP 27/309

I would also like the numbers closer to HP and SP as shown, unlike the default. Any help would be much appreciated, since I know basically nothing of scripts.

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

You could, but it will off-center it some. Here's a crack at it:

 

class Window_Base 
 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)
# 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 - 8, 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 - 8, y, 12, 32, "/", 1)
  self.contents.draw_text(hp_x + 60 - 8, 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
self.contents.draw_text(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
self.contents.draw_text(sp_x - 8, 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 - 8, y, 12, 32, "/", 1)
  self.contents.draw_text(sp_x + 60 - 8, y, 48, 32, actor.maxsp.to_s)
end
 end
end

class Window_BattleStatus
 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_hp(actor, actor_x, 32, 150)
  draw_actor_sp(actor, actor_x, 64, 150)
  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

Share this post


Link to post
Share on other sites
  • 0
You could, but it will off-center it some. Here's a crack at it:

 

class Window_Base 
 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)
# 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 - 8, 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 - 8, y, 12, 32, "/", 1)
  self.contents.draw_text(hp_x + 60 - 8, 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
self.contents.draw_text(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
self.contents.draw_text(sp_x - 8, 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 - 8, y, 12, 32, "/", 1)
  self.contents.draw_text(sp_x + 60 - 8, y, 48, 32, actor.maxsp.to_s)
end
 end
end

class Window_BattleStatus
 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_hp(actor, actor_x, 32, 150)
  draw_actor_sp(actor, actor_x, 64, 150)
  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

 

Perfect, just what I wanted, thanks a lot man.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...