RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

Save & Load

Started by Edwin VanCleef, December 28, 2006, 07:56:25 PM

0 Members and 1 Guest are viewing this topic.

Edwin VanCleef

I seem to have a slight problem: I can save anywhere on my maps, but I can never load from my title screen no matter how many times I save, "Continue" is always grayed out.

Could this be because of my CMS, or am I just making a stupid mistake?


The new generation will go to the distance... Will the distance between us smallen?

Me™

Probably the last. Did you changed the filenames of the saves? Are the savefiles created?
ALL HAIL ME™

Edwin VanCleef

I never changed the filenames, but I think I deleted some files once.

This is how my project folder looks:



The new generation will go to the distance... Will the distance between us smallen?

Me™

That should be fine. Could you post your Scene_Title, if edited and Scripts related too? I guess eomwhere it is messed up (also, do you use the SDK?)
ALL HAIL ME™

Edwin VanCleef

I didn't edit scene_title, and I don't use SDK (or whatever)

I can show you the script for the CMS though:

[code]
#==============================================================================
# ** Chrono Trigger CMS
#------------------------------------------------------------------------------
# Raziel
# 2006-09-09
# Version 1.20
#------------------------------------------------------------------------------
# Thanks to
# ~ Squall/Selwyn for his Cursor Script
# ~ RPG Advocate for his Party Members change script
# ~ MeisMe for fixing some bugs and helping me
# ~ Squaresoft for the pictures
#==============================================================================
# ~Instructions
#  Icons of the characters are used in the save menu.
#  Make sure you put them in the icon folder and name them
#  like you name your character file, for example the icon for
#  Arshes would be 001-Fighter01

#  For the chapter function, just use $game_system = "desired filename"
#  in a call script command and then the savefile will have the name
#  you choose.
#==============================================================================
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs menu screen processing.
#==============================================================================
class Scene_Menu
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make command window
    @back_ground = Sprite.new
    @back_ground.bitmap = RPG::Cache.picture(CT_Pictures::BG_Picture)
    @skill_background = Sprite.new
    @skill_background.bitmap = RPG::Cache.picture(CT_Pictures::Skill_bg)
    @item_background = Sprite.new
    @item_background.bitmap = RPG::Cache.picture(CT_Pictures::Item_bg)
    @save_background = Sprite.new
    @save_background.bitmap = RPG::Cache.picture(CT_Pictures::Save_bg)
    @end_background = Sprite.new
    @end_background.bitmap = RPG::Cache.picture(CT_Pictures::End_bg)
    @equip_item_background = Sprite.new
    @equip_item_background.bitmap = RPG::Cache.picture(CT_Pictures::Item_Equip_bg)
    @playtime_background = Sprite.new
    @playtime_background.bitmap = RPG::Cache.picture(CT_Pictures::Playtime_bg)
    @playtime_background.x = 0
    @playtime_background.y = 384
    @playtime_background.z = 9999
    @end_background.x, @end_background.y = 229, 156
    @item_background.x , @item_background.y = 48, 36
    @skill_background.x , @skill_background.y = 48, 36
    @party_change = Window_PartyChange.new
    @command_window = Window_IconCommands.new
    @command_window.index = @menu_index
    @actor_window = Window_Actors.new
    @new_equip = Window_NewEquip.new
    $game_temp.equip_window = @new_equip
    @item_window = Window_Item.new
    @help_window = Window_Help.new
    @playtime_window = Window_PlayTime.new
    @item_window.help_window = @help_window
    @help_window.opacity, @item_window.opacity = 0, 0
    @help_window.x, @help_window.y = 48, 45
    @equip_item_background.x, @equip_item_background.y = 46, 37
    @target_window = Window_Target.new
    @actor_skillwindow = Window_SkillActor.new
    @target_cursor = []
    @target_cursor_skill = []
    @switch_cursor = []
    @equip_item = []
    @switch = 0
    @target_cursor[0] = Sprite_Cursor.new(306, 196)
    @target_cursor[1] = Sprite_Cursor.new(306, 276)
    @target_cursor[2] = Sprite_Cursor.new(306, 356)
    @target_cursor_skill[0] = Sprite_Cursor.new(306, 121)
    @target_cursor_skill[1] = Sprite_Cursor.new(306, 201)
    @target_cursor_skill[2] = Sprite_Cursor.new(306, 281)
    @switch_cursor[0] = Sprite_Cursor.new(182, 15)
    @switch_cursor[1] = Sprite_Cursor.new(182, 125)
    @switch_cursor[2] = Sprite_Cursor.new(182, 235)
    @switch_cursor[3] = Sprite_Cursor.new(182, 345)
    @equip_item[0] = Window_EquipItem2.new(0)
    @equip_item[1] = Window_EquipItem2.new(1)
    @equip_item[2] = Window_EquipItem2.new(2)
    @equip_item[3] = Window_EquipItem2.new(3)
    @equip_item[4] = Window_EquipItem2.new(4)
    @equip_description = Window_EquipDescription.new
    @counter = 0
    @end_window = Window_End.new
    @end_window.x = 320 - @end_window.width / 2
    @end_window.y = 220 - @end_window.height / 2
    @end_window.opacity = 0
    @savefile_windows = []
    for i in 0..2
      @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
    end
    @file_index = $game_temp.last_file_index
    @savefile_windows[@file_index].selected = true
    @save_status = Window_SaveStatus.new
    @skill_actor_window2 = []
    @skill_window = []
    unless $game_party.actors[0] == nil
      @skill_actor_window2[0] = Window_SkillActor2.new($game_party.actors[0])
      @skill_window[0] = Window_Skill.new($game_party.actors[0])
    end
    unless $game_party.actors[1] == nil
      @skill_actor_window2[1] = Window_SkillActor2.new($game_party.actors[1])
      @skill_window[1] = Window_Skill.new($game_party.actors[1])
    end
    unless $game_party.actors[2] == nil
      @skill_actor_window2[2] = Window_SkillActor2.new($game_party.actors[2])
      @skill_window[2] = Window_Skill.new($game_party.actors[2])
    end
    unless $game_party.actors[3] == nil
      @skill_actor_window2[3] = Window_SkillActor2.new($game_party.actors[3])
      @skill_window[3] = Window_Skill.new($game_party.actors[3])
    end
    @item_window.visible = false
    @help_window.visible = false
    @item_background.visible = false
    @target_window.visible = false
    @skill_background.visible = false
    @actor_skillwindow.visible = false
    @save_background.visible = false
    @save_status.visible = false
    @end_window.visible = false
    @end_background.visible = false
    @party_change.visible = false
    @equip_item_background.visible = false
    @equip_description.visible = false
    for i in 0..2
      @target_cursor.visible = false
      @target_cursor_skill.visible = false
      @savefile_windows.visible = false
      @switch_cursor.visible = false
      @switch_cursor[3].visible = false
    end
    for i in 0..4
      @equip_item.active = false
      @equip_item.visible = false
    end
    for i in 0...$game_party.actors.size
      @skill_window.visible = false
      @skill_window.active = false
      @skill_window.width = 300
      @skill_actor_window2.visible = false
      @skill_actor_window2.active = false
    end
    @item_window.active = false
    @target_window.active = false
    @actor_skillwindow.active = false
    @end_window.active = false
    @party_change.active = false
    for i in 0..2
      @savefile_windows.active = false
    end
    #refresh
    equip_refresh
    # Execute transition
    Graphics.transition
    # 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
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @back_ground.dispose
    @actor_window.dispose
    @command_window.dispose
    @new_equip.dispose
    @item_window.dispose
    @help_window.dispose
    @item_background.dispose
    @target_window.dispose
    @skill_background.dispose
    @actor_skillwindow.dispose
    @save_background.dispose
    @save_status.dispose
    @end_window.dispose
    @end_background.dispose
    @party_change.dispose
    @switch_cursor[3].dispose
    @equip_item_background.dispose
    @equip_description.dispose
    @playtime_window.dispose
    @playtime_background.dispose
    for i in @skill_actor_window2
      i.dispose
    end
    for i in @skill_window
      i.dispose
    end
    for i in @savefile_windows
      i.dispose
    end
    for i in @target_cursor
      i.dispose
    end
    for i in @target_cursor_skill
      i.dispose
    end
    for i in @switch_cursor
      i.dispose
    end
    for i in @equip_item
      i.dispose
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @actor_window.update
    @command_window.update
    @new_equip.update
    @item_window.update
    @help_window.update
    @target_window.update
    @actor_skillwindow.update
    @save_status.update
    @party_change.update
    @end_window.update
    @equip_description.update
    @playtime_window.update
    equip_refresh
    for i in @savefile_windows
      i.update
    end
    for i in @skill_window
      i.update
    end
    for i in @skill_actor_window2
      i.update
    end
    for i in @equip_item
      i.update
    end
    if @command_window.active
      # If command window is active: call update_command
      update_command
    elsif @actor_window.active
      # If actor window is active: call update_actor
      update_actor
    elsif @new_equip.active
      # If new equip window is active: call update_equip
      update_equip
    elsif @equip_item[@new_equip.index].active
      # If item equip window is active: call update_equipitem
      update_equipitem
    elsif @item_window.active
      # If item window is active: call update_item
      update_item
    elsif @target_window.active
      # If target window is active: call update_target
      update_target
    elsif @actor_skillwindow.active
      # If actor skill window is active: call update_actor_skill
      update_actor_skill
    elsif @skill_window[@actor_skillwindow.index].active
      # If skill window is active: call update_skill
      update_skill
    elsif @savefile_windows[@file_index].active
      # If savefile window is active: call update_savefile
      update_savefile
    elsif @party_change.active
      # If party change window is active: call update_change
      update_change
    elsif @end_window.active
      # If end window is active: call update_end
      update_end
    end
    $game_temp.save_index = @file_index
    $game_temp.skill_index = @skill_window[@actor_skillwindow.index].index
    $game_temp.equip_index = @new_equip.index
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    case @command_window.index
    when 0
      @actor_window.visible = true
      @new_equip.visible = true
      @item_window.visible = false
      @item_background.visible = false
    when 1
      @actor_window.visible = false
      @new_equip.visible = false
      @skill_background.visible = false
      @actor_skillwindow.visible = false
      @item_window.visible = true
      @item_background.visible = true
      @help_window.y = 45
    when 2
      @item_window.visible = false
      @item_background.visible = false
      @party_change.visible = false
      @skill_background.visible = true
      @actor_skillwindow.visible = true
      @help_window.y = 385
    when 3
      for i in 0..2
        @savefile_windows.visible = false
      end
      @help_window.visible = false
      @skill_background.visible = false
      @actor_skillwindow.visible = false
      @save_background.visible = false
      @save_status.visible = false
      @party_change.visible = true
    when 4
      @end_window.visible = false
      @end_background.visible = false
      @party_change.visible = false
    for i in 0..2
      @savefile_windows.visible = true
    end
    @save_background.visible = true
    @save_status.visible = true
    when 5
    for i in 0..2
      @savefile_windows.visible = false
    end
    @save_background.visible = false
    @save_status.visible = false
    @end_window.visible = true
    @end_background.visible = true
    end
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      @playtime_background.visible = false
      @playtime_window.visible = false
      # Branch by command window cursor position
      case @command_window.index
      when 0  # equip/status
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @command_window.visible = false
        @actor_window.active = true
        @actor_window.index = 0
      when 1  # item
        # Make item window active
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @command_window.visible = false
        @item_window.active = true
        @item_window.index = 0
      when 2  # skills
        $game_system.se_play($data_system.decision_se)
        @command_window.visible = false
        @command_window.active = false
        @actor_skillwindow.active = true
        @actor_skillwindow.index = 0
      when 3 #excahnge
        $game_system.se_play($data_system.decision_se)
        @command_window.visible = false
        @command_window.active = false
        @party_change.active = true
        @checker = 0
      when 4 #save
        if $game_system.save_disabled
        $game_system.se_play($data_system.buzzer_se)
        return
      end
        $game_system.se_play($data_system.decision_se)
        @command_window.visible = false
        @command_window.active = false
        @file_index = 0
        for i in 0..2
          @savefile_windows.active = true
          @savefile_windows.selected = false
        end
        @savefile_windows[0].selected = true
      when 5 #quit
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @command_window.visible = false
        @end_window.active = true
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Make File Name
  #     file_index : save file index (0-2)
  #--------------------------------------------------------------------------
  def make_filename(file_index)
    return "Save#{file_index + 1}.rxdata"
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when end window is active)
  #--------------------------------------------------------------------------
  def update_end
    # If B button was pressed
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @end_window.active = false
      @end_window.index = 0
      @command_window.visible = true
      @command_window.active = true
      @playtime_background.visible = true
      @playtime_window.visible = true
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      case @end_window.index
      when 0
        $scene = Scene_Title.new
      when 1
        $scene = nil
      when 2
        @end_window.active = false
        @command_window.visible = true
        @command_window.active = true
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when change window is active)
  #--------------------------------------------------------------------------
  def update_change
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      @party_change.active = false
      @party_change.index = 0
      @command_window.visible = true
      @command_window.active = true
      @playtime_background.visible = true
      @playtime_window.visible = true
      @checker = 0
      for i in 0..3
        @switch_cursor.visible = false
      end
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      if @checker == 0
        @changer = $game_party.actors[@party_change.index]
        @changer_skill = @skill_window[@party_change.index]
        @changer_skill2 = @skill_actor_window2[@party_change.index]
        @where = @party_change.index
        @switch_cursor[@party_change.index].visible = true
        @checker = 1
        else
        $game_party.actors[@where] = $game_party.actors[@party_change.index]
        $game_party.actors[@party_change.index] = @changer
        @skill_actor_window2[@where] = @skill_actor_window2[@party_change.index]
        @skill_actor_window2[@party_change.index] = @changer_skill2
        @skill_window[@where] = @skill_window[@party_change.index]
        @skill_window[@party_change.index] = @changer_skill
        @checker = 0
        @party_change.refresh
        @actor_window.refresh
        @new_equip.refresh
        @target_window.refresh
        @actor_skillwindow.refresh
        @save_status.refresh
        for i in 0..3
          @switch_cursor.visible = false
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when save window is active)
  #--------------------------------------------------------------------------
  def update_savefile
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Call method: on_decision (defined by the subclasses)
      on_decision(make_filename(@file_index))
      $game_temp.last_file_index = @file_index
      return
    end
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Call method: on_cancel (defined by the subclasses)
      on_cancel
      return
    end
    # If the down directional button was pressed
    if Input.repeat?(Input::DOWN)
      # If the down directional button pressed down is not a repeat,
      # or cursor position is more in front than 3
      unless @file_index == 2
      if Input.trigger?(Input::DOWN)
        # Play cursor SE
        $game_system.se_play($data_system.cursor_se)
        # Move cursor down
        @savefile_windows[@file_index].selected = false
        @file_index = (@file_index + 1)# % 3
        @savefile_windows[@file_index].selected = true
        return
      end
      end
    # If the up directional button was pressed
    elsif Input.repeat?(Input::UP)
      # If the up directional button pressed down is not a repeat?
      # or cursor position is more in back than 0
      unless @file_index == 0
        if Input.trigger?(Input::UP)
          # Play cursor SE
          $game_system.se_play($data_system.cursor_se)
          # Move cursor up
          @savefile_windows[@file_index].selected = false
          @file_index = (@file_index - 1)# % 3
          @savefile_windows[@file_index].selected = true
          return
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Decision Processing
  #--------------------------------------------------------------------------
  def on_decision(filename)
    # Play save SE
    $game_system.se_play($data_system.save_se)
    # Write save data
    file = File.open(filename, "wb")
    write_save_data(file)
    file.close
    # If called from event
    if $game_temp.save_calling
      # Clear save call flag
      $game_temp.save_calling = false
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    for i in 0..2
      @savefile_windows.active = false
      @savefile_windows.selected = false
    end
    @savefile_windows[0].selected = true
    @playtime_background.visible = true
    @playtime_window.visible = true
    # Switch to map screen
    $scene = Scene_Map.new
  end
  #--------------------------------------------------------------------------
  # * Cancel Processing
  #--------------------------------------------------------------------------
  def on_cancel
    # Play cancel SE
    $game_system.se_play($data_system.cancel_se)
    # If called from event
    if $game_temp.save_calling
      # Clear save call flag
      $game_temp.save_calling = false
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # Switch to menu screen
    for i in 0..2
      @savefile_windows.active = false
      @savefile_windows.selected = false
    end
    @savefile_windows[0].selected = true
    @save_status.refresh
    @command_window.visible = true
    @command_window.active = true
    @command_window.index = 4
    @playtime_background.visible = true
    @playtime_window.visible = true
  end
  #--------------------------------------------------------------------------
  # * Write Save Data
  #     file : write file object (opened)
  #--------------------------------------------------------------------------
  def write_save_data(file)
    # Make character data for drawing save file
    characters = []
    for i in 0...$game_party.actors.size
      actor = $game_party.actors
      characters.push([actor.character_name, actor.character_hue])
    end
    # Write character data for drawing save file
    Marshal.dump(characters, file)
    # Wrire frame count for measuring play time
    Marshal.dump(Graphics.frame_count, file)
    # Increase save count by 1
    $game_system.save_count += 1
    # Save magic number
    # (A random value will be written each time saving with editor)
    $game_system.magic_number = $data_system.magic_number
    # Write each type of game object
    Marshal.dump($game_system, file)
    Marshal.dump($game_switches, file)
    Marshal.dump($game_variables, file)
    Marshal.dump($game_self_switches, file)
    Marshal.dump($game_screen, file)
    Marshal.dump($game_actors, file)
    Marshal.dump($game_party, file)
    Marshal.dump($game_troop, file)
    Marshal.dump($game_map, file)
    Marshal.dump($game_player, file)
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when equip window is active)
  #--------------------------------------------------------------------------
  def update_equip
    for i in 0..4
      @equip_item.visible = false
    end
    @equip_item[@new_equip.index].visible = true
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      @new_equip.index = 0
      @new_equip.active = false
      @actor_window.active = true
      @actor_window.visible = true
      @equip_item_background.visible = false
      @equip_description.visible = false
      for i in 0..4
        @equip_item.visible = false
      end
      @item_window.refresh
      @target_window.refresh
      @party_change.refresh
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      @actor = $game_party.actors[$game_temp.cms_index]
      if @actor.equip_fix?(@new_equip.index)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Play decission SE
      $game_system.se_play($data_system.decision_se)
      @new_equip.active = false
      @equip_item[@new_equip.index].active = true
      @equip_item[@new_equip.index].index = 0
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when equip window is refreshed)
  #--------------------------------------------------------------------------
   def equip_refresh
    if @new_equip.active
      # Erase parameters for after equipment change
      @new_equip.set_new_parameters(nil, nil, nil, nil, nil, nil, nil)
    end
    if @equip_item[@new_equip.index].active
      @actor = $game_party.actors[$game_temp.cms_index]
      # Get currently selected item
      item1 = $game_temp.equip_window.item
      item2 = @equip_item[@new_equip.index].item
      # Change equipment
      @actor.equip($game_temp.equip_index, item2 == nil ? 0 : item2.id)
      # Get parameters for after equipment change
      new_str = @actor.str
      new_atk = @actor.atk
      new_int = @actor.int
      new_agi = @actor.agi
      new_pdef = @actor.pdef
      new_mdef = @actor.mdef
      new_dex = @actor.dex
      # Return equipment
      @actor.equip($game_temp.equip_index, item1 == nil ? 0 : item1.id)
      # Draw in left window
      $game_temp.equip_window.set_new_parameters(new_str, new_atk, new_int, new_agi, new_pdef, new_mdef, new_dex)
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when equip item window is active)
  #--------------------------------------------------------------------------
  def update_equipitem
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Activate right window
      @equip_item[@new_equip.index].active = false
      @equip_item[@new_equip.index].index = 0
      @new_equip.active = true
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Play equip SE
      $game_system.se_play($data_system.equip_se)
      # Get currently selected data on the item window
      item = @equip_item[@new_equip.index].item
      # Change equipment
      @actor.equip(@new_equip.index, item == nil ? 0 : item.id)
      # Activate right window
      @new_equip.active = true
      @equip_item[@new_equip.index].active = false
      @equip_item[@new_equip.index].index = 0
      # Remake right window and item window contents
      @new_equip.refresh
      @equip_item[@new_equip.index].refresh
      @equip_description.refresh
      @actor_window.refresh
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when actor window is active)
  #--------------------------------------------------------------------------
  def update_actor
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      @actor_window.active = false
      @actor_window.index = 0
      @command_window.visible = true
      @command_window.active = true
      @playtime_background.visible = true
      @playtime_window.visible = true
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Play decisiion SE
      $game_system.se_play($data_system.decision_se)
      @actor_window.active = false
      @actor_window.visible = false
      @equip_item[0].visible = true
      @new_equip.active = true
      @equip_item_background.visible = true
      @equip_description.visible = true
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when actor skill window is active)
  #--------------------------------------------------------------------------
  def update_actor_skill
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      @actor_skillwindow.active = false
      @actor_skillwindow.index = 0
      @command_window.visible = true
      @command_window.active = true
      @command_window.index = 2
      @playtime_background.visible = true
      @playtime_window.visible = true
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      @actor_skillwindow.active = false
      @skill_window[@actor_skillwindow.index].help_window = @help_window
      @skill_window[@actor_skillwindow.index].visible = true
      @skill_window[@actor_skillwindow.index].active = true
      @skill_window[@actor_skillwindow.index].index = 0
      @actor_skillwindow.visible = false
      @skill_actor_window2[@actor_skillwindow.index].visible = true
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when item window is active)
  #--------------------------------------------------------------------------
  def update_item
    # If B button was pressed
    if @target_window.visible == false
      for i in 0...$game_party.actors.size - 1
        @target_cursor.visible = false
      end
    end
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to menu screen
      @item_window.visible = false
      @item_window.active = false
      @command_window.visible = true
      @command_window.active = true
      @help_window.visible = false
      @playtime_background.visible = true
      @playtime_window.visible = true
      @item_window.index = 0
      @command_window.index = 1
      return
    # If C button was pressed
    elsif Input.trigger?(Input::C)
      # Get currently selected data on the item window
      @item = @item_window.item
      # If not a use item
      unless @item.is_a?(RPG::Item)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # If it can't be used
      unless $game_party.item_can_use?(@item.id)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # If effect scope is an ally
      if @item.scope >= 3
        # Activate target window
        @item_window.active = false
        @target_window.visible = true
        @target_window.active = true
        @target_window.y = 0
        # Set cursor position to effect scope (single / all)
        if @item.scope == 4 || @item.scope == 6
          @target_window.index = -1
        else
          @target_window.index = 0
        end
      # If effect scope is other than an ally
      else
        # If command event ID is valid
        if @item.common_event_id > 0
          # Command event call reservation
          $game_temp.common_event_id = @item.common_event_id
          # Play item use SE
          $game_system.se_play(@item.menu_se)
          # If consumable
          if @item.consumable
            # Decrease used items by 1
            $game_party.lose_item(@item.id, 1)
            # Draw item window item
            @item_window.draw_item(@item_window.index)
          end
          # Switch to map screen
          $scene = Scene_Map.new
          return
        end
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when skill window is active)
  #--------------------------------------------------------------------------
  def update_skill
    if @target_window.visible == false
      for i in 0...$game_party.actors.size - 1
        @target_cursor_skill.visible = false
      end
    end
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      @skill_window[@actor_skillwindow.index].visible = false
      @skill_window[@actor_skillwindow.index].active = false
      @skill_window[@actor_skillwindow.index].index = 0
      @help_window.visible = false
      @skill_actor_window2[@actor_skillwindow.index].visible = false
      @actor_skillwindow.visible = true
      @actor_skillwindow.active = true
      # If C button was pressed
    elsif Input.trigger?(Input::C)
      @actor = $game_party.actors[@actor_skillwindow.index]
      # Get currently selected data on the skill window
      @skill = @skill_window[@actor_skillwindow.index].skill
      # If unable to use
      if @skill == nil or not @actor.skill_can_use?(@skill.id)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # If effect scope is ally
      if @skill.scope >= 3
        # Activate target window
        @skill_window[@actor_skillwindow.index].active = false
        @skill_window[@actor_skillwindow.index].visible = false
        @target_window.visible = true
        @target_window.active = true
        @target_window.y = -75
        # Set cursor position to effect scope (single / all)
        if @skill.scope == 4 || @skill.scope == 6
          @target_window.index = -1
        elsif @skill.scope == 7
          @target_window.index = @actor_index - 10
        else
          @target_window.index = 0
        end
      # If effect scope is other than ally
      else
        # If common event ID is valid
        if @skill.common_event_id > 0
          # Common event call reservation
          $game_temp.common_event_id = @skill.common_event_id
          # Play use skill SE
          $game_system.se_play(@skill.menu_se)
          # Use up SP
          @actor.sp -= @skill.sp_cost
          # Remake each window content
          @status_window.refresh
          @skill_window[@actor_skillwindow.index].refresh
          @target_window.refresh
          # Switch to map screen
          $scene = Scene_Map.new
          return
        end
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when target window is active)
  #--------------------------------------------------------------------------
  def update_target
    if @item_window.visible
      if @target_window.index < 0
        for i in 0...$game_party.actors.size - 1
          @target_cursor.visible = true
        end
      end
      # If B button was pressed
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # If unable to use because items ran out
        unless $game_party.item_can_use?(@item.id)
          # Remake item window contents
          @item_window.refresh
        end
        # Erase target window
        @item_window.active = true
        @target_window.visible = false
        @target_window.active = false
        return
      end
      # If C button was pressed
      if Input.trigger?(Input::C)
        # If items are used up
        if $game_party.item_number(@item.id) == 0
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # If target is all
        if @target_window.index == -1
          # Apply item effects to entire party
          used = false
          for i in $game_party.actors
            used |= i.item_effect(@item)
          end
        end
        # If single target
        if @target_window.index >= 0
          # Apply item use effects to target actor
          target = $game_party.actors[@target_window.index]
          used = target.item_effect(@item)
        end
        # If an item was used
        if used
          # Play item use SE
          $game_system.se_play(@item.menu_se)
          # If consumable
          if @item.consumable
            # Decrease used items by 1
            $game_party.lose_item(@item.id, 1)
            # Redraw item window item
            @item_window.draw_item(@item_window.index)
          end
          # Remake target window contents
          @target_window.refresh
          @actor_skillwindow.refresh
          @skill_actor_window2[@actor_skillwindow.index].refresh
          # If all party members are dead
          if $game_party.all_dead?
            # Switch to game over screen
            $scene = Scene_Gameover.new
            return
          end
          # If common event ID is valid
          if @item.common_event_id > 0
            # Common event call reservation
            $game_temp.common_event_id = @item.common_event_id
            # Switch to map screen
            $scene = Scene_Map.new
            return
          end
        end
        # If item wasn't used
        unless used
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
        end
        return
      end
    else
      if @target_window.index < 0
        for i in 0...$game_party.actors.size - 1
          @target_cursor_skill.visible = true
        end
      end
      # If B button was pressed
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # Erase target window
        @skill_window[@actor_skillwindow.index].active = true
        @skill_window[@actor_skillwindow.index].visible = true
        @target_window.visible = false
        @target_window.active = false
        return
      end
      # If C button was pressed
      if Input.trigger?(Input::C)
        # If unable to use because SP ran out
        unless @actor.skill_can_use?(@skill.id)
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # If target is all
        if @target_window.index == -1
          # Apply skill use effects to entire party
          used = false
          for i in $game_party.actors
            used |= i.skill_effect(@actor, @skill)
          end
        end
        # If target is user
        if @target_window.index <= -2
          # Apply skill use effects to target actor
          target = $game_party.actors[@target_window.index + 10]
          used = target.skill_effect(@actor, @skill)
        end
        # If single target
        if @target_window.index >= 0
          # Apply skill use effects to target actor
          target = $game_party.actors[@target_window.index]
          used = target.skill_effect(@actor, @skill)
        end
        # If skill was used
        if used
          # Play skill use SE
          $game_system.se_play(@skill.menu_se)
          # Use up SP
          @actor.sp -= @skill.sp_cost
          # Remake each window content
          @actor_skillwindow.refresh
          @skill_window[@actor_skillwindow.index].refresh
          @skill_actor_window2[@actor_skillwindow.index].refresh
          @target_window.refresh
          # If entire party is dead
          if $game_party.all_dead?
            # Switch to game over screen
            $scene = Scene_Gameover.new
            return
         end
          # If command event ID is valid
          if @skill.common_event_id > 0
            # Command event call reservation
            $game_temp.common_event_id = @skill.common_event_id
            # Switch to map screen
            $scene = Scene_Map.new
            return
          end
        end
        # If skill wasn't used
        unless used
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
        end
        return
      end
    end
  end 
end
#==============================================================================
# ** Window_IcoonCommands
#------------------------------------------------------------------------------
#  This class performs command processing.
#==============================================================================
class Window_IconCommands < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(210, 190, 220, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.index = 0
    self.z = 200
    @column_max = 6
    @item_max = 6
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.blt(4,5,RPG::Cache.icon(CT_Pictures::Icon_1), Rect.new(0,0,24,24))
    self.contents.blt(36,5,RPG::Cache.icon(CT_Pictures::Icon_2), Rect.new(0,0,24,24))
    self.contents.blt(68,5,RPG::Cache.icon(CT_Pictures::Icon_3), Rect.new(0,0,24,24))
    self.contents.blt(100,5,RPG::Cache.icon(CT_Pictures::Icon_4), Rect.new(0,0,24,24))
    self.contents.blt(132,5,RPG::Cache.icon(CT_Pictures::Icon_5), Rect.new(0,0,24,24))
    self.contents.blt(164,5,RPG::Cache.icon(CT_Pictures::Icon_6), Rect.new(0,0,24,24))
  end
  #--------------------------------------------------------------------------
  # * Cursor Rectangle Update
  #--------------------------------------------------------------------------
  def update_cursor_rect
    self.cursor_rect.set(@index * 32, 1, 32, 32)
  end
end
#==============================================================================
# ** Window_Actors
#------------------------------------------------------------------------------
#  This class is for choosing an actor to be equipped
#==============================================================================
class Window_Actors < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(30, 21, 350, 450)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.index = 0
    self.z += 50
    self.active = false
    self.opacity = 0
    @item_max = $game_party.actors.size
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.size = 18
    self.contents.font.bold = true
    self.contents.blt(0, 0, RPG::Cache.picture(CT_Pictures::Actor_bg_inactive), Rect.new(0,0,270,409))
    self.contents.blt(0, @index * 102, RPG::Cache.picture(CT_Pictures::Actor_bg), Rect.new(0,0,270,102))
    $game_temp.cms_index = @old_index = @index
    for i in 0...$game_party.actors.size
      actor = $game_party.actors
      y  = i * 102
      pow = actor.str + actor.atk
      self.contents.draw_text(14, y, 100, 32, actor.name)
      self.contents.draw_text(154, y, 100, 32, "LV #{actor.level}")
      self.contents.draw_text(60, y + 65, 100, 32, "#{pow}")
      self.contents.draw_text(210, y + 65, 100, 32, "#{actor.pdef}")
      draw_actor_hp(actor, 14, y + 20)
      draw_actor_sp(actor, 14, y + 40)
      self.contents.blt(14, y + 70, RPG::Cache.icon($data_weapons[actor.weapon_id] == nil ? CT_Pictures::Weapon_alternative : $data_weapons[actor.weapon_id].icon_name), Rect.new(0,0,24,24))
      self.contents.blt(174, y + 70, RPG::Cache.icon($data_armors[actor.armor1_id] == nil ? CT_Pictures::Shield_alternative : $data_armors[actor.armor1_id].icon_name), Rect.new(0,0,24,24))
    end
  end
  #--------------------------------------------------------------------------
  # * Cursor


The new generation will go to the distance... Will the distance between us smallen?