Monster Album
#1
Monster Album
Version 4.0
by El Conductor
Aug 4, 2007

This is a locked, two-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


This bestiary was more or less modeled after the Wild Arms 2 monster
album, but of course mine is a little different. The player also has a monster
hunter rank in this script, which can be used for many purposes in the
game. The more different kinds monsters the player kills, the higher the rank.
Here is the script. Happy hunting!

Alright this script which was left in the dark for a long time has finally gotten it's
due upgrades! Monster Album hits version 4.0!

Code:
################################################################################
#                              Monster Album 4.0                               #
################################################################################
# Author: El Conducter                                                         #
# Date: August/3/07                                                            #
# Last Update: July/15/08                                                      #
# Version: 4.0                                                                 #
################################################################################
#----------------------------------------------------------------------------
#   About Update: 2.0
#     Alright, nearly a year after its first release I have updated this script.
#     This was one of my earlier scripts, so there was a few things that could
#     have been done better. I have taken care of such issues and added to it.
#     It was the only script that never had an update, however it turned out to
#     be one of my more popular scripts. So here is the much needed update.
#
#   About Update: 3.0
#     Alright, with this update my Album script will be the most comprehensive.
#     bestiary I have done. Nothing is secret about your enemies now. The enemy
#     attribute weaknesses are now color coded for easier readability. To make
#     things easier I even used the Color Module I created for my HP Bar Script.
#     It makes it easy for you to alter and add colors as you so wish. Aside
#     from being able to see enemy attribute weakneses you can now also see their
#     abilities, and scroll with L and R to a different monster while in the
#     monster window. Rather than having all the attributes or skills crammed in
#     a single window, you can now select which you would like to see from a new
#     command window.
#
#   About Update: 4.0
#     This powerful Bestiary script has gotten even better. In addition to
#     viewing enemy attributes and skills, you can now test fight the monster
#     from the Album! I had to pull some clever coding tricks to make this work
#     without doing something drastic or complicated, like rewriting and/or
#     altering many other Classes. I proved I could pull a monster out of a hat.
#     I have also added a feature that allows you to hide enemy statistics for
#     certian enemies of your choosing. Perhaps Boss enemies or whatever.
#----------------------------------------------------------------------------

#----------------------------------------------------------------------------
#   What it Does:
#     This script basically creates a catalogue of monsters you've killed.
#     You are also given a monster hunter rank based on how many
#     different monsters have been defeated. The catalogue displays all
#     the monsters attributes & picture, player rank, and percent of album
#     completion. See above for info on updates.
#----------------------------------------------------------------------------

#----------------------------------------------------------------------------
#   How it Works:
#    
#     Okay for version 2.0 I recreated the way a few things work, but don't worry
#     the changes are for the better. I made an independant Monster_Album class
#     to deal with all the album related tasks, rather than just having modded
#     several other classes to share the work, like version 1.0. Because of this
#     new system it gives us greater flexibility to do things. I also cleaned up
#     some messy code in other classes, though there still is some that I will
#     contend with in a later update.
#    
#     Scripts used are:
#
#       Section I: Album Scene and related Windows
#            - Scene_Album
#            - Window_Album_Right
#            - Window_Monster_List
#            - Window_Monster_Picture
#            - Window_Album_Command
#            - Window_Total
#
#       Section II: Extra Windows
#            - Window_Base
#            - Window_Command2
#
#       Section III: Dependancies
#            - Game_Troop
#            - Scene_Menu
#            - Scene_Battle
#
#       Section IV: Data Management
#            - Scene_Title
#            - Scene_Save
#            - Scene_Load
#
#       Section V: Modules
#            - Module Color
#----------------------------------------------------------------------------

#----------------------------------------------------------------------------
#   How to Use This Script:
#     Just copy it and paste it above Main.
#
#     If you are going to use events to call the album menu, use Call Script:
#     $scene = Scene_Album.new
#
#     You can use an item to call the menu as well. Just make the item call a
#     Common Event, and make the Common Event do the above task.
#    
#     You can also access the Albums hunter rank in game by using:
#
#     $game_album.rank
#
#     Accessing it is now a bit easier than with version 1.0. It had a dumb way
#     operating. Also you now add enemies to the Album anytime in game with
#     a Call Script like this:
#
#     $game_album.add_enemy_killed($data_enemies[N])
#
#     Where N is, put the ID of the monster you want to add.
#
#     To Hide enemy stats in the album, got to Game_Album class and look for
#     the @black_list array. Put the ID's of the enemies you want hidden in it.
#----------------------------------------------------------------------------

#----------------------------------------------------------------------------
#   Script Conflicts and Compatability:
#     This is an Advisory for those of you using multiple scripts. If you are
#     using other scripts that rewrite the same classes or methods as this one,
#     there may be a conflict and things will work incorrectly in unpredictable
#     ways. I put all the Classes that could cause conflicts in the Utilities
#     Section III.
#
#     To remedy a script conflict, the pieces of the classes or methods that
#     overwrite each other must be combined.
#
#     Script conflicts are a major issue with many users. I get many messages
#     form those having problems. Almost always it is due to script conflicts.
#     Ocassionally I offer quick tips, fixes, and instructions  to get them to
#     work. However, as my time is limited, I can't always provide help on an
#     individual basis.
#----------------------------------------------------------------------------

#----------------------------------------------------------------------------
#  Comments:
#    I hope my script is easy for you to use and modify. Study this
#    script to learn RGSS better and become a better scriptor yourself.  
#----------------------------------------------------------------------------

#==============================================================================
#  Section I: Album Classes
#==============================================================================

#==============================================================================
# ** Game_Album
#------------------------------------------------------------------------------
#  This class handles the Bestairy.
#==============================================================================

class Game_Album
  #--------------------------------------------------------------------------
  # * Constant: Add or remove enemy ID's you want to have hidden in the Album
  #--------------------------------------------------------------------------
  BLACK_LIST = [22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :seen           # Array of enemies seen but not killed
  attr_reader   :killed         # Array of enemies actually killed in battle
  attr_reader   :rank           # String to contain rank title
  attr_reader   :percent        # Percent of Album completion
  attr_reader   :test_enemy_id  # ID of enemy to be tested in battle
  attr_reader   :black_list     # Array of enemy ID's to be hidden
  attr_accessor :battle_test    # Whether the impending fight is album related
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    # Set seen & killed variables to blank arrays for new album
    @seen = []
    @killed = []
    for i in 1...$data_enemies.size
      @killed.push(nil)
      @seen.push(nil)
    end
    @rank = 'none'
    @percent = 0
    @test_enemy_id = 0
    @battle_test = false
  end
  #--------------------------------------------------------------------------
  # * add_enemy_seen
  #--------------------------------------------------------------------------
  def add_enemy_seen(enemy)
    # Use enemy ID - 1 for correct index placement in the array
    index = enemy.id - 1
    # The following replaces the nil object with the enemy at the index
    @seen.insert(index, enemy)
    @seen.delete_at(enemy.id)
    determine_rank
  end
  #--------------------------------------------------------------------------
  # * add_enemy_killed
  #--------------------------------------------------------------------------
  def add_enemy_killed(enemy)
    # Use enemy ID - 1 for correct index placement in the array
    index = enemy.id - 1
    # The following replaces the nil object with the enemy at the index
    @killed.insert(index, enemy)
    @killed.delete_at(enemy.id)
    determine_rank
  end
  #--------------------------------------------------------------------------
  # * Determine party's rank title for album completion
  #--------------------------------------------------------------------------
  def determine_rank
    # First check to see if the player has seen more enemies than killed
    if @seen.nitems > @killed.nitems
      # Assign rank and end rank check
      @rank = 'Observer'
      return
    end
    # Get percent of enemies killed over total amount of enemies in game
    # -1 to make up for nil in $data_enemies array
    @percent = ((@killed.nitems * 100) / ($data_enemies.size - 1))
    # Change player rank according to percent
    case @percent
    when 1..25                  # When up to 25%
      @rank = 'Adventurer'
    when 26..50                 # When 26% to 50%
      @rank = 'Slayer'
    when 51..75                 # When 51% to 75%
      @rank = 'Monster Hunter'
    when 76..99                 # When 76% to 99%
      @rank = 'Beast Master'
    when 100                    # When 100%
      @rank = 'Perfectionist'
    end
  end
  #--------------------------------------------------------------------------
  # * has_seen_enemy? Checks if enemy is included in the @seen array
  #--------------------------------------------------------------------------
  def has_seen_enemy?(enemy)
    return @seen.include?(enemy)
  end
  #--------------------------------------------------------------------------
  # * has_killed_enemy? Checks if enemy is included in the @killed array
  #--------------------------------------------------------------------------
  def has_killed_enemy?(enemy)
    return @killed.include?(enemy)
  end
  #--------------------------------------------------------------------------
  # * enemy_blacklisted? Checks if ID is included among the enemy ID's to hide
  #--------------------------------------------------------------------------
  def enemy_blacklisted?(enemy_id)
    return BLACK_LIST.include?(enemy_id)
  end
  #--------------------------------------------------------------------------
  # * Simple search algorithym
  #   Checks all the troops for the latest one that contains the given enemy ID
  #--------------------------------------------------------------------------
  def soul_searcher(id)
    # Set ID of enemy to be 'singled out' for battle later
    @test_enemy_id = id
    # Look through all the $data_troops array
    for i in 1...$data_troops.size
      # In current troop, look through all the members for the enemy ID
      for j in 0...$data_troops[i].members.size
        # If the enemy ID being searched is within this troop
        if $data_troops[i].members[j].enemy_id == id
          # Set this variable to that troop ID to be returned & Break the search
          troop = $data_troops[i]
          break
        end
      end
    end
    return troop.id
  end
  #--------------------------------------------------------------------------
  # * Initiates a combat
  #--------------------------------------------------------------------------
  def start_battle
    # Set album battle test flag to true
    @battle_test = true
    # Play battle start SE
    $game_system.se_play($data_system.battle_start_se)
    # Play battle BGM
    $game_system.bgm_play($game_system.battle_bgm)
    # Switch to battle screen
    $scene = Scene_Battle.new
  end
end

#==============================================================================
# ** Scene_Album
#------------------------------------------------------------------------------
#  This class handles the monster album windows.
#==============================================================================

class Scene_Album
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Set up windows used in this scene
    # Set window of monster names currently known
    @monster_list_window = Window_Album_List.new
    # Get monster currently selected in window list
    @monster = @monster_list_window.monster
    # Make window that shows current selected monster's stats
    @monster_info_window = Window_Album_Right.new(@monster)
    # Make info window of album completion
    @total_window = Window_Total.new
    # Make monster window
    @monster_window = Window_Monster_Picture.new(@monster)
    @monster_window.visible = false
    # Make monster command window
    @command_window = Window_Album_Command.new(['Elements', 'States',
    'Abilities', 'Battle'])
    @command_window.visible = false
    @command_window.active = false
    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
    @monster_info_window.dispose
    @monster_list_window.dispose
    @total_window.dispose
    @monster_window.dispose
    @command_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Refresh Method
  #--------------------------------------------------------------------------
  def refresh
    # Set the variable @monster equal to the currently selected monster
    @monster = @monster_list_window.monster
    # Set info window's monster to the selected monster
    @monster_info_window.set_new_monster(@monster)
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows conditionally
    # If monster list window is active: call update_list
    if @monster_list_window.active
      update_list
      return
    end
    # If monster command window is active: call update_command
    if @command_window.visible
      update_command
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when monster list window is active)
  #--------------------------------------------------------------------------
  def update_list
    @monster_list_window.update
    refresh
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to menu screen
      @monster_list_window.active = false
      $scene = Scene_Menu.new(0)
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      if @monster != nil
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Activate monster window
        @monster_list_window.active = false
        @monster_list_window.visible = false
        @monster_info_window.visible = false
        @total_window.visible = false
        @monster_window.visible = true
        @monster_window.get_new_monster(@monster)
        @monster_window.draw_enemy_elementals
        @command_window.visible = true
        @command_window.active = true
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when monster command window is active)
  #--------------------------------------------------------------------------
  def update_command
    @command_window.update
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Go back to monster list
      @monster_list_window.active = true
      @monster_list_window.visible = true
      @monster_window.visible = false
      @monster_info_window.visible = true
      @total_window.visible = true
      @command_window.index = 0
      @command_window.active = false
      @command_window.visible = false
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.index
      when 0  # Elementals
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Draw enemy elemental attributes
        @monster_window.draw_enemy_elementals
      when 1  # States
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Draw enemy states info
        @monster_window.draw_enemy_states
      when 2  # Abilities
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Draw enemy abilitites
        @monster_window.draw_enemy_actions
      when 3  # Battle
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Set current battle to troop ID returned by soul searcher algorithym
        $game_temp.battle_troop_id = $game_album.soul_searcher(@monster.id)
        # Then tell the album to begin steps to initiate a fight
        $game_album.start_battle
      end
      return
    end
    # If L button was pressed
    if Input.trigger?(Input::L)
      # Don't let the index go above the enemy list
      unless @monster_list_window.index == 0
        @monster_list_window.index -= 1
      end
      refresh
      if @monster != nil
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Inform Monster window of new monster and redraw stats
        @monster_window.get_new_monster(@monster)
        @monster_window.draw_enemy_elementals
      end
      return
    end
    # If R button was pressed
    if Input.trigger?(Input::R)
      # Don't let the index go past the enemy list
      unless @monster_list_window.index == $game_album.killed.size - 1
        @monster_list_window.index += 1
      end
      refresh
      if @monster != nil
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Inform Monster window of new monster and redraw stats
        @monster_window.get_new_monster(@monster)
        @monster_window.draw_enemy_elementals
      end
      return
    end
  end
end

#==============================================================================
# ** Window_Album_List
#------------------------------------------------------------------------------
#  The list of monster names.
#==============================================================================

class Window_Album_List < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 64, 240, 416)
    @column_max = 1
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Monster Acquisition
  #--------------------------------------------------------------------------
  def monster
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    # For every enemy in the album, a address of them to @data
    for i in 0...$game_album.killed.size
        @data.push($game_album.killed[i])
    end
    # If item count is not 0, make a bitmap and draw all items
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #--------------------------------------------------------------------------
  def draw_item(index)
    monster = @data[index]
    x = 4
    y = index * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    opacity = self.contents.font.color == normal_color ? 255 : 128
    # If the current index is nil, then use ?'s for monster name and disable
    if monster == nil
      self.contents.font.color = disabled_color
      self.contents.draw_text(x+50, y, 204, 32, '????????', 0)
      self.contents.font.color = system_color
      self.contents.draw_text(x, y, 204, 32, '???', 0)
    else
      self.contents.font.color = normal_color
      self.contents.draw_text(x+50, y, 204, 32, monster.name, 0)
      self.contents.font.color = system_color
      self.contents.draw_text(x, y, 204, 32, sprintf("%03d", monster.id.to_s), 0)
    end
  end
end

#==============================================================================
# ** Window_Album_Right
#------------------------------------------------------------------------------
#  This window shows monster attributes.
#==============================================================================

class Window_Album_Right < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(enemy)
    super(241, 64, 400, 416)
    self.contents = Bitmap.new(width - 32, height - 32)
    @enemy = enemy
    self.opacity = 0   # Increase this if you want to see the window
    refresh
  end
  #--------------------------------------------------------------------------
  # * Set parameters for monster
  #--------------------------------------------------------------------------
  def set_new_monster(new_monster)
    if @enemy != new_monster
      @enemy = new_monster
      refresh
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    if @enemy != nil
      draw_enemy_picture(@enemy, 190, 208)
      draw_enemy_exp(@enemy, 4, 50)
      draw_enemy_gold(@enemy, 4, 100)
      draw_enemy_name(@enemy, 2, 0, normal_color)
      draw_enemy_stats(@enemy, 4, 220, $game_album.enemy_blacklisted?(@enemy.id))
    end
  end
end

#==============================================================================
# ** Window_Monster_Total
#------------------------------------------------------------------------------
#  Shows album completion.
#==============================================================================

class Window_Total < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 200, 32, "Bestiary Completion :")
    self.contents.draw_text(370, 0, 200, 32, "Rank :")
    self.contents.font.color = normal_color
    self.contents.draw_text(200, 0, 200, 32, $game_album.killed.nitems.to_s + ' / ')
    self.contents.draw_text(240, 0, 200, 32, ($data_enemies.size - 1).to_s + " : ")
    self.contents.draw_text(295, 0, 200, 32, $game_album.percent.to_s + "%")
    self.contents.draw_text(430, 0, 200, 32, $game_album.rank)
  end
end

#==============================================================================
# ** Window_Monster_Picture
#------------------------------------------------------------------------------
#  This window shows a bigger picture of the monster with name.
#==============================================================================

class Window_Monster_Picture < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(enemy)
    super(0, 0, 640, 420) #480
    self.contents = Bitmap.new(width - 32, height - 32)
    @enemy = enemy
    refresh
  end
  #--------------------------------------------------------------------------
  # * Set parameters for monster
  #--------------------------------------------------------------------------
  def get_new_monster(new_monster)
    if @enemy != new_monster
      @enemy = new_monster
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    if @enemy != nil
    draw_enemy_picture2(@enemy)
    draw_enemy_name(@enemy, 4, 4, system_color)
    end
  end
  #--------------------------------------------------------------------------
  # * Draws enemy's elementals chart
  #--------------------------------------------------------------------------
  def draw_enemy_elementals
    refresh
    x = 4
    y = 4
    # Change color and font size
    self.contents.font.color = system_color
    self.contents.font.size = 20
    # Draw text
    self.contents.draw_text(x, y + 32, 100, 22, "Elements:")
    self.contents.font.size = 18
    self.contents.draw_text(x, y + 54, 50, 22, "Absorb:")
    self.contents.draw_text(x + 75, y + 54, 50, 22, "Strong:")
    self.contents.draw_text(x + 150, y + 54, 50, 22, "Weak:")
    self.contents.draw_text(x + 225, y + 54, 50, 22, "Poor:")
    # Change color and font size
    self.contents.font.color = normal_color
    self.contents.font.size = 16
    # unless the enemy info is hidden
    unless $game_album.enemy_blacklisted?(@enemy.id)
    # Draw the attributes names in position determined by attribute strength
    for i in 1...@enemy.element_ranks.xsize
      if @enemy.element_ranks[i] == 6
        self.contents.font.color = Colors::GREEN
        self.contents.draw_text(x, 16 * i + 76, 120, 16, $data_system.elements[i])
      end
      if @enemy.element_ranks[i] == 5
        self.contents.font.color = Colors::INDIGO
        self.contents.draw_text(x + 75, 16 * i + 76, 120, 16, $data_system.elements[i])
      end
      if @enemy.element_ranks[i] == 2
        self.contents.font.color = Colors::ORANGE
        self.contents.draw_text(x + 150, 16 * i + 76, 120, 16, $data_system.elements[i])
      end
      if @enemy.element_ranks[i] == 1
        self.contents.font.color = Colors::RED
        self.contents.draw_text(x + 225, 16 * i + 76, 120, 16, $data_system.elements[i])
      end
    end
    end
  end
  #--------------------------------------------------------------------------
  # * Draws enemy's States chart
  #--------------------------------------------------------------------------
  def draw_enemy_states
    refresh
    x = 4#300
    y = 4
    # Change color and font size
    self.contents.font.color = system_color
    self.contents.font.size = 20
    # Draw text
    self.contents.draw_text(x, y + 32, 100, 22, "States:")
    self.contents.font.size = 18
    self.contents.draw_text(x, y + 54, 50, 22, "Null:")
    self.contents.draw_text(x + 75, y + 54, 50, 22, "Strong:")
    self.contents.draw_text(x + 150, y + 54, 50, 22, "Weak:")
    self.contents.draw_text(x + 225, y + 54, 50, 22, "Poor:")
    # Change color and font size
    self.contents.font.color = normal_color
    self.contents.font.size = 16
    # unless the enemy info is hidden
    unless $game_album.enemy_blacklisted?(@enemy.id)
    # Draw the state names in position determined by attribute strength
    for i in 1...@enemy.state_ranks.xsize
      if @enemy.state_ranks[i] == 6
        self.contents.font.color = Colors::BLACK
        self.contents.draw_text(x, 16 * i + 76, 75, 16, $data_states[i].name)
      end
      if @enemy.state_ranks[i] == 5
        self.contents.font.color = Colors::VIOLET
        self.contents.draw_text(x + 75, 16 * i + 76, 75, 16, $data_states[i].name)
      end
      if @enemy.state_ranks[i] == 2
        self.contents.font.color = Colors::YELLOW
        self.contents.draw_text(x + 150, 16 * i + 76, 75, 16, $data_states[i].name)
      end
      if @enemy.state_ranks[i] == 1
        self.contents.font.color = Colors::RED
        self.contents.draw_text(x + 225, 16 * i + 76, 75, 16, $data_states[i].name)
      end
    end
    end
  end
  #--------------------------------------------------------------------------
  # * Draws enemy's States chart
  #--------------------------------------------------------------------------
  def draw_enemy_actions
    refresh
    x = 4
    y = 4
    # Change color and font size
    self.contents.font.color = system_color
    self.contents.font.size = 20
    # Draw text
    self.contents.draw_text(x, y + 32, 100, 22, "Actions:")
    # Change color and font size
    self.contents.font.color = normal_color
    # unless the enemy info is hidden
    unless $game_album.enemy_blacklisted?(@enemy.id)
    # Draw the names of the actions the enemy can perform
    for i in 0...@enemy.actions.size
      # If the action is not a skill
      if @enemy.actions[i].kind == 0
        # Draw text that corresponds to action basic type
        case @enemy.actions[i].basic
        when 0
          self.contents.draw_text(x, 24 * i + 76, 200, 24, 'Attack')
        when 1
          self.contents.draw_text(x, 24 * i + 76, 200, 24, 'Defend')
        when 2
          self.contents.draw_text(x, 24 * i + 76, 200, 24, 'Escape')
        when 3
          self.contents.draw_text(x, 24 * i + 76, 200, 24, 'Do Nothing')
        end
        # Other wise if actions is a skill, draw the name of the skill
      elsif @enemy.actions[i].kind = 1
        ability = $data_skills[@enemy.actions[i].skill_id].name
        self.contents.draw_text(x, 24 * i + 76, 200, 24, ability)
      end
    end
    end
  end
end

#==============================================================================
# ** Window_Album_Command
#==============================================================================

class Window_Album_Command < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     width    : window width
  #     commands : command text string array
  #--------------------------------------------------------------------------
  def initialize(commands)
    super(0, 420, 640, 60)
    @item_max = commands.size
    @commands = commands
    @column_max = 4
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i, normal_color)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index, color)
    self.contents.font.color = color
    x = 4 + index * 160
    self.contents.draw_text(x, 0, 160, 32, @commands[index])
  end
  #--------------------------------------------------------------------------
  # * Disable Item
  #     index : item number
  #--------------------------------------------------------------------------
  def disable_item(index)
    draw_item(index, disabled_color)
  end
end

#==============================================================================
#  Section II: Dependancy WIndows
#==============================================================================

#==============================================================================
# ** Window_Command2
#------------------------------------------------------------------------------
#  This version of command window is a set size with scrolling commands.
#==============================================================================

class Window_Command2 < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     width    : window width
  #     commands : command text string array
  #--------------------------------------------------------------------------
  def initialize(width, commands)
    super(0, 0, width, 224)
    @item_max = commands.size
    @commands = commands
    self.contents = Bitmap.new(width - 32, @item_max * 32)
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i, normal_color)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #     color : text color
  #--------------------------------------------------------------------------
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[index])
  end
  #--------------------------------------------------------------------------
  # * Disable Item
  #     index : item number
  #--------------------------------------------------------------------------
  def disable_item(index)
    draw_item(index, disabled_color)
  end
end

#==============================================================================
# ** Window_Base
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Draws enemy's picture
  #--------------------------------------------------------------------------
  def draw_enemy_picture(enemy, x, y)
    bitmap = RPG::Cache.battler(enemy.battler_name, enemy.battler_hue)
    x2 = bitmap.width
    y2 = bitmap.height
    x3 = x2 / 2
    y3 = y2 - 120
    src_rect = Rect.new(0, 0, x2, y2)
    # If enemy height is greater than 220, draw the picture lower on the screen
    if bitmap.height > 220
      self.contents.blt(x - x3, y - y3, bitmap, src_rect)
    else
      self.contents.blt(x - x3, y - y2, bitmap, src_rect)
    end
  end
  #--------------------------------------------------------------------------
  # * Draws enemy's large picture
  #--------------------------------------------------------------------------
  def draw_enemy_picture2(enemy)
    bitmap = RPG::Cache.battler(enemy.battler_name, enemy.battler_hue)
    x2 = bitmap.width
    y2 = bitmap.height
    x3 = 398 - bitmap.width
    y3 = 398 - bitmap.height
    src_rect = Rect.new(0, 0, x2, y2)
    if x3 <= y3
     new_rect = Rect.new(200, 20, x2 + x3, y2 + x3)
    else
     new_rect = Rect.new(200, 20, x2 + y3, y2 + y3)
    end
    self.contents.stretch_blt(new_rect, bitmap, src_rect, 50)
  end
  #--------------------------------------------------------------------------
  # * Draws enemy's name
  #--------------------------------------------------------------------------
  def draw_enemy_name(enemy, x, y, color)
    self.contents.font.color = color
    self.contents.font.size = 24
    self.contents.draw_text(x, y, 400, 32, enemy.name)
  end
  #--------------------------------------------------------------------------
  # * Draws enemy's gold
  #--------------------------------------------------------------------------
  def draw_enemy_gold(enemy, x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 100, 32, "Money")
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 24, y, 84, 32, enemy.gold.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # * Draws enemy's exp
  #--------------------------------------------------------------------------
  def draw_enemy_exp(enemy, x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 32, 32, "EXP")
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 24, y, 84, 32, enemy.exp.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # * Draws enemy's statistics
  #--------------------------------------------------------------------------
  def draw_enemy_stats(enemy, x, y, hidden)
    # Change color
    self.contents.font.color = system_color
    # Draw text
    self.contents.draw_text(x, y, 32, 32, "HP")
    self.contents.draw_text(x + 200, y, 32, 32, "SP")
    self.contents.draw_text(x, y + 26, 32, 32, "Atk")
    self.contents.draw_text(x + 200, y + 26, 32, 32, "Str")
    self.contents.draw_text(x, y + 52, 60, 32, "Def")
    self.contents.draw_text(x + 200, y + 52, 32, 32, "Mdf")
    self.contents.draw_text(x, y + 78, 32, 32, "Dex")
    self.contents.draw_text(x + 200, y + 78, 32, 32, "Int")
    self.contents.draw_text(x, y + 104, 32, 32, "Agi")
    self.contents.draw_text(x + 200, y + 104, 32, 32, "Eva")
    self.contents.draw_text(x, y + 130, 125, 32, "Item Dropped :")
    self.contents.draw_text(x, y - 65, 100, 32, "Drop Rate :")
    # Change color
    self.contents.font.color = normal_color
    # Draw stats, draw ?'s if enemy is hidden
    if hidden
      self.contents.draw_text(x + 40, y, 84, 32, '???', 2)
      self.contents.draw_text(x + 240, y, 84, 32, '???', 2)
      self.contents.draw_text(x + 40, y + 26, 84, 32, '???', 2)
      self.contents.draw_text(x + 240, y + 26, 84, 32, '???', 2)
      self.contents.draw_text(x + 40, y + 52, 84, 32, '???', 2)
      self.contents.draw_text(x + 240, y + 52, 84, 32, '???', 2)
      self.contents.draw_text(x + 40, y + 78, 84, 32, '???', 2)
      self.contents.draw_text(x + 240, y + 78, 84, 32, '???', 2)
      self.contents.draw_text(x + 40, y + 104, 84, 32, '???', 2)
      self.contents.draw_text(x + 240, y + 104, 84, 32, '???', 2)
    else
      self.contents.draw_text(x + 40, y, 84, 32, enemy.maxhp.to_s, 2)
      self.contents.draw_text(x + 240, y, 84, 32, enemy.maxsp.to_s, 2)
      self.contents.draw_text(x + 40, y + 26, 84, 32, enemy.atk.to_s, 2)
      self.contents.draw_text(x + 240, y + 26, 84, 32, enemy.str.to_s, 2)
      self.contents.draw_text(x + 40, y + 52, 84, 32, enemy.pdef.to_s, 2)
      self.contents.draw_text(x + 240, y + 52, 84, 32, enemy.mdef.to_s, 2)
      self.contents.draw_text(x + 40, y + 78, 84, 32, enemy.dex.to_s, 2)
      self.contents.draw_text(x + 240, y + 78, 84, 32, enemy.int.to_s, 2)
      self.contents.draw_text(x + 40, y + 104, 84, 32, enemy.agi.to_s, 2)
      self.contents.draw_text(x + 240, y + 104, 84, 32, enemy.eva.to_s, 2)
    end
    # If enemy has a weapon, draw its name and icon
    if enemy.weapon_id > 0
     bitmap = RPG::Cache.icon($data_weapons[enemy.weapon_id].icon_name)
     self.contents.blt(x + 140, y + 135, bitmap, Rect.new(0, 0, 24, 24))
     self.contents.draw_text(x + 140, y + 130, 200, 32, ($data_weapons[(enemy.weapon_id)].name).to_s, 2)
     self.contents.draw_text(x + 95, y - 65, 50, 32, enemy.treasure_prob.to_s + "%", 2)
    end
    # If enemy has a piece armor, draw its name and icon
    if enemy.armor_id > 0
     bitmap = RPG::Cache.icon($data_armors[enemy.armor_id].icon_name)
     self.contents.blt(x + 140, y + 135, bitmap, Rect.new(0, 0, 24, 24))
     self.contents.draw_text(x + 140, y + 130, 200, 32, ($data_armors[(enemy.armor_id)].name).to_s, 2)
     self.contents.draw_text(x + 95, y - 65, 50, 32, enemy.treasure_prob.to_s + "%", 2)
    end
    # If enemy has an item, draw its name and icon
    if enemy.item_id > 0
     bitmap = RPG::Cache.icon($data_items[enemy.item_id].icon_name)
     self.contents.blt(x + 140, y + 135, bitmap, Rect.new(0, 0, 24, 24))
     self.contents.draw_text(x + 140, y + 130, 200, 32, ($data_items[(enemy.item_id)].name).to_s, 2)
     self.contents.draw_text(x + 95, y - 65, 50, 32, enemy.treasure_prob.to_s + "%", 2)
    end
  end
end

#==============================================================================
# Section III: Dependancy Classes
#==============================================================================

#==============================================================================
# ** Game_Troop
#==============================================================================

class Game_Troop
  #--------------------------------------------------------------------------
  # * enemy single out algorithym
  #   Filters out a single enemy of the specified ID
  #--------------------------------------------------------------------------
  def single_out_enemy(id)
    # Set variable to false.
    # Later this will be set to true when the first enemy ID is found
    has_been_singled = false
    # Sort out array yo make it easlier to search
    @enemies.sort! {|a, z| a.id <=> z.id}
    # Reverse the sorted array if first index is greater than ID to be searched
    if @enemies[0].id > id
      @enemies.reverse!
    end
    # Scroll through all the enemies in the array and check the following
    for enemy in @enemies
      # Do the next check if the current enemy isn't hidden or dead
      unless enemy.hidden or enemy.dead?
        # Find one enemy of the specified ID, and get rid of the rest
        if enemy.id != id or (enemy.id == id and has_been_singled)
          enemy.escape
        else
          has_been_singled = true
        end
      end
    end
  end
  
end

#==============================================================================
# ** Scene_Battle (part 1 & 2)
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  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)
    # if this battle is a album test fight, single out the enemy being tested
    if $game_album.battle_test
      $game_troop.single_out_enemy($game_album.test_enemy_id)
    end
    # 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.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
  #--------------------------------------------------------------------------
  # * Frame Update (party command phase: escape)
  #--------------------------------------------------------------------------
  def update_phase2_escape
    # Calculate enemy agility average
    enemies_agi = 0
    enemies_number = 0
    for enemy in $game_troop.enemies
      if enemy.exist?
        enemies_agi += enemy.agi
        enemies_number += 1
      end
    end
    if enemies_number > 0
      enemies_agi /= enemies_number
    end
    # Calculate actor agility average
    actors_agi = 0
    actors_number = 0
    for actor in $game_party.actors
      if actor.exist?
        actors_agi += actor.agi
        actors_number += 1
      end
    end
    if actors_number > 0
      actors_agi /= actors_number
    end
    # Determine if escape is successful
    success = rand(100) < 50 * actors_agi / enemies_agi
    # If escape is successful
    if success
      #
      for enemy in $game_troop.enemies
        # Set enemy to a local variable based on $data_enemies
        monster = $data_enemies[enemy.id]
        # Check if any enemies were killed before the escape AND
        # if so, also check if the monster isn't already in the album
        if enemy.dead? && !$game_album.killed.include?(monster)
          $game_album.add_enemy_killed(monster)
        end
        # If enemy hasn't already been seen, then add it to the @seen array
        if !$game_album.seen.include?(monster)
          $game_album.add_enemy_seen(monster)
        end
      end
      # Play escape SE
      $game_system.se_play($data_system.escape_se)
      # Return to BGM before battle started
      $game_system.bgm_play($game_temp.map_bgm)
      # Battle ends
      battle_end(1)
    # If escape is failure
    else
      # Clear all party member actions
      $game_party.clear_actions
      # Start main phase
      start_phase4
    end
  end
  #--------------------------------------------------------------------------
  # * Start After Battle Phase
  #--------------------------------------------------------------------------
  def start_phase5
    # Shift to phase 5
    @phase = 5
    # Play battle end ME
    $game_system.me_play($game_system.battle_end_me)
    # Return to BGM before battle started
    $game_system.bgm_play($game_temp.map_bgm)
    # Initialize EXP, amount of gold, and treasure
    exp = 0
    gold = 0
    treasures = []
    # Check if game battle test flag is on or not before giving EXP and such
    if $game_album.battle_test
      # Set album battle test flag to false
      $game_album.battle_test = false
    else
      # Loop
      for enemy in $game_troop.enemies
        # If enemy is not hidden
        unless enemy.hidden
          # If the bestairy doesn't already have this monster, then add it
          monster = $data_enemies[enemy.id]
          if !$game_album.killed.include?(monster)
            $game_album.add_enemy_killed(monster)
          end
          if !$game_album.seen.include?(monster)
            $game_album.add_enemy_seen(monster)
          end
          # Add EXP and amount of gold obtained
          exp += enemy.exp
          gold += enemy.gold
          # Determine if treasure appears
          if rand(100) < enemy.treasure_prob
            if enemy.item_id > 0
              treasures.push($data_items[enemy.item_id])
            end
            if enemy.weapon_id > 0
              treasures.push($data_weapons[enemy.weapon_id])
            end
            if enemy.armor_id > 0
              treasures.push($data_armors[enemy.armor_id])
            end
          end
        end
      end
    end
    # Treasure is limited to a maximum of 6 items
    treasures = treasures[0..5]
    # Obtaining EXP
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        last_level = actor.level
        actor.exp += exp
        if actor.level > last_level
          @status_window.level_up(i)
        end
      end
    end
    # Obtaining gold
    $game_party.gain_gold(gold)
    # Obtaining treasure
    for item in treasures
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
    # Make battle result window
    @result_window = Window_BattleResult.new(exp, gold, treasures)
    # Set wait count
    @phase5_wait_count = 100
  end
end

#==============================================================================
# ** Scene_Menu
#==============================================================================

class Scene_Menu
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make command window
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Album"
    s5 = "Status"
    s6 = "Save"
    s7 = "End Game"
    @command_window = Window_Command2.new(160, [s1, s2, s3, s4, s5, s6, s7])
    @command_window.index = @menu_index
    # If number of party members is 0
    if $game_party.actors.size == 0
      # Disable items, skills, equipment, album, and status
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
      @command_window.disable_item(4)
    end
    # If save is forbidden
    if $game_system.save_disabled
      # Disable save
      @command_window.disable_item(5)
    end
    # Make play time window
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = 0
    @playtime_window.y = 224
    # Make steps window
    @steps_window = Window_Steps.new
    @steps_window.x = 0
    @steps_window.y = 320
    # Make gold window
    @gold_window = Window_Gold.new
    @gold_window.x = 0
    @gold_window.y = 416
    # Make status window
    @status_window = Window_MenuStatus.new
    @status_window.x = 160
    @status_window.y = 0
    # 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
    @command_window.dispose
    @playtime_window.dispose
    @steps_window.dispose
    @gold_window.dispose
    @status_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    # 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)
      # If command other than save or end game, and party members = 0
      if $game_party.actors.size == 0 and @command_window.index < 4
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Branch by command window cursor position
      case @command_window.index
      when 0  # item
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
        $scene = Scene_Item.new
      when 1  # skill
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 3  # Monster Album
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Go to monster album
        $scene = Scene_Album.new
      when 4  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 5  # save
        # If saving is forbidden
        if $game_system.save_disabled
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to save screen
        $scene = Scene_Save.new
      when 6  # end game
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to end game screen
        $scene = Scene_End.new
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when status window is active)
  #--------------------------------------------------------------------------
  def update_status
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Make command window active
      @command_window.active = true
      @status_window.active = false
      @status_window.index = -1
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.index
      when 1  # skill
        # If this actor's action limit is 2 or more
        if $game_party.actors[@status_window.index].restriction >= 2
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to skill screen
        $scene = Scene_Skill.new(@status_window.index)
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to equipment screen
        $scene = Scene_Equip.new(@status_window.index)
      when 4  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to status screen
        $scene = Scene_Status.new(@status_window.index)
      end
      return
    end
  end
end


#==============================================================================
# Section IV: Data_Management
#------------------------------------------------------------------------------
#  This bundle of code is just the Scene Title, Save and Load classes with some
#  modified methods to handle, store, and retrieve the Bestairy data
#==============================================================================

#==============================================================================
# ** Scene_Title
#==============================================================================

class Scene_Title
  #--------------------------------------------------------------------------
  # * Command: New Game
  #--------------------------------------------------------------------------
  def command_new_game
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
    # Stop BGM
    Audio.bgm_stop
    # Reset frame count for measuring play time
    Graphics.frame_count = 0
    # Make each type of game object
    $game_temp          = Game_Temp.new
    $game_system        = Game_System.new
    $game_switches      = Game_Switches.new
    $game_variables     = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_screen        = Game_Screen.new
    $game_actors        = Game_Actors.new
    $game_party         = Game_Party.new
    $game_troop         = Game_Troop.new
    $game_map           = Game_Map.new
    $game_player        = Game_Player.new
    # Added code. Creates a new Album for new game
    $game_album         = Game_Album.new          
    # Set up initial party
    $game_party.setup_starting_members
    # Set up initial map position
    $game_map.setup($data_system.start_map_id)
    # Move player to initial position
    $game_player.moveto($data_system.start_x, $data_system.start_y)
    # Refresh player
    $game_player.refresh
    # Run automatic change for BGM and BGS set with map
    $game_map.autoplay
    # Update map (run parallel process event)
    $game_map.update
    # Switch to map screen
    $scene = Scene_Map.new
  end
  #--------------------------------------------------------------------------
  # * Battle Test
  #--------------------------------------------------------------------------
  def battle_test
    # Load database (for battle test)
    $data_actors        = load_data("Data/BT_Actors.rxdata")
    $data_classes       = load_data("Data/BT_Classes.rxdata")
    $data_skills        = load_data("Data/BT_Skills.rxdata")
    $data_items         = load_data("Data/BT_Items.rxdata")
    $data_weapons       = load_data("Data/BT_Weapons.rxdata")
    $data_armors        = load_data("Data/BT_Armors.rxdata")
    $data_enemies       = load_data("Data/BT_Enemies.rxdata")
    $data_troops        = load_data("Data/BT_Troops.rxdata")
    $data_states        = load_data("Data/BT_States.rxdata")
    $data_animations    = load_data("Data/BT_Animations.rxdata")
    $data_tilesets      = load_data("Data/BT_Tilesets.rxdata")
    $data_common_events = load_data("Data/BT_CommonEvents.rxdata")
    $data_system        = load_data("Data/BT_System.rxdata")
    # Reset frame count for measuring play time
    Graphics.frame_count = 0
    # Make each game object
    $game_temp          = Game_Temp.new
    $game_system        = Game_System.new
    $game_switches      = Game_Switches.new
    $game_variables     = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_screen        = Game_Screen.new
    $game_actors        = Game_Actors.new
    $game_party         = Game_Party.new
    $game_troop         = Game_Troop.new
    $game_map           = Game_Map.new
    $game_player        = Game_Player.new
    # Added code. Creates a new Album for new game
    $game_album         = Game_Album.new
    # Set up party for battle test
    $game_party.setup_battle_test_members
    # Set troop ID, can escape flag, and battleback
    $game_temp.battle_troop_id = $data_system.test_troop_id
    $game_temp.battle_can_escape = true
    $game_map.battleback_name = $data_system.battleback_name
    # Play battle start SE
    $game_system.se_play($data_system.battle_start_se)
    # Play battle BGM
    $game_system.bgm_play($game_system.battle_bgm)
    # Switch to battle screen
    $scene = Scene_Battle.new
  end
end
}
#2
Part 2
Code:
#==============================================================================
# ** Scene_Save
#==============================================================================

class Scene_Save < Scene_File
 #--------------------------------------------------------------------------
 # * 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[i]
     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)
   # Added code. Stores the Album data on save command
   Marshal.dump($game_album, file)
 end
end

#==============================================================================
# ** Scene_Load
#==============================================================================

class Scene_Load < Scene_File
 #--------------------------------------------------------------------------
 # * Read Save Data
 #     file : file object for reading (opened)
 #--------------------------------------------------------------------------
 def read_save_data(file)
   # Read character data for drawing save file
   characters = Marshal.load(file)
   # Read frame count for measuring play time
   Graphics.frame_count = Marshal.load(file)
   # Read each type of game object
   $game_system        = Marshal.load(file)
   $game_switches      = Marshal.load(file)
   $game_variables     = Marshal.load(file)
   $game_self_switches = Marshal.load(file)
   $game_screen        = Marshal.load(file)
   $game_actors        = Marshal.load(file)
   $game_party         = Marshal.load(file)
   $game_troop         = Marshal.load(file)
   $game_map           = Marshal.load(file)
   $game_player        = Marshal.load(file)
   # Added code. Retrieves the Album data on load command
   $game_album         = Marshal.load(file)
   # If magic number is different from when saving
   # (if editing was added with editor)
   if $game_system.magic_number != $data_system.magic_number
     # Load map
     $game_map.setup($game_map.map_id)
     $game_player.center($game_player.x, $game_player.y)
   end
   # Refresh party members
   $game_party.refresh
 end
end

#==============================================================================
# ** Section V: Modules
#==============================================================================

#==============================================================================
# ** Module Colors
#------------------------------------------------------------------------------
# Contains various defined colors for use in projects.
#==============================================================================

module Colors
 # CONSTANTS

 GREEN = Color.new(50, 200, 50, 255)
 RED = Color.new(200, 50, 50, 255)
 YELLOW = Color.new(200, 200, 0, 255)
 ORANGE = Color.new(220, 150, 0, 255)
 INDIGO = Color.new(50, 50, 200, 110)
 VIOLET = Color.new(120, 50, 180, 110)
 BLACK = Color.new(0, 0, 0, 255)
end
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  Advanced Monster Database SephirothSpawn 0 2,729 11-19-2005, 01:00 PM
Last Post: SephirothSpawn



Users browsing this thread: 1 Guest(s)