Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Disappearing window...

Ok, I have a HUD made up of two windows, an RS chat system, an AMS and a minimap script.

One of the windows, for no apparent reason, decides it wants to disappear after ten seconds...

#----------------------------------------
# Window_HudStats
#----------------------------------------

class Window_HudSkills < Window_Base
#----------------------------------------
# Object Initialization
#----------------------------------------
def initialize
super(421, 0, 219, 100)
self.contents = Bitmap.new(width - 2, height - 2)
refresh
end

def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = 16
#Fishing
fishlvl = $game_variables[8]
#Cooking
cooklvl = $game_variables[26]
#Hunting
huntlvl = $game_variables[29]
#Alchemy
alclvl = $game_variables[32]
#Agility
agilvl = $game_variables[35]
#-------------------------
#Text coding and placement
#-------------------------
self.contents.draw_text(35, 7, 50, 25, "#{fishlvl}")
self.contents.draw_text(100, 7, 50, 25, "#{cooklvl}")
self.contents.draw_text(165, 7, 50, 25, "#{huntlvl}")
self.contents.draw_text(35, 38, 50, 25, "#{alclvl}")
self.contents.draw_text(100, 38, 50, 25, "#{agilvl}")
#--------------------------
#Image coding and placement
#--------------------------
@bitmap = RPG::Cache.icon("fish.png")
self.contents.blt(7, 4, @bitmap, Rect.new(0, 0, @bitmap.width, @bitmap.height), 160)
@bitmap = RPG::Cache.icon("fo8.png")
self.contents.blt(71, 4, @bitmap, Rect.new(0, 0, @bitmap.width, @bitmap.height), 160)
@bitmap = RPG::Cache.icon("005-weapon05.png")
self.contents.blt(141, 4, @bitmap, Rect.new(0, 0, @bitmap.width, @bitmap.height), 160)
@bitmap = RPG::Cache.icon("skill_022.png")
self.contents.blt(7, 35, @bitmap, Rect.new(0, 0, @bitmap.width, @bitmap.height), 160)
@bitmap = RPG::Cache.icon("020-accessory05.png")
self.contents.blt(71, 35, @bitmap, Rect.new(0, 0, @bitmap.width, @bitmap.height), 160)
end
end

The scene it is on:

#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================

class Scene_Map
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
main_draw
# Main loop
loop do
main_loop
break if main_scenechange?
end
main_dispose
main_tiletrigger
end
#--------------------------------------------------------------------------
# * Main Draw
#--------------------------------------------------------------------------
def main_draw
# Make sprite set
@spriteset = Spriteset_Map.new
# Make message window
@message_window = Window_Message.new
# Show Hud windows
@window = Window_HudSkills.new # Skills window
@window = Window_HudStats.new # Stats window
# Transition run
Graphics.transition
end
#--------------------------------------------------------------------------
# * Main Loop
#--------------------------------------------------------------------------
def main_loop
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
end
#--------------------------------------------------------------------------
# * Main Scene Change
#--------------------------------------------------------------------------
def main_scenechange?
# Abort loop if screen is changed
if $scene != self
return true
end
return false
end
#--------------------------------------------------------------------------
# * Main Dispose
#--------------------------------------------------------------------------
def main_dispose
Graphics.freeze
@spriteset.dispose
automatic_dispose
end
#--------------------------------------------------------------------------
# * Main Tiletrigger
#--------------------------------------------------------------------------
def main_tiletrigger
# If switching to title screen
if $scene.is_a?(Scene_Title)
# Fade out screen
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Loop
loop do
update_systems
# Abort loop if player isn't place moving
unless $game_temp.player_transferring
break
end

# Run place move
transfer_player
# Abort loop if transition processing
if $game_temp.transition_processing
break
end
end
update_graphics
return if update_game_over? == true
return if update_to_title? == true
# If transition processing
if $game_temp.transition_processing
# Clear transition processing flag
$game_temp.transition_processing = false
# Execute transition
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# If showing message window
if $game_temp.message_window_showing
return
end
# If encounter list isn't empty, and encounter count is 0
if $game_player.encounter_count == 0 and $game_map.encounter_list != []
# If event is running or encounter is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
# Confirm troop
n = rand($game_map.encounter_list.size)
troop_id = $game_map.encounter_list[n]
# If troop is valid
if $data_troops[troop_id] != nil
# Set battle calling flag
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end
end
update_chat
update_call_menu
update_call_debug
# If player is not moving
unless $game_player.moving?
update_scene
end
end
#--------------------------------------------------------------------------
# * Update Systems
#--------------------------------------------------------------------------
def update_systems
# Update map, interpreter, and player order
# (this update order is important for when conditions are fulfilled
# to run any event, and the player isn't provided the opportunity to
# move in an instant)
$game_map.update
$game_system.map_interpreter.update
$game_player.update
# Update system (timer), screen
$game_system.update
$game_screen.update
end
#--------------------------------------------------------------------------
# * Update Graphics
#--------------------------------------------------------------------------
def update_graphics
# Update sprite set
@spriteset.update
# Update message window
@message_window.update
end
#--------------------------------------------------------------------------
# * Update Game Over
#--------------------------------------------------------------------------
def update_game_over?
# If game over
if $game_temp.gameover
# Switch to game over screen
$scene = Scene_Gameover.new
return true
end
return false
end
#--------------------------------------------------------------------------
# * Update To Title
#--------------------------------------------------------------------------
def update_to_title?
# If returning to title screen
if $game_temp.to_title
# Change to title screen
$scene = Scene_Title.new
return true
end
return false
end
#--------------------------------------------------------------------------
# * Update Menu Call
#--------------------------------------------------------------------------
def update_call_menu
# If B button was pressed
if Input.trigger?(Input::B)
# If event is running, or menu is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.menu_disabled
# Set menu calling flag or beep flag
$game_temp.menu_calling = true
$game_temp.menu_beep = true
end
end
end
#--------------------------------------------------------------------------
# * Update Debug Call
#--------------------------------------------------------------------------
def update_call_debug
# If debug mode is ON and F9 key was pressed
if $DEBUG and Input.press?(Input::F9)
# Set debug calling flag
$game_temp.debug_calling = true
end
end
#--------------------------------------------------------------------------
# * Update Scene
#--------------------------------------------------------------------------
def update_scene
# Run calling of each screen
if $game_temp.battle_calling
call_battle
elsif $game_temp.shop_calling
call_shop
elsif $game_temp.name_calling
call_name
elsif $game_temp.menu_calling
call_menu
elsif $game_temp.save_calling
call_save
elsif $game_temp.debug_calling
call_debug
end
end
#--------------------------------------------------------------------------
# * Update Chat
#--------------------------------------------------------------------------
def update_chat
end
end
 
umm why are you using the same variable name for both windows

@window = Window_HudSkills.new # Skills window
@window = Window_HudStats.new # Stats window

and you have to add in the update method
<window>.update (<window> is a Window)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top