Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
BitAngel91

Enemy Name HP and SP Bar Script HELP!!!

Recommended Posts

Hello everyone, I would like to request a custom script for Enemy Name HP and SP bar Script. I've try serveral add ons from serveral scripts but they all have script errors. I'm not a script / programmar, but I at least know how to mess around and tweak up a script. Seems thats the best I can do on my own. But I can't seem to get a working Enemy HP bar display.

 

Im using a custom battle script called "Real time active battle (RTAB) Ver 1.16" Im using this Script for HP/SP for my Party but it doesnt work for the enemy Party. I would like to request if its possible to make it so the enemys HP and SP will show on the battle screen with there name ethier under the enemys Battler or on the left side of the screen. Please let me know If you need more details or a whole complete copy of my game. I will be upload and send you the link if that will help.

 

Draw Slant Bar(by SephirothSpawn)

 

class Window_Base < Window
 alias raz_bars_base_exp draw_actor_exp
 alias raz_bars_base_parameter draw_actor_parameter
 #--------------------------------------------------------------------------
 # * Draw Slant Bar(by SephirothSpawn)
 #--------------------------------------------------------------------------
 def draw_slant_bar(x, y, min, max, width = 152, height = 6,
  bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
# Draw Border
for i in 0..height
  self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
end
# Draw Background
for i in 1..(height - 1)
  r = 100 * (height - i) / height + 0 * i / height
  g = 100 * (height - i) / height + 0 * i / height
  b = 100 * (height - i) / height + 0 * i / height
  a = 255 * (height - i) / height + 255 * i / height
  self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
end
# Draws Bar
for i in 1..( (min / max.to_f) * width - 1)
  for j in 1..(height - 1)
	r = bar_color.red * (width - i) / width + end_color.red * i / width
	g = bar_color.green * (width - i) / width + end_color.green * i / width
	b = bar_color.blue * (width - i) / width + end_color.blue * i / width
	a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
	self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
  end
end
 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)
# 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

if $game_temp.in_battle
  bar_width = hp_x - x + 50
  else
  bar_width = hp_x - x + 100
end
# Draw HP
draw_slant_bar(x, y + 18, actor.hp, actor.maxhp, bar_width, 6, bar_color = Color.new(100, 0, 0, 255), end_color = Color.new(255, 0, 0, 255))
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.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)
# 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

if $game_temp.in_battle
  bar_width = sp_x - x + 50
  else
  bar_width = sp_x - x + 100
end
# Draw SP
draw_slant_bar(x, y + 18, actor.sp, actor.maxsp, bar_width, 6, bar_color = Color.new(0, 0, 100, 255), end_color = Color.new(0, 0, 255, 255))
# Draw "SP" text string
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.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
 def draw_actor_exp(actor, x, y)
if actor.level == 99
draw_slant_bar(x, y + 18, 1, 1, 190, 6, bar_color = Color.new(0, 100, 0, 255), end_color = Color.new(0, 255, 0, 255))
  else
draw_slant_bar(x, y + 18, actor.now_exp, actor.next_exp, 190, 6, bar_color = Color.new(0, 100, 0, 255), end_color = Color.new(0, 255, 0, 255))
end
raz_bars_base_exp(actor, x, y)
 end
def draw_actor_parameter(actor, x, y, type)
case type
when 0
  para_color1 = Color.new(100,0,0)
  para_color2 = Color.new(255,0,0)
  para_begin = actor.atk
when 1
  para_color1 = Color.new(100,100,0)
  para_color2 = Color.new(255,255,0)
  para_begin = actor.pdef
when 2
  para_color1 = Color.new(100,0,100)
  para_color2 = Color.new(255,0,255)
  para_begin = actor.mdef
when 3
  para_color1 = Color.new(50,0,100)
  para_color2 = Color.new(50,0,255)
  para_begin = actor.str
when 4
  para_color1 = Color.new(0,100,0)
  para_color2 = Color.new(0,255,0)
  para_begin = actor.dex
when 5
  para_color1 = Color.new(50,0,50)
  para_color2 = Color.new(255,0,255)
  para_begin = actor.agi
when 6
  para_color1 = Color.new(0,100,100)
  para_color2 = Color.new(0,255,255)
  para_begin = actor.int
end
draw_slant_bar(x, y + 18, para_begin, 999, 155, 4, bar_color = para_color1, end_color = para_color2)
raz_bars_base_parameter(actor, x, y, type)
 end
end
class Game_Actor
 #--------------------------------------------------------------------------
 # * Get the current EXP
 #--------------------------------------------------------------------------
 def now_exp
return @exp - @exp_list[@level]
 end
 #--------------------------------------------------------------------------
 # * Get the next level's EXP
 #--------------------------------------------------------------------------
 def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
 end
end

Edited by BitAngel91

Share this post


Link to post
Share on other sites

Having a copy of the battle system you are using would be a good start. smile.png

 

Edit: its 2:00 here, and I'm too lazy to go and find a copy, sorry.

Edited by Foxkit

Share this post


Link to post
Share on other sites

Having a copy of the battle system you are using would be a good start. smile.png

 

Edit: its 2:00 here, and I'm too lazy to go and find a copy, sorry.

 

Alright here you go. This should do the trick. Download Here

Share this post


Link to post
Share on other sites

If anyone can Edit a script and post it here for the Enemy HP SP bars that will be great and of course I'll give you credit as well.

Share this post


Link to post
Share on other sites

These should work, just replace Window_BattleStatus with the script below, and Sephy's bar's with the second script down.... I'm not sure if they will work. If they don't work, I'll hollar for one of the more experienced to come and help smile.png Also, right now, if it does work, it should just show the enemy's health on the left side, with the SP just a little below the health, I didn't get the names printed, so I'm assuming it'll go by first monster in the troop. try it and tell me if it works.

#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
#  This window displays the status of all party members on the battle screen.
#==============================================================================
class Window_BattleStatus < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
super(0, 320, 640, 160)
self.contents = Bitmap.new(width - 32, height - 32)
@level_up_flags = [false, false, false, false]
refresh
 end
 #--------------------------------------------------------------------------
 # * Dispose
 #--------------------------------------------------------------------------
 def dispose
super
 end
 #--------------------------------------------------------------------------
 # * Set Level Up Flag
 #	 actor_index : actor index
 #--------------------------------------------------------------------------
 def level_up(actor_index)
@level_up_flags[actor_index] = true
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 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, 120)
  draw_actor_sp(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

 for i in 0...$game_troop.members.size
  enemy = $game_troop.enemies
  enemy_y = i * 120
  draw_enemy_hp(enemy, 5, enemy_y + 32, 120)
  draw_enemy_sp(enemy, 5, enemy_y + 64, 120)
 end
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
super
# Slightly lower opacity level during main phase
if $game_temp.battle_main_phase
  self.contents_opacity -= 4 if self.contents_opacity > 191
else
  self.contents_opacity += 4 if self.contents_opacity < 255
end
 end
end

 

class Window_Base < Window
 alias raz_bars_base_exp draw_actor_exp
 alias raz_bars_base_parameter draw_actor_parameter
 #--------------------------------------------------------------------------
 # * Draw Slant Bar(by SephirothSpawn)
 #--------------------------------------------------------------------------
 def draw_slant_bar(x, y, min, max, width = 152, height = 6,
	bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
	# Draw Border
	for i in 0..height
	  self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
	end
	# Draw Background
	for i in 1..(height - 1)
	  r = 100 * (height - i) / height + 0 * i / height
	  g = 100 * (height - i) / height + 0 * i / height
	  b = 100 * (height - i) / height + 0 * i / height
	  a = 255 * (height - i) / height + 255 * i / height
	  self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
	end
	# Draws Bar
	for i in 1..( (min / max.to_f) * width - 1)
	  for j in 1..(height - 1)
			r = bar_color.red * (width - i) / width + end_color.red * i / width
			g = bar_color.green * (width - i) / width + end_color.green * i / width
			b = bar_color.blue * (width - i) / width + end_color.blue * i / width
			a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
			self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
	  end
	end
 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)
	# 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

	if $game_temp.in_battle
	  bar_width = hp_x - x + 50
	  else
	  bar_width = hp_x - x + 100
	end
	# Draw HP
	draw_slant_bar(x, y + 18, actor.hp, actor.maxhp, bar_width, 6, bar_color = Color.new(100, 0, 0, 255), end_color = Color.new(255, 0, 0, 255))
	self.contents.font.color = system_color
	self.contents.draw_text(x, y, 32, 32, $data_system.words.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)
	# 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

	if $game_temp.in_battle
	  bar_width = sp_x - x + 50
	  else
	  bar_width = sp_x - x + 100
	end
	# Draw SP
	draw_slant_bar(x, y + 18, actor.sp, actor.maxsp, bar_width, 6, bar_color = Color.new(0, 0, 100, 255), end_color = Color.new(0, 0, 255, 255))
	# Draw "SP" text string
	self.contents.font.color = system_color
	self.contents.draw_text(x, y, 32, 32, $data_system.words.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
 def draw_actor_exp(actor, x, y)
	if actor.level == 99
	draw_slant_bar(x, y + 18, 1, 1, 190, 6, bar_color = Color.new(0, 100, 0, 255), end_color = Color.new(0, 255, 0, 255))
	  else
	draw_slant_bar(x, y + 18, actor.now_exp, actor.next_exp, 190, 6, bar_color = Color.new(0, 100, 0, 255), end_color = Color.new(0, 255, 0, 255))
	end
	raz_bars_base_exp(actor, x, y)
 end
	def draw_actor_parameter(actor, x, y, type)
		case type
	when 0
	  para_color1 = Color.new(100,0,0)
	  para_color2 = Color.new(255,0,0)
	  para_begin = actor.atk
	when 1
	  para_color1 = Color.new(100,100,0)
	  para_color2 = Color.new(255,255,0)
	  para_begin = actor.pdef
	when 2
	  para_color1 = Color.new(100,0,100)
	  para_color2 = Color.new(255,0,255)
	  para_begin = actor.mdef
	when 3
	  para_color1 = Color.new(50,0,100)
	  para_color2 = Color.new(50,0,255)
	  para_begin = actor.str
	when 4
	  para_color1 = Color.new(0,100,0)
	  para_color2 = Color.new(0,255,0)
	  para_begin = actor.dex
	when 5
	  para_color1 = Color.new(50,0,50)
	  para_color2 = Color.new(255,0,255)
	  para_begin = actor.agi
	when 6
	  para_color1 = Color.new(0,100,100)
	  para_color2 = Color.new(0,255,255)
	  para_begin = actor.int
	end
	draw_slant_bar(x, y + 18, para_begin, 999, 155, 4, bar_color = para_color1, end_color = para_color2)
	raz_bars_base_parameter(actor, x, y, type)
 end

def draw_enemy_hp(enemy, x, y, width = 144)
	# 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

	if $game_temp.in_battle
  bar_width = hp_x - x + 50
else
  bar_width = hp_x - x + 100
end
# Draw HP
draw_slant_bar(x, y + 18, enemy.hp, enemy.maxhp, bar_width, 6, bar_color = Color.new(100, 0, 0, 255), end_color = Color.new(255, 0, 0, 255))
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
self.contents.font.color = enemy.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x, y, 48, 32, enemy.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, enemy.maxhp.to_s)
end
end

def draw_enemy_sp(enemy, x, y, width = 144)
	# 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

	if $game_temp.in_battle
	  bar_width = sp_x - x + 50
	  else
	  bar_width = sp_x - x + 100
	end
	# Draw SP
	draw_slant_bar(x, y + 18, enemy.sp, enemy.maxsp, bar_width, 6, bar_color = Color.new(0, 0, 100, 255), end_color = Color.new(0, 0, 255, 255))
	# Draw "SP" text string
	self.contents.font.color = system_color
	self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
	self.contents.font.color = enemy.sp == 0 ? knockout_color :
	  actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
	self.contents.draw_text(sp_x, y, 48, 32, enemy.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, enemy.maxsp.to_s)
	end
 end
end
class Game_Actor
 #--------------------------------------------------------------------------
 # * Get the current EXP
 #--------------------------------------------------------------------------
 def now_exp
	return @exp - @exp_list[@level]
 end
 #--------------------------------------------------------------------------
 # * Get the next level's EXP
 #--------------------------------------------------------------------------
 def next_exp
	return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
 end
end

Share this post


Link to post
Share on other sites

These should work, just replace Window_BattleStatus with the script below, and Sephy's bar's with the second script down.... I'm not sure if they will work. If they don't work, I'll hollar for one of the more experienced to come and help smile.png Also, right now, if it does work, it should just show the enemy's health on the left side, with the SP just a little below the health, I didn't get the names printed, so I'm assuming it'll go by first monster in the troop. try it and tell me if it works.

#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
#  This window displays the status of all party members on the battle screen.
#==============================================================================
class Window_BattleStatus < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
super(0, 320, 640, 160)
self.contents = Bitmap.new(width - 32, height - 32)
@level_up_flags = [false, false, false, false]
refresh
 end
 #--------------------------------------------------------------------------
 # * Dispose
 #--------------------------------------------------------------------------
 def dispose
super
 end
 #--------------------------------------------------------------------------
 # * Set Level Up Flag
 #	 actor_index : actor index
 #--------------------------------------------------------------------------
 def level_up(actor_index)
@level_up_flags[actor_index] = true
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 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, 120)
  draw_actor_sp(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

 for i in 0...$game_troop.members.size
  enemy = $game_troop.enemies
  enemy_y = i * 120
  draw_enemy_hp(enemy, 5, enemy_y + 32, 120)
  draw_enemy_sp(enemy, 5, enemy_y + 64, 120)
 end
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
super
# Slightly lower opacity level during main phase
if $game_temp.battle_main_phase
  self.contents_opacity -= 4 if self.contents_opacity > 191
else
  self.contents_opacity += 4 if self.contents_opacity < 255
end
 end
end

 

class Window_Base < Window
 alias raz_bars_base_exp draw_actor_exp
 alias raz_bars_base_parameter draw_actor_parameter
 #--------------------------------------------------------------------------
 # * Draw Slant Bar(by SephirothSpawn)
 #--------------------------------------------------------------------------
 def draw_slant_bar(x, y, min, max, width = 152, height = 6,
	bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
	# Draw Border
	for i in 0..height
	  self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
	end
	# Draw Background
	for i in 1..(height - 1)
	  r = 100 * (height - i) / height + 0 * i / height
	  g = 100 * (height - i) / height + 0 * i / height
	  b = 100 * (height - i) / height + 0 * i / height
	  a = 255 * (height - i) / height + 255 * i / height
	  self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
	end
	# Draws Bar
	for i in 1..( (min / max.to_f) * width - 1)
	  for j in 1..(height - 1)
			r = bar_color.red * (width - i) / width + end_color.red * i / width
			g = bar_color.green * (width - i) / width + end_color.green * i / width
			b = bar_color.blue * (width - i) / width + end_color.blue * i / width
			a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
			self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
	  end
	end
 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)
	# 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

	if $game_temp.in_battle
	  bar_width = hp_x - x + 50
	  else
	  bar_width = hp_x - x + 100
	end
	# Draw HP
	draw_slant_bar(x, y + 18, actor.hp, actor.maxhp, bar_width, 6, bar_color = Color.new(100, 0, 0, 255), end_color = Color.new(255, 0, 0, 255))
	self.contents.font.color = system_color
	self.contents.draw_text(x, y, 32, 32, $data_system.words.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)
	# 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

	if $game_temp.in_battle
	  bar_width = sp_x - x + 50
	  else
	  bar_width = sp_x - x + 100
	end
	# Draw SP
	draw_slant_bar(x, y + 18, actor.sp, actor.maxsp, bar_width, 6, bar_color = Color.new(0, 0, 100, 255), end_color = Color.new(0, 0, 255, 255))
	# Draw "SP" text string
	self.contents.font.color = system_color
	self.contents.draw_text(x, y, 32, 32, $data_system.words.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
 def draw_actor_exp(actor, x, y)
	if actor.level == 99
	draw_slant_bar(x, y + 18, 1, 1, 190, 6, bar_color = Color.new(0, 100, 0, 255), end_color = Color.new(0, 255, 0, 255))
	  else
	draw_slant_bar(x, y + 18, actor.now_exp, actor.next_exp, 190, 6, bar_color = Color.new(0, 100, 0, 255), end_color = Color.new(0, 255, 0, 255))
	end
	raz_bars_base_exp(actor, x, y)
 end
	def draw_actor_parameter(actor, x, y, type)
		case type
	when 0
	  para_color1 = Color.new(100,0,0)
	  para_color2 = Color.new(255,0,0)
	  para_begin = actor.atk
	when 1
	  para_color1 = Color.new(100,100,0)
	  para_color2 = Color.new(255,255,0)
	  para_begin = actor.pdef
	when 2
	  para_color1 = Color.new(100,0,100)
	  para_color2 = Color.new(255,0,255)
	  para_begin = actor.mdef
	when 3
	  para_color1 = Color.new(50,0,100)
	  para_color2 = Color.new(50,0,255)
	  para_begin = actor.str
	when 4
	  para_color1 = Color.new(0,100,0)
	  para_color2 = Color.new(0,255,0)
	  para_begin = actor.dex
	when 5
	  para_color1 = Color.new(50,0,50)
	  para_color2 = Color.new(255,0,255)
	  para_begin = actor.agi
	when 6
	  para_color1 = Color.new(0,100,100)
	  para_color2 = Color.new(0,255,255)
	  para_begin = actor.int
	end
	draw_slant_bar(x, y + 18, para_begin, 999, 155, 4, bar_color = para_color1, end_color = para_color2)
	raz_bars_base_parameter(actor, x, y, type)
 end

def draw_enemy_hp(enemy, x, y, width = 144)
	# 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

	if $game_temp.in_battle
  bar_width = hp_x - x + 50
else
  bar_width = hp_x - x + 100
end
# Draw HP
draw_slant_bar(x, y + 18, enemy.hp, enemy.maxhp, bar_width, 6, bar_color = Color.new(100, 0, 0, 255), end_color = Color.new(255, 0, 0, 255))
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
self.contents.font.color = enemy.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x, y, 48, 32, enemy.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, enemy.maxhp.to_s)
end
end

def draw_enemy_sp(enemy, x, y, width = 144)
	# 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

	if $game_temp.in_battle
	  bar_width = sp_x - x + 50
	  else
	  bar_width = sp_x - x + 100
	end
	# Draw SP
	draw_slant_bar(x, y + 18, enemy.sp, enemy.maxsp, bar_width, 6, bar_color = Color.new(0, 0, 100, 255), end_color = Color.new(0, 0, 255, 255))
	# Draw "SP" text string
	self.contents.font.color = system_color
	self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
	self.contents.font.color = enemy.sp == 0 ? knockout_color :
	  actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
	self.contents.draw_text(sp_x, y, 48, 32, enemy.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, enemy.maxsp.to_s)
	end
 end
end
class Game_Actor
 #--------------------------------------------------------------------------
 # * Get the current EXP
 #--------------------------------------------------------------------------
 def now_exp
	return @exp - @exp_list[@level]
 end
 #--------------------------------------------------------------------------
 # * Get the next level's EXP
 #--------------------------------------------------------------------------
 def next_exp
	return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
 end
end

 

It didn't work, I didn't get any errors until the end of a battle saying "Script is Hanging" Also there were no changes in battle. No visible Names, HP or SP bars for the enemy's. Not sure why this battle system doesn't like to show enemy's Heath and SP Lol.

Share this post


Link to post
Share on other sites

sorry it didn't work. I'm not very advanced so at this point I think it's beyond my expertise. Look for a member called Kellessde, and send him a pm about your problem, he should be able to give you some help.

 

Edit1: it may take some time for him to reply, he's not always the most active person on the forums.

Edited by Foxkit

Share this post


Link to post
Share on other sites

I was hoping someone would have posted something or a link to a working script but nothing apperently, I manage to get the HP Bars and SP to show for the enemy, but only on the first turn. Actully while switching to a different enemy during battle, the HP and SP bars seem to show. just as soon as you get to a single enemy. That seems to stop working. HP and SP bars disappear. Which again I can work without but maybe it might annoy players. If Anyone can give me a hand. I'd really appriciat it

Share this post


Link to post
Share on other sites

battle systems are not my speciality but i whiped this up together:

class Spriteset_Battle
alias init_bars initialize
alias update_bars update
alias dispose_bars dispose
def initialize
@full_hps = []
@full_sps = []
@last_hps = []
@last_sps = []
(0...$game_troop.enemies.size).each {|i|
@full_hps.push($game_troop.enemies[i].hp)
@full_sps.push($game_troop.enemies[i].sp)
@last_hps.push(@full_hps[i] + 1)
@last_sps.push(@full_sps[i] + 1)
}
init_bars
end
def draw_bars
 @hpbars = []
 @spbars = []
 @last_hps = []
 @last_sps = []
(0...$game_troop.enemies.size).each {|i|
 enemy = $game_troop.enemies[i]
 @last_hps.push(enemy.hp)
 @last_sps.push(enemy.sp)
 @hpbars.push(Sprite.new)
 @hpbars[i].z = 100
 @hpbars[i].bitmap = Bitmap.new(640, 480)
 @spbars.push(Sprite.new)
 @spbars[i].z = 100
 @spbars[i].bitmap = Bitmap.new(640, 480)
 #draw hp
 rect = Rect.new(enemy.screen_x - 25, enemy.screen_y, 52, 6)
 @hpbars[i].bitmap.fill_rect(rect, Color.new(0, 0, 0))
 one_hp_block = @full_hps[i] / 50
 current_hp = enemy.hp
 get_hp = current_hp / one_hp_block
 rect = Rect.new(enemy.screen_x - 24, enemy.screen_y + 1, get_hp, 4)
 @hpbars[i].bitmap.fill_rect(rect, Color.new(255, 0, 0))
 #draw sp
 rect = Rect.new(enemy.screen_x - 25, enemy.screen_y + 7, 52, 6)
 @spbars[i].bitmap.fill_rect(rect, Color.new(0, 0, 0))
 one_sp_block = @full_sps[i] / 50
 current_sp = enemy.sp
 get_sp = current_sp / one_sp_block
 rect = Rect.new(enemy.screen_x - 24, enemy.screen_y + 8, get_sp, 4)
 @spbars[i].bitmap.fill_rect(rect, Color.new(0, 0, 255))
 }
end
def update
(0...$game_troop.enemies.size).each {|i|
 enemy = $game_troop.enemies[i]
 draw_bars if enemy.hp != @last_hps[i] && @enemy_sprites[i].battler_visible
}
update_bars
end
def dispose
@hpbars = nil
@spbars = nil
dispose_bars
end
end
class Sprite_Battler
attr_reader :battler_visible
end

it should work fine below all other custom scripts, let me know if you have any errors, the bars are nothing flash but its better than nothing :)

Edited by diagostimo

Share this post


Link to post
Share on other sites

ok, a some testing of the script i posted last i found a fair few bugs, this is a revised version:

class Sprite_Battler < RPG::Sprite
alias init_bars initialize
alias update_bars_update update
def initialize(viewport, battler = nil)
init_bars(viewport, battler)
if @battler.is_a?(Game_Enemy)
 @bars = false
end
end
def update
if @battler.is_a?(Game_Enemy)
 if @bars == false
 create_bars
 @bars = true
 else
 update_bars
 end
end
update_bars_update
end
def create_bars
#set full settings
@full_hp = @battler.hp
@full_sp = @battler.sp
#create bitmap
@bitmap_bars = Sprite.new
@bitmap_bars.opacity = 0
@bitmap_bars.x = @battler.screen_x - 26
@bitmap_bars.y = @battler.screen_y + 7
@bitmap_bars.z = 50
@bitmap_bars.bitmap = Bitmap.new(54, 15)
#shell
rect = Rect.new(0, 0, 54, 15)
@bitmap_bars.bitmap.fill_rect(rect, Color.new(0, 0, 0))
rect = Rect.new(1, 1, 52, 6)
@bitmap_bars.bitmap.fill_rect(rect, Color.new(255, 255, 255))
rect = Rect.new(1, 8, 52, 6)
@bitmap_bars.bitmap.fill_rect(rect, Color.new(255, 255, 255))
#draw hp
one_hp_block = @full_hp / 50
current_hp = @battler.hp
get_hp = current_hp / one_hp_block
rect = Rect.new(2, 2, get_hp, 4)
@bitmap_bars.bitmap.fill_rect(rect, Color.new(255, 0, 0))
#draw sp
one_sp_block = @full_sp / 50
current_sp = @battler.sp
get_sp = current_sp / one_sp_block
rect = Rect.new(2, 9, get_sp, 4)
@bitmap_bars.bitmap.fill_rect(rect, Color.new(0, 0, 255))
end
def all_dead?
$game_party.actors.each {|a| return false if a.hp > 0 }
return true
end
def update_bars
if @battler.hp == 0 or all_dead?
 @bars = nil
 #bars disposal
 @bitmap_bars.bitmap.dispose
 @bitmap_bars.dispose
 return
end
#hp
unless @bars == nil
 @bitmap_bars.bitmap.clear
 #shell
 @bitmap_bars.opacity = self.opacity if @bitmap_bars.opacity != self.opacity
 rect = Rect.new(0, 0, 54, 15)
 @bitmap_bars.bitmap.fill_rect(rect, Color.new(0, 0, 0))
 rect = Rect.new(1, 1, 52, 6)
 @bitmap_bars.bitmap.fill_rect(rect, Color.new(255, 255, 255))
 rect = Rect.new(1, 8, 52, 6)
 @bitmap_bars.bitmap.fill_rect(rect, Color.new(255, 255, 255))
 #draw hp
 one_hp_block = @full_hp / 50
 current_hp = @battler.hp
 get_hp = current_hp / one_hp_block
 rect = Rect.new(2, 2, get_hp, 4)
 @bitmap_bars.bitmap.fill_rect(rect, Color.new(255, 0, 0))
 #draw sp
 one_sp_block = @full_sp / 50
 current_sp = @battler.sp
 get_sp = current_sp / one_sp_block
 rect = Rect.new(2, 9, get_sp, 4)
 @bitmap_bars.bitmap.fill_rect(rect, Color.new(0, 0, 255))
end
end
end

i went a differnt way on implementing the code and this should be a lot more compatible as well as not buggy, this will actually most probably work with most custom battle systems, enjoy :D

Edited by diagostimo

Share this post


Link to post
Share on other sites

I dont have time to do this right now, but I took a crack at rewriting a Battle System that sort of includes what you want.

 

http://www.775.net/~heretic/downloads/rmxp/XRXS/index.php

 

The Battle System includes stuff to show HP Bars for the Actors when you are selecting them. You can probably do this yourself without too much difficulty by duplicating def set_actor to def set_enemy and replacing the obvious (actor with enemy). The commenting should help you out.

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...