#Show HP in Numericals
self.contents.draw_text(x, y, 640, 32, "HP")
self.contents.draw_text(x+10, y, 640, 32, $actor_hp.to_s)
self.contents.draw_text(x+13, y, 640, 32, "/")
self.contents.draw_text(x+16, y, 640, 32, $actor_maxhp.to_s)
#Show SP in Numericals
self.contents.draw_text(x, y, 640, 32, "SP")
self.contents.draw_text(x+10, y+10, 640, 32, $actor_sp.to_s)
self.contents.draw_text(x+13, y+10, 640, 32, "/")
self.contents.draw_text(x+16, y+10, 640, 32, $actor_maxsp.to_s)
class Scene_Map
alias yourhud_main main
alias yourhud_update update
def main
if $battle
@yourhud = Window_YourHUD.new
yourhud_main
@yourhud.dispose
else
yourhud_main
end
end
def update
if $battle
@yourhud.update
yourhud_update
else
yourhud_update
end
end
end
Yeyinde;144828 said:foftime, just put @your_hud.visible = $battle right after @your_hud.update and @your_hud = Window_YourHUD.new. No need for conditionals.
class Scene_Map
alias Window_Status_main main
alias Window_Status_update update
def main
#When I try @Window_Status = Window_Window_Status.new in the next line it doesn't
#work either.
@Window_Status = Window_Status.new
Window_Status_main
@Window_Status.dispose
end
def update
@Window_Status.update
Window_Status_update
end
end
class Window_Status < Window_Base
def initialize(actor)
super(0, 0, 320, 240)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.back_opacity = 145
@actor = actor
refresh
end
def refresh
self.contents.clear
draw_actor_graphic(@actor, 40, 80)
draw_actor_name(@actor, 4, 0)
draw_actor_parameter(@actor, 4, 20, 0)
draw_actor_parameter(@actor, 4, 40, 1)
draw_actor_parameter(@actor, 4, 60, 2)
draw_actor_parameter(@actor, 4, 80, 3)
draw_actor_parameter(@actor, 4, 100, 4)
draw_actor_parameter(@actor, 4, 120, 5)
draw_actor_parameter(@actor, 4, 140, 6)
self.contents.font.color = system_color
self.contents.draw_text(320, 48, 80, 32, "")
self.contents.draw_text(320, 80, 80, 32, "")
self.contents.font.color = normal_color
end
end
it might be a bit old but change:DeadCaL;136009 said:Hello, I've tried this various ways. I've tried the exact one in the original post. I've tried the 'initialize' update, and I've tried removing @yourhud.dispose
I still get
Script 'HUD' line 3: RGSSError occoured.
disposed window
What else should I be lookin out for? I'm not great with scripting, what can be up with line 3?
@yourhud.dispose
@yourhud.dispose if !@yourhud.disposed?
class Window_YourHUD < Window_Base
def initialize
super(0, 0, 350, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 160
refresh
end
def refresh
self.contents.clear
reset_variables
return if !@actor
draw_actor_hp(@actor, 2, 2)
draw_actor_sp(@actor, 170,2)
end
def reset_variables
@actor = $game_party.actors[0]
@old_hp = @actor ? @actor.hp : 0
@old_maxhp = @actor ? @actor.maxhp : 0
@old_sp = @actor ? @actor.sp : 0
@old_maxsp = @actor ? @actor.maxsp : 0
end
def update
super
refresh if (@actor = $game_party.actors[0] or
@old_hp = @actor ? @actor.hp : 0 or
@old_maxhp = @actor ? @actor.maxhp : 0 or
@old_sp = @actor ? @actor.sp : 0 or
@old_maxsp = @actor ? @actor.maxsp : 0)
end
end
class Scene_Map
alias yourhud_main main
alias yourhud_update update
def main
@yourhud = Window_YourHUD.new
yourhud_main
@yourhud.dispose
end
def update
@yourhud.update
yourhud_update
end
end
class Fishing_HUD < Window_Base
def initialize
super(0, 416, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = 20
refresh
end
def refresh
self.contents.clear
@fishing_var = $game_variables[1]
self.contents.draw_text(65, 5, 100, 32, @fishing_var.to_s)
self.contents.draw_text(5, 5, 100, 32, 'Fishing')
end
def update
super
refresh if @fishing_var != $game_variables[1]
end
end
class Scene_Map
alias fishing_hud_main main
alias finishg_hud_update
def main
@fishing_hud = Fishing_HUD.new
fishing_hud_main
@fishing_hud.dispose
end
def update
@fishing_hud.update
fishing_hud_update
end
end