http://img103.imageshack.us/img103/865/windowcurrentam7.png[/IMG]
http://img469.imageshack.us/img469/7963/windomockuppq8.png[/IMG]
As you can see, the current script I'm using is shrinking and skewing my text. The damage display and the command window look perfect, but the HP and SP are yucky.
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# â— Initialize
#--------------------------------------------------------------------------
def initialize
super(0, 320, 480, 180)
self.opacity = 0
@windows = []
@faces = []
viewport = Viewport.new(3, 302, 640, 180)
viewport.z = 101
for i in 0...$game_party.actors.size
y = i * 60 + (4 - $game_party.actors.size) #- 15 #* 60
@windows = Window_ActorStatus.new(i, i * 60 + 300)
@faces = Sprite.new(viewport)
@faces.bitmap = RPG::Cache.picture("Face" + $game_party.actors.id.to_s + ".png")
@faces.y = y
end
@level_up_flags = [false, false, false, false]
refresh
end
#--------------------------------------------------------------------------
# â— Update
#--------------------------------------------------------------------------
def update
super
for window in @windows
window.update
end
end
#--------------------------------------------------------------------------
# â— Dispose
#--------------------------------------------------------------------------
def dispose
for i in 0...$game_party.actors.size
@windows.dispose
@faces.dispose
end
super
end
#--------------------------------------------------------------------------
# â— Refresh
#--------------------------------------------------------------------------
def refresh(number = 0)
if number == 0
count = 0
for window in @windows
window.refresh(@level_up_flags[count])
count += 1
end
else
@windows[number - 1].refresh(@level_up_flags[number - 1])
end
end
#--------------------------------------------------------------------------
# â— AT Refresh
#--------------------------------------------------------------------------
def at_refresh(number = 0)
if number == 0
for window in @windows
window.at_refresh
end
else
@windows[number - 1].at_refresh
end
end
end
#==============================================================================
# â– Window_ActorStatus
#==============================================================================
class Window_ActorStatus < Window_Base
#--------------------------------------------------------------------------
# â— Initialize
#--------------------------------------------------------------------------
#def initialize(id, x)
# @id = id
# super(x, 320, 160, 160)
# self.contents = Bitmap.new(width - 32, height - 32)
# self.back_opacity = 255
# actor = $game_party.actors[@id]
# @name = actor.name
# @maxhp = actor.maxhp
# @maxsp = actor.maxsp
# @hp = actor.hp
# @sp = actor.sp
# @state = make_battler_state_text(actor, 120, true)
# @windows = []
# for i in 0...5
# @windows.push(Window_DetailsStatus.new(actor, i, x))
# end
# refresh(false)
#end
def initialize(id, y)
@id = id
super(0, y, 480, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 255
actor = $game_party.actors[@id]
@name = actor.name
@maxhp = actor.maxhp
@maxsp = actor.maxsp
@hp = actor.hp
@sp = actor.sp
@state = make_battler_state_text(actor, 120, true)
@windows = []
for i in 0...5
@windows.push(Window_DetailsStatus.new(actor, i, x, y))
end
refresh(false)
end
#--------------------------------------------------------------------------
# â— Update
#--------------------------------------------------------------------------
def update
for window in @windows
window.update
end
end
#--------------------------------------------------------------------------
# â— Dispose
#--------------------------------------------------------------------------
def dispose
for window in @windows
window.dispose
end
super
end
#--------------------------------------------------------------------------
# â— Refresh
#--------------------------------------------------------------------------
def refresh(level_up_flags)
self.contents.clear
actor = $game_party.actors[@id]
@windows[0].refresh(actor) if @name != actor.name
@windows[1].refresh(actor) if @maxhp != actor.maxhp or @hp != actor.hp
@windows[2].refresh(actor) if @maxsp != actor.maxsp or @sp != actor.sp
@windows[3].refresh(actor, level_up_flags) if
(@state != make_battler_state_text(actor, 120, true) or level_up_flags)
@name = actor.name
@maxhp = actor.maxhp
@maxsp = actor.maxsp
@hp = actor.hp
@sp = actor.sp
@state = make_battler_state_text(actor, 120, true)
end
#--------------------------------------------------------------------------
# â— AT Refresh
#--------------------------------------------------------------------------
def at_refresh
@windows[4].refresh($game_party.actors[@id])
end
end
#==============================================================================
# â– Window_DetailsStatus
#==============================================================================
class Window_DetailsStatus < Window_Base
#--------------------------------------------------------------------------
# â— Initialize
#--------------------------------------------------------------------------
#def initialize(actor, id, x)
# @status_id = id
# super(x, 320 + id * 26, 160, 64)
# self.contents = Bitmap.new(width - 32, height - 32)
# #self.contents.font.name = $fontface
# #self.contents.font.size = $fontsize
# self.opacity = 0
# self.back_opacity = 0
# refresh(actor, false)
#end
def initialize(actor, id, x, y)
@status_id = id
super(x, y, 480, 60)
self.contents = Bitmap.new(width - 32, height - 32)
#self.contents.font.name = $fontface
#self.contents.font.size = $fontsize
self.opacity = 0
self.back_opacity = 0
refresh(actor, false)
end
#--------------------------------------------------------------------------
# â— Refresh
#--------------------------------------------------------------------------
def refresh(actor, level_up_flags = false)
self.contents.clear
case @status_id
when 0
draw_actor_name(actor, 0, -10)
when 1
#self.contents.font.size = 40
#self.contents.font.bold = true
draw_actor_hp(actor, 150, -8, 120)
when 2
draw_actor_sp(actor, 300, 0, 120)
when 3
if level_up_flags
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120, 32, "LEVEL UP!")
else
#draw_actor_state(actor, 4, 0)
end
when 4
draw_actor_atg(actor, 150, 7, 120)
end
end
end
#==============================================================================
# â– Window_Base
#==============================================================================
class Window_Base
#--------------------------------------------------------------------------
# â— Draw Actor HP Meter
#--------------------------------------------------------------------------
alias cbs_draw_actor_hp draw_actor_hp
def draw_actor_hp(actor, x, y, width = 146, height = 5)
bg = Color.new( 0, 0, 0, 160)
c1 = Color.new(175, 0, 0, 160)
c2 = Color.new(255, 0, 0, 255)
self.contents.fill_rect(x, y, width, height, bg)
width2 = width * actor.hp / actor.maxhp
gradient(x + 1, y + 1, width2 - 2, height - 2, c1, c2)
cbs_draw_actor_hp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# â— Draw Actor SP Meter
#--------------------------------------------------------------------------
alias cbs_draw_actor_sp draw_actor_sp
def draw_actor_sp(actor, x, y, width = 146, height = 5)
bg = Color.new( 0, 0, 0, 160)
c1 = Color.new( 0, 175, 0, 160)
c2 = Color.new( 0, 255, 0, 255)
self.contents.fill_rect(x, y, width, height, bg)
width2 = width * actor.sp / actor.maxsp
gradient(x + 1, y + 1, width2 - 2, height - 2, c1, c2)
cbs_draw_actor_sp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# â— Draw Gradient
#--------------------------------------------------------------------------
def gradient(x, y, width, height, c1, c2)
for i in 1..width
x2 = x + i - 1
r = c1.red * (width - i) / width + c2.red * i / width
g = c1.green * (width - i) / width + c2.green * i / width
b = c1.blue * (width - i) / width + c2.blue * i / width
a = c1.alpha * (width - i) / width + c2.alpha * i / width
self.contents.fill_rect(x2, y, 1, height, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# â— Make State Text
#--------------------------------------------------------------------------
def make_battler_state_text(battler, width, need_normal)
brackets_width = self.contents.text_size("Status: ").width
text = ""
for i in battler.states
if $data_states.rating >= 1
if text == ""
text = $data_states.name
else
new_text = text + "/" + $data_states.name
text_width = self.contents.text_size(new_text).width
if text_width > width - brackets_width
break
end
text = new_text
end
end
end
if text == ""
if need_normal
text = "Status: Normal"
end
else
text = "Status: " + text
end
return text
end
end
#--------------------------------------------------------------------------
# â— Initialize
#--------------------------------------------------------------------------
def initialize
super(0, 320, 480, 180)
self.opacity = 0
@windows = []
@faces = []
viewport = Viewport.new(3, 302, 640, 180)
viewport.z = 101
for i in 0...$game_party.actors.size
y = i * 60 + (4 - $game_party.actors.size) #- 15 #* 60
@windows = Window_ActorStatus.new(i, i * 60 + 300)
@faces = Sprite.new(viewport)
@faces.bitmap = RPG::Cache.picture("Face" + $game_party.actors.id.to_s + ".png")
@faces.y = y
end
@level_up_flags = [false, false, false, false]
refresh
end
#--------------------------------------------------------------------------
# â— Update
#--------------------------------------------------------------------------
def update
super
for window in @windows
window.update
end
end
#--------------------------------------------------------------------------
# â— Dispose
#--------------------------------------------------------------------------
def dispose
for i in 0...$game_party.actors.size
@windows.dispose
@faces.dispose
end
super
end
#--------------------------------------------------------------------------
# â— Refresh
#--------------------------------------------------------------------------
def refresh(number = 0)
if number == 0
count = 0
for window in @windows
window.refresh(@level_up_flags[count])
count += 1
end
else
@windows[number - 1].refresh(@level_up_flags[number - 1])
end
end
#--------------------------------------------------------------------------
# â— AT Refresh
#--------------------------------------------------------------------------
def at_refresh(number = 0)
if number == 0
for window in @windows
window.at_refresh
end
else
@windows[number - 1].at_refresh
end
end
end
#==============================================================================
# â– Window_ActorStatus
#==============================================================================
class Window_ActorStatus < Window_Base
#--------------------------------------------------------------------------
# â— Initialize
#--------------------------------------------------------------------------
#def initialize(id, x)
# @id = id
# super(x, 320, 160, 160)
# self.contents = Bitmap.new(width - 32, height - 32)
# self.back_opacity = 255
# actor = $game_party.actors[@id]
# @name = actor.name
# @maxhp = actor.maxhp
# @maxsp = actor.maxsp
# @hp = actor.hp
# @sp = actor.sp
# @state = make_battler_state_text(actor, 120, true)
# @windows = []
# for i in 0...5
# @windows.push(Window_DetailsStatus.new(actor, i, x))
# end
# refresh(false)
#end
def initialize(id, y)
@id = id
super(0, y, 480, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 255
actor = $game_party.actors[@id]
@name = actor.name
@maxhp = actor.maxhp
@maxsp = actor.maxsp
@hp = actor.hp
@sp = actor.sp
@state = make_battler_state_text(actor, 120, true)
@windows = []
for i in 0...5
@windows.push(Window_DetailsStatus.new(actor, i, x, y))
end
refresh(false)
end
#--------------------------------------------------------------------------
# â— Update
#--------------------------------------------------------------------------
def update
for window in @windows
window.update
end
end
#--------------------------------------------------------------------------
# â— Dispose
#--------------------------------------------------------------------------
def dispose
for window in @windows
window.dispose
end
super
end
#--------------------------------------------------------------------------
# â— Refresh
#--------------------------------------------------------------------------
def refresh(level_up_flags)
self.contents.clear
actor = $game_party.actors[@id]
@windows[0].refresh(actor) if @name != actor.name
@windows[1].refresh(actor) if @maxhp != actor.maxhp or @hp != actor.hp
@windows[2].refresh(actor) if @maxsp != actor.maxsp or @sp != actor.sp
@windows[3].refresh(actor, level_up_flags) if
(@state != make_battler_state_text(actor, 120, true) or level_up_flags)
@name = actor.name
@maxhp = actor.maxhp
@maxsp = actor.maxsp
@hp = actor.hp
@sp = actor.sp
@state = make_battler_state_text(actor, 120, true)
end
#--------------------------------------------------------------------------
# â— AT Refresh
#--------------------------------------------------------------------------
def at_refresh
@windows[4].refresh($game_party.actors[@id])
end
end
#==============================================================================
# â– Window_DetailsStatus
#==============================================================================
class Window_DetailsStatus < Window_Base
#--------------------------------------------------------------------------
# â— Initialize
#--------------------------------------------------------------------------
#def initialize(actor, id, x)
# @status_id = id
# super(x, 320 + id * 26, 160, 64)
# self.contents = Bitmap.new(width - 32, height - 32)
# #self.contents.font.name = $fontface
# #self.contents.font.size = $fontsize
# self.opacity = 0
# self.back_opacity = 0
# refresh(actor, false)
#end
def initialize(actor, id, x, y)
@status_id = id
super(x, y, 480, 60)
self.contents = Bitmap.new(width - 32, height - 32)
#self.contents.font.name = $fontface
#self.contents.font.size = $fontsize
self.opacity = 0
self.back_opacity = 0
refresh(actor, false)
end
#--------------------------------------------------------------------------
# â— Refresh
#--------------------------------------------------------------------------
def refresh(actor, level_up_flags = false)
self.contents.clear
case @status_id
when 0
draw_actor_name(actor, 0, -10)
when 1
#self.contents.font.size = 40
#self.contents.font.bold = true
draw_actor_hp(actor, 150, -8, 120)
when 2
draw_actor_sp(actor, 300, 0, 120)
when 3
if level_up_flags
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120, 32, "LEVEL UP!")
else
#draw_actor_state(actor, 4, 0)
end
when 4
draw_actor_atg(actor, 150, 7, 120)
end
end
end
#==============================================================================
# â– Window_Base
#==============================================================================
class Window_Base
#--------------------------------------------------------------------------
# â— Draw Actor HP Meter
#--------------------------------------------------------------------------
alias cbs_draw_actor_hp draw_actor_hp
def draw_actor_hp(actor, x, y, width = 146, height = 5)
bg = Color.new( 0, 0, 0, 160)
c1 = Color.new(175, 0, 0, 160)
c2 = Color.new(255, 0, 0, 255)
self.contents.fill_rect(x, y, width, height, bg)
width2 = width * actor.hp / actor.maxhp
gradient(x + 1, y + 1, width2 - 2, height - 2, c1, c2)
cbs_draw_actor_hp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# â— Draw Actor SP Meter
#--------------------------------------------------------------------------
alias cbs_draw_actor_sp draw_actor_sp
def draw_actor_sp(actor, x, y, width = 146, height = 5)
bg = Color.new( 0, 0, 0, 160)
c1 = Color.new( 0, 175, 0, 160)
c2 = Color.new( 0, 255, 0, 255)
self.contents.fill_rect(x, y, width, height, bg)
width2 = width * actor.sp / actor.maxsp
gradient(x + 1, y + 1, width2 - 2, height - 2, c1, c2)
cbs_draw_actor_sp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# â— Draw Gradient
#--------------------------------------------------------------------------
def gradient(x, y, width, height, c1, c2)
for i in 1..width
x2 = x + i - 1
r = c1.red * (width - i) / width + c2.red * i / width
g = c1.green * (width - i) / width + c2.green * i / width
b = c1.blue * (width - i) / width + c2.blue * i / width
a = c1.alpha * (width - i) / width + c2.alpha * i / width
self.contents.fill_rect(x2, y, 1, height, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# â— Make State Text
#--------------------------------------------------------------------------
def make_battler_state_text(battler, width, need_normal)
brackets_width = self.contents.text_size("Status: ").width
text = ""
for i in battler.states
if $data_states.rating >= 1
if text == ""
text = $data_states.name
else
new_text = text + "/" + $data_states.name
text_width = self.contents.text_size(new_text).width
if text_width > width - brackets_width
break
end
text = new_text
end
end
end
if text == ""
if need_normal
text = "Status: Normal"
end
else
text = "Status: " + text
end
return text
end
end
I'm pretty sure the problem lies here. I know for one thing that my text size is pretty huge...
Font.default_name = "BankGothic Md BT"
Font.default_size = 30
Inside of Main under begin.
Aside from the skewing, i'm having a heck of a time moving the statistics (name, SP, HP, etc...) without it getting cut off. You can already see that the names of the characters are being cropped.
Next, I cant seem to figure out how to get rid of the space between "HP" and the hp value.
Further, I need to be able to specify which characters' SP bars are displayed. Only a few characters need them, others I want them displayed pictorally, others need more than one bar, and others still I want the gauge to differ.
Finally, i'd like to know how to increase the size of the outline on the ATB/HP/SP bars.
If you can help at all, let me know!
Thanks,
-K
EDIT
http://img219.imageshack.us/img219/7866/windowcurrent2lw4.png[/IMG]
I have no problems setting up different stuff for each character, which is awesome. I have some troubles with separating the SP test with the SP bar. And for the pictoral display of bullets I can get them to show up, but only in the initialize. This means they will only be updated once at the beginning of battle. When I simply plugged it into that chararacters SP update spot (actor.id == 3), i get all sorts of errors.
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# â— Initialize
#--------------------------------------------------------------------------
def initialize
super(0, 320, 480, 180)
self.opacity = 0
@windows = []
@faces = []
@bullets = []
@ubullets = []
viewport = Viewport.new(3, 302, 640, 180)
viewport.z = 101
for i in 0...$data_actors[3].parameters[1,1]
@ubullets = Sprite.new(viewport)
@ubullets.bitmap = RPG::Cache.picture("ubullet.png")
@ubullets.x = i * 20 + 325
@ubullets.y = 133
@ubullets.z = 9999
@ubullets.opacity = 255
end
for i in 0...$game_actors[3].sp
@bullets = Sprite.new(viewport)
@bullets.bitmap = RPG::Cache.picture("sbullet.png")
@bullets.x = i * 20 + 325
@bullets.y = 133
@bullets.z = 10000
@bullets.opacity = 255
end
for i in 0...$game_party.actors.size
y = i * 60 + (4 - $game_party.actors.size) #- 15 #* 60
@windows = Window_ActorStatus.new(i, i * 60 + 300)
@faces = Sprite.new(viewport)
@faces.bitmap = RPG::Cache.picture("Face" + $game_party.actors.id.to_s + ".png")
@faces.y = y
@faces.opacity = 250
end
@level_up_flags = [false, false, false, false]
refresh
end
#--------------------------------------------------------------------------
# â— Update
#--------------------------------------------------------------------------
def update
super
for window in @windows
window.update
end
end
#--------------------------------------------------------------------------
# â— Dispose
#--------------------------------------------------------------------------
def dispose
for i in 0...$game_party.actors.size
@windows.dispose
@faces.dispose
end
for i in 0...$data_actors[3].parameters[1,1]
@ubullets.dispose
end
for i in 0...$game_actors[3].sp
@bullets.dispose
end
super
end
#--------------------------------------------------------------------------
# â— Refresh
#--------------------------------------------------------------------------
def refresh(number = 0)
if number == 0
count = 0
for window in @windows
window.refresh(@level_up_flags[count])
count += 1
end
else
@windows[number - 1].refresh(@level_up_flags[number - 1])
end
end
#--------------------------------------------------------------------------
# â— AT Refresh
#--------------------------------------------------------------------------
def at_refresh(number = 0)
if number == 0
for window in @windows
window.at_refresh
end
else
@windows[number - 1].at_refresh
end
end
end
#==============================================================================
# â– Window_ActorStatus
#==============================================================================
class Window_ActorStatus < Window_Base
#--------------------------------------------------------------------------
# â— Initialize
#--------------------------------------------------------------------------
#def initialize(id, x)
# @id = id
# super(x, 320, 160, 160)
# self.contents = Bitmap.new(width - 32, height - 32)
# self.back_opacity = 255
# actor = $game_party.actors[@id]
# @name = actor.name
# @maxhp = actor.maxhp
# @maxsp = actor.maxsp
# @hp = actor.hp
# @sp = actor.sp
# @state = make_battler_state_text(actor, 120, true)
# @windows = []
# for i in 0...5
# @windows.push(Window_DetailsStatus.new(actor, i, x))
# end
# refresh(false)
#end
def initialize(id, y)
@id = id
super(0, y, 480, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 255
actor = $game_party.actors[@id]
@name = actor.name
@maxhp = actor.maxhp
@maxsp = actor.maxsp
@hp = actor.hp
@sp = actor.sp
@state = make_battler_state_text(actor, 120, true)
@windows = []
for i in 0...5
@windows.push(Window_DetailsStatus.new(actor, i, x, y))
end
refresh(false)
end
#--------------------------------------------------------------------------
# â— Update
#--------------------------------------------------------------------------
def update
for window in @windows
window.update
end
end
#--------------------------------------------------------------------------
# â— Dispose
#--------------------------------------------------------------------------
def dispose
for window in @windows
window.dispose
end
super
end
#--------------------------------------------------------------------------
# â— Refresh
#--------------------------------------------------------------------------
def refresh(level_up_flags)
self.contents.clear
actor = $game_party.actors[@id]
@windows[0].refresh(actor) if @name != actor.name
@windows[1].refresh(actor) if @maxhp != actor.maxhp or @hp != actor.hp
@windows[2].refresh(actor) if @maxsp != actor.maxsp or @sp != actor.sp
@windows[3].refresh(actor, level_up_flags) if
(@state != make_battler_state_text(actor, 120, true) or level_up_flags)
@name = actor.name
@maxhp = actor.maxhp
@maxsp = actor.maxsp
@hp = actor.hp
@sp = actor.sp
@state = make_battler_state_text(actor, 120, true)
end
#--------------------------------------------------------------------------
# â— AT Refresh
#--------------------------------------------------------------------------
def at_refresh
@windows[4].refresh($game_party.actors[@id])
end
end
#==============================================================================
# â– Window_DetailsStatus
#==============================================================================
class Window_DetailsStatus < Window_Base
#--------------------------------------------------------------------------
# â— Initialize
#--------------------------------------------------------------------------
#def initialize(actor, id, x)
# @status_id = id
# super(x, 320 + id * 26, 160, 64)
# self.contents = Bitmap.new(width - 32, height - 32)
# #self.contents.font.name = $fontface
# #self.contents.font.size = $fontsize
# self.opacity = 0
# self.back_opacity = 0
# refresh(actor, false)
#end
def initialize(actor, id, x, y)
@status_id = id
super(x, y, 480, 60)
self.contents = Bitmap.new(width - 32, height - 32)
#self.contents.font.name = $fontface
#self.contents.font.size = $fontsize
self.opacity = 0
self.back_opacity = 0
refresh(actor, false)
end
#--------------------------------------------------------------------------
# â— Refresh
#--------------------------------------------------------------------------
def refresh(actor, level_up_flags = false)
self.contents.clear
case @status_id
when 0
draw_actor_name(actor, 0, -10)
when 1
#self.contents.font.size = 40
#self.contents.font.bold = true
draw_actor_hp(actor, 150, -8, 120)
when 2
if actor.id == 1
draw_actor_sp(actor, 294, 6, 150)
end
if actor.id == 2
armorz = $data_actors[actor.id].armor4_id
self.contents.font.color = normal_color
self.contents.font.size = 20
self.contents.draw_text(300, 0, 212, 32, $data_armors[armorz].name)
end
if actor.id == 3
end
when 3
if level_up_flags
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120, 32, "LEVEL UP!")
else
#draw_actor_state(actor, 4, 0)
end
when 4
draw_actor_atg(actor, 150, 7, 120)
end
end
end
#==============================================================================
# â– Window_Base
#==============================================================================
class Window_Base
#--------------------------------------------------------------------------
# â— Draw Actor HP Meter
#--------------------------------------------------------------------------
alias cbs_draw_actor_hp draw_actor_hp
def draw_actor_hp(actor, x, y, width = 146, height = 5)
bg = Color.new( 0, 0, 0, 160)
c1 = Color.new(175, 0, 0, 160)
c2 = Color.new(255, 0, 0, 255)
self.contents.fill_rect(x, y, width, height, bg)
width2 = width * actor.hp / actor.maxhp
gradient(x + 1, y + 1, width2 - 2, height - 2, c1, c2)
cbs_draw_actor_hp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# â— Draw Actor SP Meter
#--------------------------------------------------------------------------
alias cbs_draw_actor_sp draw_actor_sp
def draw_actor_sp(actor, x, y, width = 146, height = 15)
bg = Color.new( 0, 0, 0, 160)
c1 = Color.new( 0, 174, 225, 255)
c2 = Color.new( 255, 255, 255, 255)
self.contents.fill_rect(x, y, width, height, bg)
width2 = width * actor.sp / actor.maxsp
gradient(x + 1, y + 1, width2 - 2, height - 2, c1, c2)
cbs_draw_actor_sp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# â— Draw Gradient
#--------------------------------------------------------------------------
def gradient(x, y, width, height, c1, c2)
for i in 1..width
x2 = x + i - 1
r = c1.red * (width - i) / width + c2.red * i / width
g = c1.green * (width - i) / width + c2.green * i / width
b = c1.blue * (width - i) / width + c2.blue * i / width
a = c1.alpha * (width - i) / width + c2.alpha * i / width
self.contents.fill_rect(x2, y, 1, height, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# â— Make State Text
#--------------------------------------------------------------------------
def make_battler_state_text(battler, width, need_normal)
brackets_width = self.contents.text_size("Status: ").width
text = ""
for i in battler.states
if $data_states.rating >= 1
if text == ""
text = $data_states.name
else
new_text = text + "/" + $data_states.name
text_width = self.contents.text_size(new_text).width
if text_width > width - brackets_width
break
end
text = new_text
end
end
end
if text == ""
if need_normal
text = "Status: Normal"
end
else
text = "Status: " + text
end
return text
end
end
#--------------------------------------------------------------------------
# â— Initialize
#--------------------------------------------------------------------------
def initialize
super(0, 320, 480, 180)
self.opacity = 0
@windows = []
@faces = []
@bullets = []
@ubullets = []
viewport = Viewport.new(3, 302, 640, 180)
viewport.z = 101
for i in 0...$data_actors[3].parameters[1,1]
@ubullets = Sprite.new(viewport)
@ubullets.bitmap = RPG::Cache.picture("ubullet.png")
@ubullets.x = i * 20 + 325
@ubullets.y = 133
@ubullets.z = 9999
@ubullets.opacity = 255
end
for i in 0...$game_actors[3].sp
@bullets = Sprite.new(viewport)
@bullets.bitmap = RPG::Cache.picture("sbullet.png")
@bullets.x = i * 20 + 325
@bullets.y = 133
@bullets.z = 10000
@bullets.opacity = 255
end
for i in 0...$game_party.actors.size
y = i * 60 + (4 - $game_party.actors.size) #- 15 #* 60
@windows = Window_ActorStatus.new(i, i * 60 + 300)
@faces = Sprite.new(viewport)
@faces.bitmap = RPG::Cache.picture("Face" + $game_party.actors.id.to_s + ".png")
@faces.y = y
@faces.opacity = 250
end
@level_up_flags = [false, false, false, false]
refresh
end
#--------------------------------------------------------------------------
# â— Update
#--------------------------------------------------------------------------
def update
super
for window in @windows
window.update
end
end
#--------------------------------------------------------------------------
# â— Dispose
#--------------------------------------------------------------------------
def dispose
for i in 0...$game_party.actors.size
@windows.dispose
@faces.dispose
end
for i in 0...$data_actors[3].parameters[1,1]
@ubullets.dispose
end
for i in 0...$game_actors[3].sp
@bullets.dispose
end
super
end
#--------------------------------------------------------------------------
# â— Refresh
#--------------------------------------------------------------------------
def refresh(number = 0)
if number == 0
count = 0
for window in @windows
window.refresh(@level_up_flags[count])
count += 1
end
else
@windows[number - 1].refresh(@level_up_flags[number - 1])
end
end
#--------------------------------------------------------------------------
# â— AT Refresh
#--------------------------------------------------------------------------
def at_refresh(number = 0)
if number == 0
for window in @windows
window.at_refresh
end
else
@windows[number - 1].at_refresh
end
end
end
#==============================================================================
# â– Window_ActorStatus
#==============================================================================
class Window_ActorStatus < Window_Base
#--------------------------------------------------------------------------
# â— Initialize
#--------------------------------------------------------------------------
#def initialize(id, x)
# @id = id
# super(x, 320, 160, 160)
# self.contents = Bitmap.new(width - 32, height - 32)
# self.back_opacity = 255
# actor = $game_party.actors[@id]
# @name = actor.name
# @maxhp = actor.maxhp
# @maxsp = actor.maxsp
# @hp = actor.hp
# @sp = actor.sp
# @state = make_battler_state_text(actor, 120, true)
# @windows = []
# for i in 0...5
# @windows.push(Window_DetailsStatus.new(actor, i, x))
# end
# refresh(false)
#end
def initialize(id, y)
@id = id
super(0, y, 480, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 255
actor = $game_party.actors[@id]
@name = actor.name
@maxhp = actor.maxhp
@maxsp = actor.maxsp
@hp = actor.hp
@sp = actor.sp
@state = make_battler_state_text(actor, 120, true)
@windows = []
for i in 0...5
@windows.push(Window_DetailsStatus.new(actor, i, x, y))
end
refresh(false)
end
#--------------------------------------------------------------------------
# â— Update
#--------------------------------------------------------------------------
def update
for window in @windows
window.update
end
end
#--------------------------------------------------------------------------
# â— Dispose
#--------------------------------------------------------------------------
def dispose
for window in @windows
window.dispose
end
super
end
#--------------------------------------------------------------------------
# â— Refresh
#--------------------------------------------------------------------------
def refresh(level_up_flags)
self.contents.clear
actor = $game_party.actors[@id]
@windows[0].refresh(actor) if @name != actor.name
@windows[1].refresh(actor) if @maxhp != actor.maxhp or @hp != actor.hp
@windows[2].refresh(actor) if @maxsp != actor.maxsp or @sp != actor.sp
@windows[3].refresh(actor, level_up_flags) if
(@state != make_battler_state_text(actor, 120, true) or level_up_flags)
@name = actor.name
@maxhp = actor.maxhp
@maxsp = actor.maxsp
@hp = actor.hp
@sp = actor.sp
@state = make_battler_state_text(actor, 120, true)
end
#--------------------------------------------------------------------------
# â— AT Refresh
#--------------------------------------------------------------------------
def at_refresh
@windows[4].refresh($game_party.actors[@id])
end
end
#==============================================================================
# â– Window_DetailsStatus
#==============================================================================
class Window_DetailsStatus < Window_Base
#--------------------------------------------------------------------------
# â— Initialize
#--------------------------------------------------------------------------
#def initialize(actor, id, x)
# @status_id = id
# super(x, 320 + id * 26, 160, 64)
# self.contents = Bitmap.new(width - 32, height - 32)
# #self.contents.font.name = $fontface
# #self.contents.font.size = $fontsize
# self.opacity = 0
# self.back_opacity = 0
# refresh(actor, false)
#end
def initialize(actor, id, x, y)
@status_id = id
super(x, y, 480, 60)
self.contents = Bitmap.new(width - 32, height - 32)
#self.contents.font.name = $fontface
#self.contents.font.size = $fontsize
self.opacity = 0
self.back_opacity = 0
refresh(actor, false)
end
#--------------------------------------------------------------------------
# â— Refresh
#--------------------------------------------------------------------------
def refresh(actor, level_up_flags = false)
self.contents.clear
case @status_id
when 0
draw_actor_name(actor, 0, -10)
when 1
#self.contents.font.size = 40
#self.contents.font.bold = true
draw_actor_hp(actor, 150, -8, 120)
when 2
if actor.id == 1
draw_actor_sp(actor, 294, 6, 150)
end
if actor.id == 2
armorz = $data_actors[actor.id].armor4_id
self.contents.font.color = normal_color
self.contents.font.size = 20
self.contents.draw_text(300, 0, 212, 32, $data_armors[armorz].name)
end
if actor.id == 3
end
when 3
if level_up_flags
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120, 32, "LEVEL UP!")
else
#draw_actor_state(actor, 4, 0)
end
when 4
draw_actor_atg(actor, 150, 7, 120)
end
end
end
#==============================================================================
# â– Window_Base
#==============================================================================
class Window_Base
#--------------------------------------------------------------------------
# â— Draw Actor HP Meter
#--------------------------------------------------------------------------
alias cbs_draw_actor_hp draw_actor_hp
def draw_actor_hp(actor, x, y, width = 146, height = 5)
bg = Color.new( 0, 0, 0, 160)
c1 = Color.new(175, 0, 0, 160)
c2 = Color.new(255, 0, 0, 255)
self.contents.fill_rect(x, y, width, height, bg)
width2 = width * actor.hp / actor.maxhp
gradient(x + 1, y + 1, width2 - 2, height - 2, c1, c2)
cbs_draw_actor_hp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# â— Draw Actor SP Meter
#--------------------------------------------------------------------------
alias cbs_draw_actor_sp draw_actor_sp
def draw_actor_sp(actor, x, y, width = 146, height = 15)
bg = Color.new( 0, 0, 0, 160)
c1 = Color.new( 0, 174, 225, 255)
c2 = Color.new( 255, 255, 255, 255)
self.contents.fill_rect(x, y, width, height, bg)
width2 = width * actor.sp / actor.maxsp
gradient(x + 1, y + 1, width2 - 2, height - 2, c1, c2)
cbs_draw_actor_sp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# â— Draw Gradient
#--------------------------------------------------------------------------
def gradient(x, y, width, height, c1, c2)
for i in 1..width
x2 = x + i - 1
r = c1.red * (width - i) / width + c2.red * i / width
g = c1.green * (width - i) / width + c2.green * i / width
b = c1.blue * (width - i) / width + c2.blue * i / width
a = c1.alpha * (width - i) / width + c2.alpha * i / width
self.contents.fill_rect(x2, y, 1, height, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# â— Make State Text
#--------------------------------------------------------------------------
def make_battler_state_text(battler, width, need_normal)
brackets_width = self.contents.text_size("Status: ").width
text = ""
for i in battler.states
if $data_states.rating >= 1
if text == ""
text = $data_states.name
else
new_text = text + "/" + $data_states.name
text_width = self.contents.text_size(new_text).width
if text_width > width - brackets_width
break
end
text = new_text
end
end
end
if text == ""
if need_normal
text = "Status: Normal"
end
else
text = "Status: " + text
end
return text
end
end
I still really need my text to not be skewed, but updating Shane's bullets is more pressing. Also still need a way to shove the character names into the upper left hand corner of their individual status windows. After seeing how easy it is to blast in some pictures, I think the bar frames problem will be easily alleviated.
Thanks for the help!
-K
EDIT2
OMG! I'm such a noob. Realized I was leaving out the @bullets =[] and @ubullets =[] when plugging it into bottom part of the code. Works great now!