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.

Small command window problem...

khmp

Sponsor

Just insert an empty section above main in the script listings and paste in it the code below. The only thing I added was the z value of the command window that displays the battle commands being set to an incredibly high number, (9999).
Code:
#==============================================================================
# ** Scene_Battle (part 1)
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle
#--------------------------------------------------------------------------
  # * Main Processing (*!OVERRIDE*!)
  #--------------------------------------------------------------------------
  def main
    # Initialize each kind of temporary battle data
    $game_temp.in_battle = true
    $game_temp.battle_turn = 0
    $game_temp.battle_event_flags.clear
    $game_temp.battle_abort = false
    $game_temp.battle_main_phase = false
    $game_temp.battleback_name = $game_map.battleback_name
    $game_temp.forcing_battler = nil
    # Initialize battle event interpreter
    $game_system.battle_interpreter.setup(nil, 0)
    # Prepare troop
    @troop_id = $game_temp.battle_troop_id
    $game_troop.setup(@troop_id)
    # Make actor command window
    s1 = $data_system.words.attack
    s2 = $data_system.words.skill
    s3 = $data_system.words.guard
    s4 = $data_system.words.item
    @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
    @actor_command_window.y = 160
    @actor_command_window.z = 9999
    @actor_command_window.back_opacity = 160
    @actor_command_window.active = false
    @actor_command_window.visible = false
    # Make other windows
    @party_command_window = Window_PartyCommand.new
    @help_window = Window_Help.new
    @help_window.back_opacity = 160
    @help_window.visible = false
    @status_window = Window_BattleStatus.new
    @message_window = Window_Message.new
    # Make sprite set
    @spriteset = Spriteset_Battle.new
    # Initialize wait count
    @wait_count = 0
    # Execute transition
    if $data_system.battle_transition == ""
      Graphics.transition(20)
    else
      Graphics.transition(40, "Graphics/Transitions/" +
        $data_system.battle_transition)
    end
    # Start pre-battle phase
    start_phase1
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Refresh map
    $game_map.refresh
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @actor_command_window.dispose
    @party_command_window.dispose
    @help_window.dispose
    @status_window.dispose
    @message_window.dispose
    if @skill_window != nil
      @skill_window.dispose
    end
    if @item_window != nil
      @item_window.dispose
    end
    if @result_window != nil
      @result_window.dispose
    end
    # Dispose of sprite set
    @spriteset.dispose
    # If switching to title screen
    if $scene.is_a?(Scene_Title)
      # Fade out screen
      Graphics.transition
      Graphics.freeze
    end
    # If switching from battle test to any screen other than game over screen
    if $BTEST and not $scene.is_a?(Scene_Gameover)
      $scene = nil
    end
  end
end

Good luck with it Vitehite! :thumb:
 

khmp

Sponsor

@Wyatt:
That won't work. There's a loop within Scene_Battle main. That code won't be reached until the loop has broken and the window which you are trying to manipulate has been destroyed.

@Vitehite:
Did you replace the whole Scene_Battle code with the code I gave you? But I figured it would have crashed rather than somehow ate the battlers. After all I only added one line of code. Unless the battlers use the same z value as the command window in question. Could you post your Scene_Battle code or a demo to your project to help us understand the problem better?
 

khmp

Sponsor

Alright made a little fix for it. Didn't know it was a SDK script. :)

Code:
#==============================================================================
# ●● Simple Escape Command
#------------------------------------------------------------------------------
# Trickster (tricksterguy@hotmail.com)
# Version 1.0
# Date 4/2/07
# Goto rmxp.org for updates/support/bug reports
#------------------------------------------------------------------------------
# This script adds an Escape Command to the Battle Commands and when used
# It escapes from battle. Also removes the Attack Escape Window in battle (phase2)
#==============================================================================

#--------------------------------------------------------------------------
# Begin SDK Log
#--------------------------------------------------------------------------
SDK.log('Simple Escape Command', 'Trickster', 1.0, '4/2/07')

#--------------------------------------------------------------------------
# Begin SDK Requirement Check
#--------------------------------------------------------------------------
SDK.check_requirements(2.0, [1, 2, 3, 4])

#--------------------------------------------------------------------------
# Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.enabled?('Simple Escape Command')

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Main Window
  #--------------------------------------------------------------------------
  alias_method :old_main_window, :main_window
  def main_window
    old_main_window    
    @actor_command_window.z = 9999
  end
end
#--------------------------------------------------------------------------
# End SDK Enabled Check
#--------------------------------------------------------------------------
end

Good luck with your game Vitehite! :thumb:
 

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