hello everyone my game has a custom HUD which shows health magic and ammo and that's great but I would like to change character every time my player enters Cyber-Space you see in my game there are computer terminals which transport the player into a virtual world I had always intended to change the players character with a different one called avatar which would have his own attacks and stats but when I try to change character I get an error message
[IMG]http://i229.photobucket.com/albums/ee233/smallfish1x/huderror_zps1ea52241.png[/IMG]
obviously it must be trying to find the hp of player one so if someone could alter it so the hud can be turned of for a moment so I can change character that would be great
here is my HUD script
#==============================================================================# ** Window_YourHUD#------------------------------------------------------------------------------# This Window displays relavent values to the player during gameplay.# by emeraldcyndaquil#==============================================================================class Window_YourHUD < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 0, 640, 64) self.opacity = 0 self.contents = Bitmap.new(640 - 32, 64 - 32) refresh end #-------------------------------------------------------------------------- # * Draw Variable #-------------------------------------------------------------------------- def draw_variable(x, y) self.contents.font.color = system_color self.contents.draw_text(x, y, 64, 32, "Ammo") # Draw HP self.contents.font.color = $game_variables[1] == 0 ? knockout_color : $game_variables[1] <= 5 ? crisis_color : normal_color self.contents.draw_text(x + 64, y, 80, 32, $game_variables[1].to_s, 2) end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear reset_variables return if !@actor draw_actor_hp(@actor, 0, 0) draw_actor_sp(@actor, 250, 0) draw_variable(440, 0) end #-------------------------------------------------------------------------- # * Reset Stored Variables #-------------------------------------------------------------------------- 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 @old_ammo = $game_variables[1] end #--------------------------------------------------------------------------- # * Update (called once a frame) #--------------------------------------------------------------------------- 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_ammo != $game_variables[1] or @old_maxsp != @actor ? @actor.maxsp : 0) endend#==============================================================================# ** Scene_Map#------------------------------------------------------------------------------# We've edited this to add a HUD#==============================================================================class Scene_Map #--------------------------------------------------------------------------- # * Alias Listings (fixes F12 bug) #--------------------------------------------------------------------------- unless method_defined?🙂yourhud_main) alias_method🙂yourhud_main, :main) alias_method🙂yourhud_update, :update) end #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main @yourhud = Window_YourHUD.new yourhud_main @yourhud.dispose end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update @yourhud.update yourhud_update endendand here is a copy of my game if it would help
http://s000.tinyupload.com/?file_id=14741368659685776756
[IMG]http://i229.photobucket.com/albums/ee233/smallfish1x/huderror_zps1ea52241.png[/IMG]
obviously it must be trying to find the hp of player one so if someone could alter it so the hud can be turned of for a moment so I can change character that would be great
here is my HUD script
#==============================================================================# ** Window_YourHUD#------------------------------------------------------------------------------# This Window displays relavent values to the player during gameplay.# by emeraldcyndaquil#==============================================================================class Window_YourHUD < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 0, 640, 64) self.opacity = 0 self.contents = Bitmap.new(640 - 32, 64 - 32) refresh end #-------------------------------------------------------------------------- # * Draw Variable #-------------------------------------------------------------------------- def draw_variable(x, y) self.contents.font.color = system_color self.contents.draw_text(x, y, 64, 32, "Ammo") # Draw HP self.contents.font.color = $game_variables[1] == 0 ? knockout_color : $game_variables[1] <= 5 ? crisis_color : normal_color self.contents.draw_text(x + 64, y, 80, 32, $game_variables[1].to_s, 2) end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear reset_variables return if !@actor draw_actor_hp(@actor, 0, 0) draw_actor_sp(@actor, 250, 0) draw_variable(440, 0) end #-------------------------------------------------------------------------- # * Reset Stored Variables #-------------------------------------------------------------------------- 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 @old_ammo = $game_variables[1] end #--------------------------------------------------------------------------- # * Update (called once a frame) #--------------------------------------------------------------------------- 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_ammo != $game_variables[1] or @old_maxsp != @actor ? @actor.maxsp : 0) endend#==============================================================================# ** Scene_Map#------------------------------------------------------------------------------# We've edited this to add a HUD#==============================================================================class Scene_Map #--------------------------------------------------------------------------- # * Alias Listings (fixes F12 bug) #--------------------------------------------------------------------------- unless method_defined?🙂yourhud_main) alias_method🙂yourhud_main, :main) alias_method🙂yourhud_update, :update) end #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main @yourhud = Window_YourHUD.new yourhud_main @yourhud.dispose end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update @yourhud.update yourhud_update endendand here is a copy of my game if it would help
http://s000.tinyupload.com/?file_id=14741368659685776756