King Moogle
Sponsor
Hey, all!
I'm trying to teach myself a bit of RGSS. Keep in mind that I literally know nothing about it other than what I state in this post.
Basically, I'm trying to have a window that stays on the screen (not the menu), an HUD of sorts, that displays a variable set in game. I've tried to read/analyze various topics (making use of the ancient art of Search-jitsu), and here's what I've come up with:
This is a new script inserted above Main:
This I added onto the end of Scene_Map:
It sure enough displays a window, and it displays a "0" where a zero should be. However, I'm not sure...
1. Is the 0 there actually referring to the fact that the game starts with the variable as 0, or did I do that wrong?
2. How do I make it so that it updates to stay current with whatever in this case Variable 25 is?
I can't really answer any questions about why I did what I did; this is the result of about 3 hours of playing around typing things and trying to make it work based off in-game scripts and what a few other people have done. I'd appreciate all help; thanks!
I'm trying to teach myself a bit of RGSS. Keep in mind that I literally know nothing about it other than what I state in this post.
Basically, I'm trying to have a window that stays on the screen (not the menu), an HUD of sorts, that displays a variable set in game. I've tried to read/analyze various topics (making use of the ancient art of Search-jitsu), and here's what I've come up with:
This is a new script inserted above Main:
Code:
class Window_hunger < Window_Base
def initialize
super(170, 400, 200, 80)
self.back_opacity = 145
self.contents = Bitmap.new(200 - 32, 80 - 32)
refresh
end
def refresh
self.contents.clear
$game_variables[25] = @hunger
self.contents.draw_text(0, 0, 190, 70, $game_variables[25].to_s)
end
end
This I added onto the end of Scene_Map:
Code:
#HUD2 UPDATE
class Scene_Map
alias hunger_main main
alias hunger_update update
def main
@hunger = Window_hunger.new
hunger_main
@hunger.dispose
end
def update
@hunger.update
hunger_update
end
end
It sure enough displays a window, and it displays a "0" where a zero should be. However, I'm not sure...
1. Is the 0 there actually referring to the fact that the game starts with the variable as 0, or did I do that wrong?
2. How do I make it so that it updates to stay current with whatever in this case Variable 25 is?
I can't really answer any questions about why I did what I did; this is the result of about 3 hours of playing around typing things and trying to make it work based off in-game scripts and what a few other people have done. I'd appreciate all help; thanks!