So in case you didn't know, I can't script to save my life. I tried making a hud like window that shows text in the map scene from some variables. It works together with some events to show the player's "clan", as well as the clan's reputation. The script is below:
Everything about the script seems to work fine (which is a first for me tbh), except the contents of the window will not update unless I enter another scene and then return to the map scene! Since it's supposed to be a hud, the contents should update along with the variables. But since my scripting knowledge pretty much ends here, I can't figure it out. Also, if anyone has any more advice as to how to make the code a little bit cleaner, I would be happy to hear that as well.
class Window_Clan < Window_Base def initialize
super(0, 368, Graphics.width, fitting_height(1))
self.windowskin = Cache.system("Black Window")
create_contents
refresh
end
def refresh
contents.clear
#Draw "Clan" text
draw_text_ex(0, 2, "Clan:")
#Draw clan name
draw_text_ex(30, 2, $game_variables[1])
#Draw clan reputation
draw_text_ex(96, 2, $game_variables[2])
draw_icon($game_variables[4], 72, 2, enabled = true)
end
end
class Scene_Map < Scene_Base
def create_all_windows
create_message_window
create_scroll_text_window
create_location_window
create_clan_window
end
def create_clan_window
@clan_window = Window_Clan.new
@clan_window.z = 1
end
end
super(0, 368, Graphics.width, fitting_height(1))
self.windowskin = Cache.system("Black Window")
create_contents
refresh
end
def refresh
contents.clear
#Draw "Clan" text
draw_text_ex(0, 2, "Clan:")
#Draw clan name
draw_text_ex(30, 2, $game_variables[1])
#Draw clan reputation
draw_text_ex(96, 2, $game_variables[2])
draw_icon($game_variables[4], 72, 2, enabled = true)
end
end
class Scene_Map < Scene_Base
def create_all_windows
create_message_window
create_scroll_text_window
create_location_window
create_clan_window
end
def create_clan_window
@clan_window = Window_Clan.new
@clan_window.z = 1
end
end