Hello!
I've just gotten into scripting with RGSS, and I'm having a bit of trouble with updating my variables in real-time. I think it may be how i'm using the script rather than the script itself, but I'm not sure. Using update has worked for my other scripts, but not this one.
class Scene_HUD < Scene_Base def start @act1_stat_win = Window_Stat.new(0, 0, 200, 55, 1) @act1_stat_win.opacity = 75 end endclass Window_Stat < Window_Base def initialize(x, y, width, height, window_num) super(x, y, width, height) @window_num = window_num refresh end def update super refresh end def refresh contents.clear @party = $game_party.members draw_actor_graphic(@party[@window_num - 1], 32, 32) draw_text(50, 10, 50, line_height, @party[@window_num - 1].hp) end endAnd when I'm putting it up, I start an instance of Scene_HUD with a Script Event.
@Stat_Window = Scene_HUD.new@Stat_Window.startCan someone tell me what I'm doing wrong to not have the HP update?
EDIT:
Well, I finally managed to do it the manual way. That is, I hunted down the methods that took care of changing player HP (damage and recovery) and called my update method in my Scene_HUD instance from there. It works, but I'm fairly sure there is an easier way to do it. Plus, I don't like editing the default scripts if I can create my own classes and just use existing classes and methods to do what I want.
I would still appreciate any help with doing it an easier way. Also, if someone could point me to a place that has all the global variables, classes, and methods along with their required arguments that would be very helpful. I found a post on these forums that had a some, but was missing a lot of things.
I've just gotten into scripting with RGSS, and I'm having a bit of trouble with updating my variables in real-time. I think it may be how i'm using the script rather than the script itself, but I'm not sure. Using update has worked for my other scripts, but not this one.
class Scene_HUD < Scene_Base def start @act1_stat_win = Window_Stat.new(0, 0, 200, 55, 1) @act1_stat_win.opacity = 75 end endclass Window_Stat < Window_Base def initialize(x, y, width, height, window_num) super(x, y, width, height) @window_num = window_num refresh end def update super refresh end def refresh contents.clear @party = $game_party.members draw_actor_graphic(@party[@window_num - 1], 32, 32) draw_text(50, 10, 50, line_height, @party[@window_num - 1].hp) end endAnd when I'm putting it up, I start an instance of Scene_HUD with a Script Event.
@Stat_Window = Scene_HUD.new@Stat_Window.startCan someone tell me what I'm doing wrong to not have the HP update?
EDIT:
Well, I finally managed to do it the manual way. That is, I hunted down the methods that took care of changing player HP (damage and recovery) and called my update method in my Scene_HUD instance from there. It works, but I'm fairly sure there is an easier way to do it. Plus, I don't like editing the default scripts if I can create my own classes and just use existing classes and methods to do what I want.
I would still appreciate any help with doing it an easier way. Also, if someone could point me to a place that has all the global variables, classes, and methods along with their required arguments that would be very helpful. I found a post on these forums that had a some, but was missing a lot of things.