Octople Threat
Member
Cmpsr2000's script either over-rides the KGC Equip Extension (When it's placed below the KGC script) or it gets buggy, shows you can only equip a shield as ammo, and doesn't work at all... (When it's above the KGC script)
Now, I have fixed the overwrite problems that occur when I put the ammo system underneath the KGC script by commenting out some portions of it... However, it still doesn't work... It does everything except register and display the ammo being equipped, and going into battle causes this error:
Here are the scripts
Cmpsr2000's Disposable Ammo comes in three parts: Ammo
Redefinitions... This placed second because of a undefined method I got when they were in order, and putting them out of place fixed it at the time.
And finally, game_ammo
This is the KGC Equip Extension
If you are wondering I have the codes placed like this as I was trying to fix my problem by myself...
Ammo
KGC Equip_Extension
Redefinitions
Game_ammo
I would greatly appreciate any assistance with this issue, and thank you for your time if you are even reading this.
Now, I have fixed the overwrite problems that occur when I put the ammo system underneath the KGC script by commenting out some portions of it... However, it still doesn't work... It does everything except register and display the ammo being equipped, and going into battle causes this error:
Here are the scripts
Cmpsr2000's Disposable Ammo comes in three parts: Ammo
Code:
#-------------------------------------------------------------------------------
# Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â page 2 of 3
# Â Â Â Â Â Â Â Â Â Â Â Â Disposable Ammunition v 1.0 rc 2
# Â Â Â Â Â Â Â Â Â Â Â Â by cmpsr2000 @ rpgrevolution.com
# Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â September 10, 2008
#
#-------------------------------------------------------------------------------
class Ammo < RPG::Weapon
 attr_reader  :amount
 attr_accessor :amountEquiped
 attr_reader  :type
 attr_accessor :equipLock
 #-----------------------------------------------------------------------------
 # Initialize - creates a new Ammo
 #  weapon  : The weapon to build the ammo from
 #-----------------------------------------------------------------------------
 def initialize(weapon)
  self.id       = weapon.id
  self.name      = weapon.name
  self.icon_index   = weapon.icon_index
  self.description   = weapon.description
  self.note      = weapon.note
  self.animation_id  = weapon.animation_id
  self.price      = weapon.price
  self.hit       = weapon.hit
  self.atk       = weapon.atk
  self.def       = weapon.def
  self.spi       = weapon.spi
  self.agi       = weapon.agi
  self.two_handed   = weapon.two_handed
  self.fast_attack   = weapon.fast_attack
  self.dual_attack   = weapon.dual_attack
  self.critical_bonus = weapon.critical_bonus
  self.element_set   = weapon.element_set
  self.state_set    = weapon.state_set
  @type        = findType
  @amount       = 0
  @amountEquiped    = 0
  @equipLock      = false
 end
 #-----------------------------------------------------------------------------
 # spendAmmo - subtracts an amount of ammo from the stack and equiped
 #  amount  : amount of ammo to spend
 #-----------------------------------------------------------------------------
 def spendAmmo(amount)
  gainAmmo(-amount)
  @amountEquiped -= amount if @amountEquiped > 0
 end
 #-----------------------------------------------------------------------------
 # gainAmmo - adds an amount of ammo to the stack
 #  amount : amount of ammo to add
 #-----------------------------------------------------------------------------
 def gainAmmo(amount)
  @amount += amount
  @amount = 0 if @amount < 0
  @amount = 99 if @amount > 99
 end
 #-----------------------------------------------------------------------------
 # findType - determines the type of ammo
 #-----------------------------------------------------------------------------
 def findType
  for ammoName in Vocab::Ammo
   return ammoName if self.note.downcase.include?(ammoName.downcase)
  end
  return nil
 end
end
Redefinitions... This placed second because of a undefined method I got when they were in order, and putting them out of place fixed it at the time.
Code:
#-------------------------------------------------------------------------------
# Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â page 1 of 3
# Â Â Â Â Â Â Â Â Â Â Â Â Disposable Ammunition v 1.0 rc 2
# Â Â Â Â Â Â Â Â Â Â Â Â by cmpsr2000 @ rpgrevolution.com
# Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â September 10, 2008
#
#-------------------------------------------------------------------------------
module RPG
 class BaseItem
  #---------------------------------------------------------------------------
  # determins whether or not the item uses ammunition
  #---------------------------------------------------------------------------
  def usesAmmo?
   for ammoName in Vocab::Ammo
    return true if self.note.downcase.include?("<uses:" +
                          ammoName.downcase)
   end
   return false
  end
  #---------------------------------------------------------------------------
  # determins whether or not the item is ammunition
  #---------------------------------------------------------------------------
  def isAmmo?
   for ammoName in Vocab::Ammo
    return true if self.note.downcase.include?("<" +ammoName.downcase + ">")
   end
   return false
  end
  #---------------------------------------------------------------------------
  # determins whether or not the item consumes ammunition
  #---------------------------------------------------------------------------
  def spendsAmmo?
   return true if self.note.downcase.include?("<spendsammo:")
   return false                     Â
  end
  #---------------------------------------------------------------------------
  # determines whether the item reloads
  #---------------------------------------------------------------------------
  def reloads?
   return true if self.note.downcase.include?("max:")
   return false
  end
  #---------------------------------------------------------------------------
  # determins whether the item reloads
  #---------------------------------------------------------------------------
  def isReloader?
   return true if self.note.downcase.include?("<reloads>")
   return false
  end
  #---------------------------------------------------------------------------
  # returns the amount of ammo spent by this item
  #---------------------------------------------------------------------------
  def amountSpent
   if self.spendsAmmo?
    return self.note.downcase.match('<spendsammo:(\d*)>')[1].to_i
   end
   return 0
  end
  #---------------------------------------------------------------------------
  # returns the amount of ammo reloaded
  #---------------------------------------------------------------------------
  def amountReloaded(ammo)
   if self.reloads?
    return self.note.downcase.match('<uses:' + ammo.type.downcase +
                    ' max:(\d*)')[1].to_i
   end
   return 0
  end
 end
end
Â
module Vocab
 #-----------------------------------------------------------------------------
 # You can define the names of your ammo types here. These are the terms used
 # in the notes field to delcare items as part of the system
 #-----------------------------------------------------------------------------
 Ammo =  [ #Ammo1 Name
      "Bullet",
     ]
 AmmoGeneric = "Ammo"
end
Â
class Scene_Title
 #-----------------------------------------------------------------------------
 # Adds the $game_ammo initialization to create_game_objects
 #-----------------------------------------------------------------------------
 alias oldCreateGameObj_DisposableAmmo create_game_objects
 def create_game_objects
  oldCreateGameObj_DisposableAmmo
  $game_ammo = Game_Ammo.new
 end
end
Â
class Scene_Battle < Scene_Base
 #--------------------------------------------------------------------------
 # * Update Actor Command Selection
 #--------------------------------------------------------------------------
=begin  def update_actor_command_selection
  if Input.trigger?(Input::B)
   Sound.play_cancel
   prior_actor
  elsif Input.trigger?(Input::C)
   case @actor_command_window.index
   when 0  # Attack
    if @active_battler.canAttack?
     Sound.play_decision
     @active_battler.action.set_attack
     start_target_enemy_selection
    else
     Sound.play_buzzer
    end
   when 1  # Skill
    Sound.play_decision
    start_skill_selection
   when 2  # Guard
    Sound.play_decision
    @active_battler.action.set_guard
    next_actor
   when 3  # Item
    Sound.play_decision
    start_item_selection
   end
  end
 end
=end Â
 #--------------------------------------------------------------------------
 # * Execute Battle Action: Attack
 #--------------------------------------------------------------------------
 alias oldExecActionAtk_DisposableAmmo execute_action_attack
 def execute_action_attack
  oldExecActionAtk_DisposableAmmo
  if @active_battler.is_a?(Game_Actor)
   weapon = @active_battler.weapons[0]
   if not weapon.nil? and weapon.usesAmmo?
    ammo = @active_battler.weapons[1]
    ammo.spendAmmo(1)
    if ammo.amountEquiped == 0
     if $game_ammo.autoReload
      @active_battler.reload
     else
      @active_battler.change_equip(1, nil)
     end
    end
   end
  end
 end
 #--------------------------------------------------------------------------
 # * Execute Battle Action: Skill
 #--------------------------------------------------------------------------
 alias oldExecActionSkill_DisposableAmmo execute_action_skill
 def execute_action_skill
  oldExecActionSkill_DisposableAmmo
  skill = @active_battler.action.skill
  if @active_battler.is_a?(Game_Actor)
   if skill.spendsAmmo?
    ammo = @active_battler.weapons[1]
    ammo.spendAmmo(skill.amountSpent)
    if ammo.amount == 0
     if $game_ammo.autoReload
      @active_battler.reload
     else
      @active_battler.change_equip(1, nil)
     end
    end
   end
  end
 end
end
Â
=begin class Window_ActorCommand < Window_Command
 #-----------------------------------------------------------------------------
 # greys out the attack button if the actor can't attack due to ammo depletion
 #-----------------------------------------------------------------------------
# Â alias oldSetup_DisposableAmmo setup
 def setup(actor)
  oldSetup_DisposableAmmo(actor)
  draw_item(0, actor.canAttack?)
 end
end
=end
class Game_Actor < Game_Battler
Â
 attr_reader :lastAmmo
 #-----------------------------------------------------------------------------
 # includes the calculations for weapons that use ammunition
 #-----------------------------------------------------------------------------
 def hit
  if two_swords_style
   n1 = weapons[0] == nil ? 95 : weapons[0].hit
   n2 = weapons[1] == nil ? 95 : weapons[1].hit
   n = [n1, n2].min
  elsif weapons[0] != nil and weapons[0].usesAmmo?
   n1 = weapons[0].hit
   n2 = weapons[1] == nil ? 95 : weapons[1].hit
   case $game_ammo.hitRateCalcType
   when 0 #addative
    n = n1 + n2
   when 1 # average (rounds up)
    n = ((n1 + n2).to_f / 2).ceil
   when 2 #average (rounds down)
    n = (n1+ n2) / 2
   when 3 #min
    n = [n1, n2].min
   when 4 #max
    n = [n1, n2].max
   #-------------------------------------------------------------------------
   # scripters can add their own damage calulation for ranged weapons here
   # by adding additional "when" statements to the case
   #-------------------------------------------------------------------------
   end
  else
   n = weapons[0] == nil ? 95 : weapons[0].hit
  end
  return n
 end
 #--------------------------------------------------------------------------
 # * Get Weapon Object Array
 #--------------------------------------------------------------------------
=begin Â
 def weapons
  result = []
  result.push($data_weapons[@weapon_id])
  if two_swords_style or ($data_weapons[@armor1_id] != nil and
              $data_weapons[@armor1_id].isAmmo?)
   result.push($data_weapons[@armor1_id])
  end
  return result
 end
 #--------------------------------------------------------------------------
 # * Get Armor Object Array
 #--------------------------------------------------------------------------
 def armors
  result = []
  unless two_swords_style or ($data_weapons[@armor1_id] != nil and
                $data_weapons[@armor1_id].isAmmo?)
   result.push($data_armors[@armor1_id])
  end
  result.push($data_armors[@armor2_id])
  result.push($data_armors[@armor3_id])
  result.push($data_armors[@armor4_id])
  return result
 end
Â
 def change_equip_by_id(equip_type, item_id, test = false)
  if equip_type == 0 or (equip_type == 1 and two_swords_style)
   change_equip(equip_type, $data_weapons[item_id], test)
  else
   change_equip(equip_type, $data_armors[item_id], test)
  end
 end
=end
 #-----------------------------------------------------------------------------
 # updated to process ammunition correctly. And OMG you people so OWE me for
 # the extra work that had to be done here to make reloading work -.-
 #-----------------------------------------------------------------------------
 def change_equip(equip_type, item, test = false)
  last_item = equips[equip_type]
  unless test
   return if $game_party.item_number(item) == 0 if not item.nil?
  Â
   #if the item is an ammo and the equiped weapon reloads then newnumber is
   #the maximimun amount of available ammo up to the amount the weapon will
   #hold. If there is no weapon equiped or the weapon cannot use the ammo,
   #there is no restriction on the amount that can be equiped.
   if not item.nil?
    if item.isAmmo?
     if not weapons[0].nil? and weapons[0].reloads? and
       $game_ammo.matched(weapons[0], item)
      newNumber = [item.amount, weapons[0].amountReloaded(item)].min
     else
      #no weapon, or weapon has no equip limit, or weapon and ammo don't
      #match
      newNumber = item.amount
     end
     #set the equiped amount and set the lastAmmo reference
     item.amountEquiped = newNumber
     @lastAmmo = item
    end
   end
   newNumber = 1 if newNumber.nil?
  Â
   #oldItem amount logic
   if not last_item.nil? and last_item.isAmmo?
    oldNumber = last_item.amountEquiped
    last_item.amountEquiped = 0 if item.nil?
   else
    oldNumber = 1
   end
  Â
   #equipLock insures that the item.amount attribute will not change when
   #the ammo is removed from inventory and moved to equipment
  Â
   #lock the equiping item
   item.equipLock = true if not item.nil? and item.isAmmo?
  Â
   #add the currently equiped item to the item pool. If it is ammo,
   #increment the amount
   $game_party.gain_item(last_item, oldNumber)
  Â
   #remove the item you are equiping from inventory. if it is ammo,
   #decrement by the amount being equiped
   $game_party.lose_item(item, newNumber)
  Â
   #unlock the unequiping item
   last_item.equipLock = false if last_item != nil and last_item.isAmmo?
  end
  item_id = item == nil ? 0 : item.id
  case equip_type
  when 0  # Weapon
   @weapon_id = item_id
   unless two_hands_legal? and $game_ammo.matched(item, equips[1])
    change_equip(1, nil, test)     # Unequip from other hand
   end
   #if the item is a weapon and the item uses ammo, we may need to
   #equip or unequip some ammo. It's easiest to unequip all of it then
   #re-equip.
   if not item.nil? and item.usesAmmo? and not equips[1].nil? and
     equips[1].isAmmo? and $game_ammo.matched(item, equips[1])
    if equips[1].amountEquiped > item.amountReloaded(equips[1]) or
     (equips[1].amountEquiped < item.amountReloaded(equips[1]) and
      equips[1].amountEquiped < equips[1].amount)
     ammo = equips[1] #because equips[1] will be nil after the change!
     change_equip(1, nil, test)
     change_equip(1, ammo, test)
    end
   end
  when 1  # Shield / Ammo
   @armor1_id = item_id
   unless two_hands_legal? and $game_ammo.matched(equips[0], item)
    change_equip(0, nil, test)     # Unequip from other hand
   end
  when 2  # Head
   @armor2_id = item_id
  when 3  # Body
   @armor3_id = item_id
  when 4  # Accessory
   @armor4_id = item_id
  end
 end
 #-----------------------------------------------------------------------------
 # reloads the ammunition in use
 #-----------------------------------------------------------------------------
 def reload
  if not @lastAmmo.nil?
   if $game_party.item_number(@lastAmmo) > 0
    #remove ammo, then equip more
    change_equip(1, nil)
    change_equip(1, @lastAmmo)
   else
    for ammo in $game_ammo.ammos
     if ammo.type == @lastAmmo.type
      #remove ammo, then equip more
      change_equip(1, nil)
      change_equip(1, ammo)
     end
    end
   end
  elsif $game_ammo.allowBlindReload
   attemptBlindReload
  end
 end
 #-----------------------------------------------------------------------------
 # Attempts to reload ammo for this weapon without knowing the previous ammo.
 # This basically finds the first available ammo in the player's inventory and
 # equips it.
 #-----------------------------------------------------------------------------
 def attemptBlindReload
  unless weapons[0].nil?
   usableAmmos = weapons[0].note.downcase.match('<uses:(\w*)')
   for ammo in $game_ammo.ammos
    if usableAmmos.to_a.include?(ammo.type.downcase) and $game_party.item_number(ammo) > 0
     #remove ammo, then equip more
     change_equip(1, nil)
     change_equip(1, ammo)
     return #break if we found one!
    end
   end
  end
 end
 #-----------------------------------------------------------------------------
 # Checks to see if the actor can attack. (checks for the presence of ammo if
 # using a weapon that requires ammo)
 #-----------------------------------------------------------------------------
 def canAttack?
  if weapons[0] != nil and weapons[0].usesAmmo?
   return false if weapons[1] == nil
   return false if weapons[1].amountEquiped == 0
  elsif weapons[1] != nil and weapons[1].isAmmo?
   return false if weapons[0] == nil
  end
  return true
 end
 #-----------------------------------------------------------------------------
 # Redefined to return false if there is not enough ammo
 #-----------------------------------------------------------------------------
 alias oldSkillCanUse_DisposableAmmo skill_can_use?
 def skill_can_use?(skill)
  return false if not self.canAttack? and skill.spendsAmmo?
  if skill.amountSpent > 0 and not weapons[1].nil?
   return false unless weapons[1].amountEquiped >= skill.amountSpent
  end
  oldSkillCanUse_DisposableAmmo(skill)
 end
 #--------------------------------------------------------------------------
 # * Apply Skill Effects
 #   user  : Skill user
 #   skill : skill
 # THIS METHOD OVERIDES THE Game_Battler METHOD
 #--------------------------------------------------------------------------
 def skill_effect(user, skill)
  if skill.isReloader?
   self.reload
  end
  super
 end
end
Â
class Game_Party < Game_Unit
 #-----------------------------------------------------------------------------
 # adds proccessing for ammo ammount to gain_item
 #-----------------------------------------------------------------------------
 alias oldGainItem_DisposableAmmo gain_item
 def gain_item(item, n, include_equip = false)
  oldGainItem_DisposableAmmo(item, n, include_equip)
  item.gainAmmo(n) if item != nil and item.isAmmo? and not item.equipLock
 end
end
Â
class Window_Equip < Window_Selectable
 #-----------------------------------------------------------------------------
 # Adds the ammo amount next to the ammo name in the equip window and
 # draws ammo/shield according to equiped item.
 #-----------------------------------------------------------------------------
 alias oldRefresh_DisposableAmmo refresh
 def refresh
  oldRefresh_DisposableAmmo
  if not @data[1].nil? and @data[1].isAmmo?
   amount = @data[1].amountEquiped.to_s
   self.contents.draw_text(116, WLH, 172, WLH, amount, 2)
  end
  self.contents.font.color = system_color
  if (not @actor.weapons[0].nil? and @actor.weapons[0].usesAmmo?) or
    (not @actor.weapons[1].nil? and @actor.weapons[1].isAmmo?)
   rect = Rect.new(4, WLH * 1, 92, WLH)
   self.contents.clear_rect(rect)
   self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::AmmoGeneric)
  end
 end
end
Â
class Window_EquipItem < Window_Item
 #-----------------------------------------------------------------------------
 # Determines whether or not to include an item in an item-list for equiping
 #-----------------------------------------------------------------------------
 def include?(item)
  return true if item == nil
  if @equip_type == 0
   return false if item.isAmmo?
   return false unless item.is_a?(RPG::Weapon)
  elsif @equip_type == 1
   return false unless item.is_a?(RPG::Armor) or item.isAmmo?
   if item.is_a?(RPG::Armor)
    return false unless item.kind == @equip_type - 1
   end
  else
   return false unless item.is_a?(RPG::Armor)
   return false unless item.kind == @equip_type - 1
  end
  return @actor.equippable?(item)
 end
end
And finally, game_ammo
Code:
-------------------------------------------------------------------------------
# Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â page 3 of 3
# Â Â Â Â Â Â Â Â Â Â Â Â Disposable Ammunition v 1.0 rc 2
# Â Â Â Â Â Â Â Â Â Â Â Â by cmpsr2000 @ rpgrevolution.com
# Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â September 10, 2008
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#
# Â This script allows for the deffinition of Ammunitions and weapons that can
# Â consume them. To build an ammunition type, first add the name to the Ammo
# Â Vocab entry in the redefinitions section of the script.
#
# Â To declare a weapon in the database as an ammunition:
# Â Â Include the name of the ammo type surrounded by <> in the notes field.
# Â Â for example: <arrow>
#
# Â To declare a weapon that consumes ammunition:
# Â Â Include the term uses: follwed by the ammo type surrounded by <> in the
# Â Â notes field. for example: <uses:arrow>
# Â Â
# Â Â NOTE: weapons can use more than one type of ammo! Include multiple tags
# Â Â Â Â Â for each ammo type you wish to be equipable.
# Â Â Â Â Â For example: <uses:bullet> <uses:grenade>
#
# Â To restrict the maximum equipable ammo for a weapon:
# Â Â Include the max: attribute in the uses tag followed by the amount.
# Â Â For example: <uses:bullet max:30>
#
# Â Â NOTE: if you include max: for one ammo type on a weapon, you must include
# Â Â Â Â Â it for ALL ammo types for that weapon!
# Â Â
#-------------------------------------------------------------------------------
class Game_Ammo
 attr_reader  :hitRateCalcType
 attr_reader  :ammos
 attr_reader  :allowBlindReload
 attr_accessor :autoReload
 def initialize
  #---------------------------------------------------------------------------
  # set the type of hit calculation for ammos here
  #  0:  Addative (weapon dmg + ammo dmg)
  #  1:  Average (rounds up)
  #  2:  Average (rounds down)
  #  3:  Min
  #  4:  Max
  #---------------------------------------------------------------------------
  @hitRateCalcType = 0
 Â
  #---------------------------------------------------------------------------
  # Set this to true if you would like the characters to automatically
  # reload their weapons when they expend equiped ammunition.
  #---------------------------------------------------------------------------
  @autoReload = false
 Â
  #---------------------------------------------------------------------------
  # Set this to true to enable the system to search for the first available
  # equipable ammo. Set to false to disable this capability.
  #---------------------------------------------------------------------------
  @allowBlindReload = true
 Â
  initAmmos
 end
 #-----------------------------------------------------------------------------
 # initAmmos - converts the weapons in the weapon database to Ammos
 #-----------------------------------------------------------------------------
 def initAmmos
  @ammos = []
  for weapon in $data_weapons
   if not weapon.nil? and weapon.isAmmo?
    ammo = Ammo.new(weapon)
    $data_weapons[weapon.id] = ammo
    @ammos.push(ammo)
   end
  end
 end
 #-----------------------------------------------------------------------------
 # returns true/false based on whether or not the ammo/weapon combo can be
 # used together.
 #  weapon:  The weapon to be compared
 #  ammo:   The ammo to be compared
 #-----------------------------------------------------------------------------
 def matched(weapon, ammo)
  #if either one is nil, nothing prevents equiping
  return true if weapon == nil or ammo == nil
 Â
  #we don't care if neither is related to the ammo system
  return true if not weapon.usesAmmo? and not ammo.isAmmo?
 Â
  #Matches ammos only with ammo-using weapons
  return false if weapon.usesAmmo? and not ammo.isAmmo?
  return false if ammo.isAmmo?   and not weapon.usesAmmo?
 Â
  #ammo must be an ammo and weapon uses ammo; need to check types now:
  weaponAmmoTypes = weapon.note.downcase.scan(/<uses:(\w*)/).flatten!
  ammoType     = ammo.note.downcase.match(/<(\w*)>/)[1]
  for weaponAmmoType in weaponAmmoTypes
   return true if weaponAmmoType == ammoType
  end
 Â
  #this ammo doesn't match any of the weapon's usable ammo types
  return false
 end
end
Â
#-------------------------------------------------------------------------------
#
# Mithran of RPGmakerVX.net's fix for cmpsr200's ammo sytem bug.
#
#-------------------------------------------------------------------------------
class Scene_Battle < Scene_Base
 alias display_failure_reloadfix display_failure
 def display_failure(target, obj)
  return if obj != nil && obj.isReloader?
  display_failure_reloadfix(target, obj)
 end
end
Â
class Scene_File < Scene_Base
 alias write_save_data_reload write_save_data
 def write_save_data(file)
  write_save_data_reload(file)
  amountsAmmo  = {}
  equippedAmountsAmmo = {}
  for item in $data_weapons
   if item.is_a?(Ammo)
    amountsAmmo[item.id] = item.amount
    equippedAmountsAmmo[item.id] = item.amountEquiped
   end
  end
  Marshal.dump(amountsAmmo, file)
  Marshal.dump(equippedAmountsAmmo, file)
 end
Â
 alias read_save_data_reload read_save_data
 def read_save_data(file)
  read_save_data_reload(file)
  amountsAmmo = Marshal.load(file)
  equippedAmountsAmmo = Marshal.load(file)
  for item in $data_weapons
   if item.is_a?(Ammo)
    item.gainAmmo(amountsAmmo[item.id]) unless amountsAmmo[item.id].nil?
    item.amountEquiped = equippedAmountsAmmo[item.id] unless equippedAmountsAmmo[item.id].nil?
   end
  end
 end
end
This is the KGC Equip Extension
Code:
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/  ◆         Skill CP System - KGC_SkillCPSystem        ◆ VX ◆
#_/ Â â—‡ Â Â Â Â Â Â Â Â Â Â Â Last Update: 2008/09/06 Â Â Â Â Â Â Â Â Â Â Â Â Â â—‡
#_/  ◆       Translated and Extended Updates by Mr. Anonymous      ◆
#_/ Â â—† KGC Site: Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â â—†
#_/ Â â—† [url=http://f44.aaa.livedoor.jp/~ytomy/]http://f44.aaa.livedoor.jp/~ytomy/[/url] Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â â—†
#_/ Â â—† Translator's Blog: Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â â—†
#_/ Â â—† [url=http://mraprojects.wordpress.com]http://mraprojects.wordpress.com[/url] Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â â—†
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ Â Â Â Â This script has two functions equipment-related functions.
#_/ Â The first function is the ability to create moire 'slots' for equipment,
#_/ Â such as separating Boots and Gauntlets from mere 'accessories'.
#_/ Â It is possible to also create additional equipment slots. See the customize
#_/ Â block for more details.
#_/ Â
#_/ Â The second function is an "EP" (Equipment Point) System, which allows you
#_/ Â to designate how many 'points' an item costs to successfully equip. A
#_/ Â character's total EP expenditure is increased upon leveling up.
#_/ Â This introduces more strategy-oriented character customization.
#_/----------------------------------------------------------------------------
#_/ Â Â Â Â Â Â Â Â Â Â Â Â â—† Instructions For Usage â—†
#_/ Â To make use of these functions, you must insert the tag into the desired
#_/ Â item's "Notes" box located in the Armor tab of the database. For example,
#_/ Â you want the Leather Boots to be bound to the "Legs" slot and cost
#_/ Â 2 EP to equip. Insert <equipkind Legs>, press enter, then add <EP 2>
#_/ Â
#_/ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â â—† Tags â—†
#_/ Â <equipkind EquipType>
#_/ Â Where EquipType = The name of the type of equipment. See EXTRA_EQUIP_KIND
#_/ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â below.
#_/ Â <EP Amount>
#_/ Â Where Amount = The desired amount of EP the item requires to equip.
#_/
#_/
#_/ Â Â Â Â Â Â Â Â Â Â Â Â Â â—† Script Commands â—†
#_/ Â These commands are used in "Script" function in the third page of event
#_/ Â commands under "Advanced".
#_/
#_/ Â * set_actor_equip_type(ActorID, [EquipType])
#_/ Â Â Allows you to manually specify an actor's equipment slots. a
#_/ Â Â Â Ex. set_actor_equip_type(2, [0, 2, 3, 3, 3])
#_/ Â Â Â If "nil"(without quotations) is appointed to EquipType, the default
#_/ Â Â Â EQUIP_TYPE (see below) is used. Trust me, it's useful!
#_/
#_/ Â * change_actor_equipment(ActorID, equipslot_index, ItemID)
#_/ Â Â Allows you to change the equipment of a specified actor.
#_/ Â Â Â equipslot_index works by finding the equipment slot number, which is
#_/ Â Â Â different from EQUIP_TYPE. Setting ItemID to 0 will remove the item.
#_/ Â Â Â Â Â Â Â Â Â With the default setup, we see:
#_/ Â Â Â 0=Weapon 1=Shield 2=Headgear 3=Armor 4=Accessory 5=Legs 6=Arms
#_/
#_/ Â Â Â Â Â Â Â Â Â Â Â Â So, for an example:
#_/ Â Â Â Â Â Â Â Â Â change_actor_equipment(1, 3, 15)
#_/ Would change Ralph's(Actor01 in the database) armor to Chainmail(By default)
#_/ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
#_/ Â Â
#_/============================================================================
#_/ Installation: This script must be inserted below KCG_ExtendedEquipScene
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Â
#=============================================================================#
#              ★ Customization ★                 #
#=============================================================================#
Â
module KGC
 module EquipExtension
 #      ◆ Extended Equipment Classification Names ◆
 #  You may designate the names of additional equipment slots here.
 #  Each time you designate a new equipment slot, it is assigned a number.
 #  The first four equipment types (Shield, Helmet, Armor, and Accessory) are
 #  given as 1, 2, 3, 4, respectively. Then the values below are assigned in
 #  order. By default "Legs" and "Arms" would be 4 and 5. It is possible
 #  to add additional slots.
 #  Example: EXTRA_EQUIP_KIND = ["Legs", "Arms", "Skill Book"]
 EXTRA_EQUIP_KIND = ["Legs", "Arms"]
Â
 #           ◆ Equipment Placement ◆
 #  This allows you to arrange the equip slots as you see fit on the equipment
 #  menu. Note the order listed below.
 #          ** Equipment Classification Summary **
 # 0.Shield  1.Headgear  2.Armor  3.Accessory  4. "Legs"  5."Arms"
 #  Note that these can be changed as desired. By default, we've enabled two
 #  accessory slots at the end, instead of one. If you plan on adding extra
 #  equip slots, the category's cooresponding number must be inserted in the
 #  brackets [] below.
 EQUIP_TYPE = [0, 1, 2, 5, 4, 3, 3]
Â
 #            ◆ EP (Equip Point) System ◆
 #  These settings are for the Equipment Point Limit System.
 #  This toggle allows you to use the EP system if set to true.
 #  If set to false, the EP system will be disabled.
 USE_EP_SYSTEM = false
 # VOCAB_EP appears once a character gains EP from battle. (Not Tested)
 VOCAB_EP  = "EP"
 # VOCAB_EP_A appears above the EP gauge.
 VOCAB_EP_A = "EP"
 # This toggle allows you to display the EP gauge in the actor status window.
 SHOW_STATUS_EP = true
Â
 #              ◆ Default EP Cost ◆
 #  Allows you to change the default amount an item costs to equip in EP.
 #  (When not otherwise specified.)
 DEFAULT_EP_COST  = 1
 #  This toggle allows you to hide the EP cost of an item if its cost is 0.
 #  true = hide
 #  false = show
 HIDE_ZERO_EP_COST = true
Â
 #             ◆ EP Values & Level Gain ◆
 #  Maximum EP that can be spent equipping items.
 EP_MAX = 20
 # Characters begin with this amount of EP.
 EP_MIN = 5
 # ◆ EP Level Gain
 #  This is the formula for the amount of EP gained upon leveling up.
 #  The result of this formula is automatically converted to an integer.
 EP_CALC_EXP = "level * 0.3 + 4"
 # ◆ Individual Actor EP Level Gain
 PERSONAL_EP_CALC_EXP = [] # <- Do not alter or remove!
 #  Below here, you may specify formulas for individual actors that dictates
 #  the amount of EP they recieve upon leveling up. Like EP_CALC_EXP, the
 #  result is converted to an integer.
 #  Format: PERSONAL_EP_CALC_EXP[ActorID] = "Formula"
 #  The format is just like EP_CALC_EXP, except each actor is defined after
 #  PERSONAL_EP_CALC_EXP in brackets [].
 #  Any actor not specified uses the EP_CALC_EXP formula.
 #  Example:
 # PERSONAL_EP_CALC_EXP[1] = "level * 0.5 + 5"
 #         ◆ Insert Personal EP Calculations Below Here ◆
 PERSONAL_EP_CALC_EXP[1] = "level * 0.5 + 5"
Â
Â
Â
 #         ◆ Insert Personal EP Calculations Above Here ◆
Â
 #             ◆ EP Gauge Colorization ◆
 #  Allows you to change the color of the EP gauges.
 #  The color can also be determined by a red, green, and blue values.
 #  Example: GAUGE_NORMAL_START_COLOR = Color.new(255, 0, 0)  <- This is red.
 #  This method of color assignment is much like Tint Screen event command.
 #
 #  This affects the color of number that represents EP cost.
 EP_COST_COLOR     = 23
 #  This is the fill color for the early phase of the guage.
 EP_GAUGE_START_COLOR = 28
 #  This is the fill color for the late phase of the guage. (When full)
 EP_GAUGE_END_COLOR  = 29
 end
end
Â
#=============================================================================#
#              ★ End Customization ★                #
#=============================================================================#
Â
#=================================================#
# Â Â Â Â Â Â Â Â Â Â IMPORT Â Â Â Â Â Â Â Â Â Â Â #
#=================================================#
Â
$imported = {} if $imported == nil
$imported["EquipExtension"] = true
Â
#=================================================#
Â
module KGC::EquipExtension
 # Unless the EP system is used...
 unless USE_EP_SYSTEM
  SHOW_STATUS_EP = false
  HIDE_ZERO_EP_COST = true
 end
Â
#==============================================================================
# â–¡ KGC::EquipExtension::Regexp
#==============================================================================
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
#              Note Field Tag Strings               #
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
# Â Whatever word(s) are after the separator ( | ) in the following lines are
# Â what are used to determine what is searched for in the "Note" section of
# Â an item or armor.
Â
 #  Regular expressions defined
 module Regexp
  # Base Item Module
  module BaseItem
   #  EP Tag String
   EP_COST = /<EP\s*(\d+)>/i
   #  Item Type Tag String
   # Special note: I cannot get this tag to work right. If anyone knows how
   # this works or if it's bugged, please let me know.
   EQUIP_TYPE = /<(?:EQUIP_TYPE|equiptype)\s*(\d+(?:\s*,\s*\d+)*)>/
  end
Â
  #  Base Armor Module
  module Armor
   #  Armor Type Tag String
   EQUIP_KIND = /<(?:EQUIP_KIND|equipkind)\s*(.+)>/i
  end
 Â
 end
end
Â
#=================================================#
Â
#==============================================================================
# â–¡ KGC::Commands
#==============================================================================
Â
module KGC
module Commands
 module_function
 #--------------------------------------------------------------------------
 # â—‹ アクターã®è£…備を修復
 #--------------------------------------------------------------------------
 def restore_equip
  (1...$data_actors.size).each { |i|
   actor = $game_actors[i]
   actor.restore_equip
  }
 end
 #--------------------------------------------------------------------------
 # â—‹ アクターã®è£…備タイプをè¨å®š
 #   actor_id  : アクター ID
 #   equip_type : 装備タイプ
 #--------------------------------------------------------------------------
 def set_actor_equip_type(actor_id, equip_type = nil)
  actor = $game_actors[actor_id]
  return if actor == nil
  actor.equip_type = equip_type
 end
 #--------------------------------------------------------------------------
 # â—‹ アクターã®è£…備を変更
 #   actor_id  : アクター ID
 #   index    : è£…å‚™éƒ¨ä½ (0~)
 #   item_id   : æ¦å™¨ or 防具 ID (0 ã§è§£é™¤)
 #--------------------------------------------------------------------------
 def change_actor_equipment(actor_id, index, item_id)
  actor = $game_actors[actor_id]
  return if actor == nil
  actor.change_equip_by_id(index, item_id)
 end
end
end
Â
class Game_Interpreter
 include KGC::Commands
end
Â
#=================================================#
Â
#==============================================================================
# â– Vocab
#==============================================================================
Â
module Vocab
 # EP
 def self.ep
  return KGC::EquipExtension::VOCAB_EP
 end
Â
 # EP (略)
 def self.ep_a
  return KGC::EquipExtension::VOCAB_EP_A
 end
Â
 # 拡張防具欄
 def self.extra_armor(index)
  return KGC::EquipExtension::EXTRA_EQUIP_KIND[index]
 end
end
Â
#=================================================#
Â
#==============================================================================
# â– RPG::BaseItem
#==============================================================================
Â
class RPG::BaseItem
 #--------------------------------------------------------------------------
 # â—‹ 装備拡張ã®ã‚ャッシュを作æˆ
 #--------------------------------------------------------------------------
 def create_equip_extension_cache
  @__ep_cost = KGC::EquipExtension::DEFAULT_EP_COST
  @__equip_type = []
Â
  self.note.split(/[\r\n]+/).each { |line|
   case line
   when KGC::EquipExtension::Regexp::BaseItem::EP_COST
    # 消費 EP
    @__ep_cost = $1.to_i
   when KGC::EquipExtension::Regexp::BaseItem::EQUIP_TYPE
    # 装備タイプ
    @__equip_type = []
    $1.scan(/\d+/) { |num|
     @__equip_type << num.to_i
    }
   end
  }
Â
  # EP 制を使用ã—ãªã„å ´åˆã¯æ¶ˆè²» EP = 0
  @__ep_cost = 0 unless KGC::EquipExtension::USE_EP_SYSTEM
 end
 #--------------------------------------------------------------------------
 # ○ 消費 EP
 #--------------------------------------------------------------------------
 def ep_cost
  create_equip_extension_cache if @__ep_cost == nil
  return @__ep_cost
 end
 #--------------------------------------------------------------------------
 # ○ 装備タイプ
 #--------------------------------------------------------------------------
 def equip_type
  create_equip_extension_cache if @__equip_type == nil
  return @__equip_type
 end
end
Â
#=================================================#
Â
#==============================================================================
# â– RPG::Armor
#==============================================================================
Â
class RPG::Armor < RPG::BaseItem
 #--------------------------------------------------------------------------
 # â—‹ 装備拡張ã®ã‚ャッシュを作æˆ
 #--------------------------------------------------------------------------
 def create_equip_extension_cache
  super
  @__kind = -1
Â
  self.note.split(/[\r\n]+/).each { |line|
   if line =~ KGC::EquipExtension::Regexp::Armor::EQUIP_KIND
    # 装備種別
    e_index = KGC::EquipExtension::EXTRA_EQUIP_KIND.index($1)
    next if e_index == nil
    @__kind = e_index + 4
   end
  }
 end
Â
unless $@
 #--------------------------------------------------------------------------
 # ○ 種別
 #--------------------------------------------------------------------------
 alias kind_KGC_EquipExtension kind
 def kind
  create_equip_extension_cache if @__kind == nil
  return (@__kind == -1 ? kind_KGC_EquipExtension : @__kind)
 end
end
Â
end
Â
#=================================================#
Â
#==============================================================================
# â– Game_Actor
#==============================================================================
Â
class Game_Actor < Game_Battler
 #--------------------------------------------------------------------------
 # ◠公開インスタンス変数
 #--------------------------------------------------------------------------
 attr_writer  :equip_type        # 装備タイプ
 #--------------------------------------------------------------------------
 # ◠セットアップ
 #   actor_id : アクター ID
 #--------------------------------------------------------------------------
 alias setup_KGC_EquipExtension setup
 def setup(actor_id)
  actor = $data_actors[actor_id]
  @extra_armor_id = []
Â
  setup_KGC_EquipExtension(actor_id)
Â
  restore_equip
 end
 #--------------------------------------------------------------------------
 # â—‹ MaxEP å–å¾—
 #--------------------------------------------------------------------------
 def maxep
  calc_exp = KGC::EquipExtension::PERSONAL_EP_CALC_EXP[self.id]
  if calc_exp == nil
   calc_exp = KGC::EquipExtension::EP_CALC_EXP
  end
  n = Integer(eval(calc_exp))
  return [[n, ep_limit].min, KGC::EquipExtension::EP_MIN].max
 end
 #--------------------------------------------------------------------------
 # â—‹ EP å–å¾—
 #--------------------------------------------------------------------------
 def ep
  n = 0
  equips.compact.each { |item| n += item.ep_cost }
  return [maxep - n, 0].max
 end
 #--------------------------------------------------------------------------
 # â—‹ EP 上é™å–å¾—
 #--------------------------------------------------------------------------
 def ep_limit
  return KGC::EquipExtension::EP_MAX
 end
 #--------------------------------------------------------------------------
 # â—‹ 防具欄ã®å–å¾—
 #--------------------------------------------------------------------------
 def equip_type
  if @equip_type.is_a?(Array)
   return @equip_type
  else
   return KGC::EquipExtension::EQUIP_TYPE
  end
 end
 #--------------------------------------------------------------------------
 # â—‹ 防具欄ã®æ•°
 #--------------------------------------------------------------------------
 def armor_number
  return equip_type.size
 end
 #--------------------------------------------------------------------------
 # â—‹ 拡張防具欄ã®æ•°
 #--------------------------------------------------------------------------
 def extra_armor_number
  return [armor_number - 4, 0].max
 end
 #--------------------------------------------------------------------------
 # â—‹ 防具 ID リストã®å–å¾—
 #--------------------------------------------------------------------------
 def extra_armor_id
  @extra_armor_id = [] if @extra_armor_id == nil
  return @extra_armor_id
 end
 #--------------------------------------------------------------------------
 # ◠防具オブジェクトã®é…列å–å¾—
 #--------------------------------------------------------------------------
 alias armors_KGC_EquipExtension armors
 def armors
  result = armors_KGC_EquipExtension
Â
  # 5番目以é™ã®é˜²å…·ã‚’追åŠ
  extra_armor_number.times { |i|
   armor_id = extra_armor_id[i]
   result << (armor_id == nil ? nil : $data_armors[armor_id])
  }
  return result
 end
 #--------------------------------------------------------------------------
 # ◠装備ã®å¤‰æ›´ (オブジェクトã§æŒ‡å®š)
 #   equip_type : 装備部ä½
 #   item    : æ¦å™¨ or 防具 (nil ãªã‚‰è£…備解除)
 #   test    : テストフラグ (戦闘テストã€ã¾ãŸã¯è£…備画é¢ã§ã®ä¸€æ™‚装備)
 #--------------------------------------------------------------------------
 alias change_equip_KGC_EquipExtension change_equip
 def change_equip(equip_type, item, test = false)
  change_equip_KGC_EquipExtension(equip_type, item, test)
Â
  # 拡張防具欄ãŒã‚ã‚‹å ´åˆã®ã¿
  if extra_armor_number > 0
   item_id = item == nil ? 0 : item.id
   case equip_type
   when 5..armor_number  # 拡張防具欄
    @extra_armor_id = [] if @extra_armor_id == nil
    @extra_armor_id[equip_type - 5] = item_id
   end
  end
Â
  restore_battle_skill if $imported["SkillCPSystem"]
  restore_passive_rev  if $imported["PassiveSkill"]
 end
 #--------------------------------------------------------------------------
 # ◠装備ã®ç ´æ£„
 #   item : ç ´æ£„ã™ã‚‹æ¦å™¨ or 防具
 #   æ¦å™¨ï¼é˜²å…·ã®å¢—減ã§ã€Œè£…å‚™å“ã‚‚å«ã‚ã‚‹ã€ã®ã¨ã使用ã™ã‚‹ã€‚
 #--------------------------------------------------------------------------
 alias discard_equip_KGC_EquipExtension discard_equip
 def discard_equip(item)
  last_armors = [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
Â
  discard_equip_KGC_EquipExtension(item)
Â
  curr_armors = [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
  return unless item.is_a?(RPG::Armor)  # 防具ã§ãªã„
  return if last_armors != curr_armors  # æ—¢ã«ç ´æ£„ã•ã‚ŒãŸ
Â
  # 拡張防具欄を検索
  extra_armor_number.times { |i|
   if extra_armor_id[i] == item.id
    @extra_armor_id[i] = 0
    break
   end
  }
Â
  restore_battle_skill if $imported["SkillCPSystem"]
  restore_passive_rev  if $imported["PassiveSkill"]
 end
 #--------------------------------------------------------------------------
 # â— è·æ¥ ID ã®å¤‰æ›´
 #   class_id : æ–°ã—ã„è·æ¥ ID
 #--------------------------------------------------------------------------
 alias class_id_equal_KGC_EquipExtension class_id=
 def class_id=(class_id)
  class_id_equal_KGC_EquipExtension(class_id)
Â
  return if extra_armor_number == 0  # 拡張防具欄ãŒãªã„
Â
  # 装備ã§ããªã„拡張防具を外ã™
  for i in 5..armor_number
   change_equip(i, nil) unless equippable?(equips[i])
  end
 end
 #--------------------------------------------------------------------------
 # â—‹ EP æ¡ä»¶ã‚¯ãƒªã‚¢åˆ¤å®š
 #   equip_type : 装備部ä½
 #   item    : æ¦å™¨ or 防具
 #--------------------------------------------------------------------------
 def ep_condition_clear?(equip_type, item)
  return true if item == nil  # nil ã¯è§£é™¤ãªã®ã§ OK
Â
  curr_item = equips[equip_type]
  offset = (curr_item != nil ? curr_item.ep_cost : 0)
  return false if self.ep < (item.ep_cost - offset)  # EP ä¸è¶³
Â
  return true
 end
 #--------------------------------------------------------------------------
 # ○ 装備を修復
 #--------------------------------------------------------------------------
 def restore_equip
  return if @__last_equip_type == equip_type
Â
  # 以å‰ã®è£…å‚™å“・パラメータを退é¿
  last_equips = equips
  last_hp = self.hp
  last_mp = self.mp
  if $imported["SkillCPSystem"]
   last_battle_skill_ids = battle_skill_ids.clone
  end
Â
  # 全装備解除
  last_equips.each_index { |i| change_equip(i, nil) }
Â
  # 装備å“・パラメータを復元
  last_equips.compact.each { |item| equip_legal_slot(item) }
  self.hp = last_hp
  self.mp = last_mp
  if $imported["SkillCPSystem"]
   last_battle_skill_ids.each_with_index { |s, i| set_battle_skill(i, s) }
  end
  @__last_equip_type = equip_type.clone
  Graphics.frame_reset
 end
 #--------------------------------------------------------------------------
 # â—‹ 装備å“ã‚’æ£ã—ã„箇所ã«ã‚»ãƒƒãƒˆ
 #   item : æ¦å™¨ or 防具
 #--------------------------------------------------------------------------
 def equip_legal_slot(item)
  if item.is_a?(RPG::Weapon)
   if @weapon_id == 0
    # æ¦å™¨ 1
    change_equip(0, item)
   elsif two_swords_style && @armor1_id == 0
    # æ¦å™¨ 2 (二刀æµã®å ´åˆ)
    change_equip(1, item)
   end
  elsif item.is_a?(RPG::Armor)
   if !two_swords_style && item.kind == equip_type[0] && @armor1_id == 0
    # å…ˆé ã®é˜²å…· (二刀æµã§ãªã„å ´åˆ)
    change_equip(1, item)
   else
    # 装備箇所リストを作æˆ
    list = [-1, @armor2_id, @armor3_id, @armor4_id]
    list += extra_armor_id
    # æ£ã—ã„ã€ã‹ã¤ç©ºã„ã¦ã„る箇所ã«ã‚»ãƒƒãƒˆ
    equip_type.each_with_index { |kind, i|
     if kind == item.kind && list[i] == 0
      change_equip(i + 1, item)
      break
     end
    }
   end
  end
 end
end
Â
#=================================================#
Â
#==============================================================================
# â– Window_Base
#==============================================================================
Â
class Window_Base < Window
 #--------------------------------------------------------------------------
 # â—‹ EP ã®æ–‡å—色をå–å¾—
 #   actor : アクター
 #--------------------------------------------------------------------------
 def ep_color(actor)
  return knockout_color if actor.maxep > 0 && actor.ep == 0
  return normal_color
 end
 #--------------------------------------------------------------------------
 # â—‹ EP ゲージã®è‰² 1 ã®å–å¾—
 #--------------------------------------------------------------------------
 def ep_gauge_color1
  color = KGC::EquipExtension::EP_GAUGE_START_COLOR
  return (color.is_a?(Integer) ? text_color(color) : color)
 end
 #--------------------------------------------------------------------------
 # â—‹ EP ゲージã®è‰² 2 ã®å–å¾—
 #--------------------------------------------------------------------------
 def ep_gauge_color2
  color = KGC::EquipExtension::EP_GAUGE_END_COLOR
  return (color.is_a?(Integer) ? text_color(color) : color)
 end
 #--------------------------------------------------------------------------
 # â—‹ EP ã®æç”»
 #   actor : アクター
 #   x   : æ画先 X 座標
 #   y   : æ画先 Y 座標
 #   width : 幅
 #--------------------------------------------------------------------------
 def draw_actor_ep(actor, x, y, width = 120)
  draw_actor_ep_gauge(actor, x, y, width)
  self.contents.font.color = system_color
  self.contents.draw_text(x, y, 30, WLH, Vocab::ep_a)
  self.contents.font.color = ep_color(actor)
  xr = x + width
  if width < 120
   self.contents.draw_text(xr - 40, y, 40, WLH, actor.ep, 2)
  else
   self.contents.draw_text(xr - 90, y, 40, WLH, actor.ep, 2)
   self.contents.font.color = normal_color
   self.contents.draw_text(xr - 50, y, 10, WLH, "/", 2)
   self.contents.draw_text(xr - 40, y, 40, WLH, actor.maxep, 2)
  end
  self.contents.font.color = normal_color
 end
 #--------------------------------------------------------------------------
 # â—‹ EP ゲージã®æç”»
 #   actor : アクター
 #   x   : æ画先 X 座標
 #   y   : æ画先 Y 座標
 #   width : 幅
 #--------------------------------------------------------------------------
 def draw_actor_ep_gauge(actor, x, y, width = 120)
  gw = width * actor.ep / [actor.maxep, 1].max
  gc1 = ep_gauge_color1
  gc2 = ep_gauge_color2
  self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
  self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
 end
 #--------------------------------------------------------------------------
 # â—‹ 消費 EP ã®æç”»
 #   item   : æ¦å™¨ or 防具
 #   rect   : æç”»ã™ã‚‹é ˜åŸŸ
 #   enabled : 許å¯çŠ¶æ…‹
 #--------------------------------------------------------------------------
 def draw_equipment_ep_cost(item, rect, enabled = true)
  return if item == nil
  # 消費 EP 0 を表示ã—ãªã„å ´åˆ
  return if KGC::EquipExtension::HIDE_ZERO_EP_COST && item.ep_cost == 0
Â
  color = KGC::EquipExtension::EP_COST_COLOR
  self.contents.font.color = (color.is_a?(Integer) ?
   text_color(color) : color)
  self.contents.font.color.alpha = enabled ? 255 : 128
  self.contents.draw_text(rect, item.ep_cost, 2)
 end
end
Â
#=================================================#
Â
#==============================================================================
# â– Window_Equip
#==============================================================================
Â
class Window_Equip < Window_Selectable
 #--------------------------------------------------------------------------
 # ◠リフレッシュ
 #--------------------------------------------------------------------------
 def refresh
  self.contents.clear
  @data = @actor.equips.clone
  @item_max = [@data.size, @actor.armor_number + 1].min
  create_contents
Â
  # 装備箇所をæç”»
  self.contents.font.color = system_color
  if @actor.two_swords_style
   self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon1)
   self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::weapon2)
  else
   self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon)
   name = armor_slot_name(@actor.equip_type[0])
   self.contents.draw_text(4, WLH * 1, 92, WLH, name)
  end
  for i in [email=1...@actor.armor]1...@actor.armor[/email]_number
   name = armor_slot_name(@actor.equip_type[i])
   self.contents.draw_text(4, WLH * (i + 1), 92, WLH, name)
  end
Â
  # 装備å“ã‚’æç”»
  rect = Rect.new(92, 0, self.width - 128, WLH)
  @item_max.times { |i|
   rect.y = WLH * i
   draw_item_name(@data[i], rect.x, rect.y)
   draw_equipment_ep_cost(@data[i], rect)
  }
 end
 #--------------------------------------------------------------------------
 # â—‹ 防具欄ã®å称をå–å¾—
 #   kind : 種別
 #--------------------------------------------------------------------------
 def armor_slot_name(kind)
  case kind
  when 0..3
   return eval("Vocab.armor#{kind + 1}")
  else
   return Vocab.extra_armor(kind - 4)
  end
 end
Â
unless $imported["ExtendedEquipScene"]
 #--------------------------------------------------------------------------
 # ◠カーソルを 1 ページ後ã‚ã«ç§»å‹•
 #--------------------------------------------------------------------------
 def cursor_pagedown
  return if Input.repeat?(Input::R)
  super
 end
 #--------------------------------------------------------------------------
 # ◠カーソルを 1 ページå‰ã«ç§»å‹•
 #--------------------------------------------------------------------------
 def cursor_pageup
  return if Input.repeat?(Input::L)
  super
 end
 #--------------------------------------------------------------------------
 # ◠フレーム更新
 #--------------------------------------------------------------------------
 def update
  super
  return unless self.active
Â
  if Input.repeat?(Input::RIGHT)
   cursor_pagedown
  elsif Input.repeat?(Input::LEFT)
   cursor_pageup
  end
 end
end
Â
end
Â
#=================================================#
Â
#==============================================================================
# â– Window_EquipItem
#==============================================================================
Â
class Window_EquipItem < Window_Item
 #--------------------------------------------------------------------------
 # ◠リフレッシュ
 #--------------------------------------------------------------------------
 def refresh
  @item_enabled = []
  super
  @data.each { |item| @item_enabled << enable?(item) }
 end
 #--------------------------------------------------------------------------
 # ◠アイテムをリストã«å«ã‚ã‚‹ã‹ã©ã†ã‹
 #   item : アイテãƒ
 #--------------------------------------------------------------------------
 def include?(item)
  return true if item == nil
  if @equip_type == 0
   return false unless item.is_a?(RPG::Weapon)
  else
   return false unless item.is_a?(RPG::Armor)
   return false unless item.kind == @equip_type - 1
  end
  return @actor.equippable?(item)
 end
 #--------------------------------------------------------------------------
 # ◠アイテムを許å¯çŠ¶æ…‹ã§è¡¨ç¤ºã™ã‚‹ã‹ã©ã†ã‹
 #   item : アイテãƒ
 #--------------------------------------------------------------------------
 def enable?(item)
  return false unless @actor.equippable?(item)            # 装備ä¸å¯
  return false unless @actor.ep_condition_clear?(@equip_type, item)  # EP ä¸è¶³
Â
  return true
 end
 #--------------------------------------------------------------------------
 # â— é …ç›®ã®æç”»
 #   index : é …ç›®ç•ªå·
 #--------------------------------------------------------------------------
 def draw_item(index)
  super(index)  Â
  rect = item_rect(index)
  item = @data[index]
Â
  # 個数表示分ã®å¹…を削る
  cw = self.contents.text_size(sprintf(":%2d", 0)).width
  rect.width -= cw + 4
  draw_equipment_ep_cost(item, rect, enable?(item))
 end
 #--------------------------------------------------------------------------
 # ○ 簡易リフレッシュ
 #   equip_type : 装備部ä½
 #--------------------------------------------------------------------------
 def simple_refresh(equip_type)
  # 一時的ã«è£…備部ä½ã‚’変更
  last_equip_type = @equip_type
  @equip_type = equip_type
Â
  @data.each_with_index { |item, i|
   # 許å¯çŠ¶æ…‹ãŒå¤‰åŒ–ã—ãŸé …ç›®ã®ã¿å†æç”»
   if enable?(item) != @item_enabled[i]
    draw_item(i)
    @item_enabled[i] = enable?(item)
   end
  }
  # 装備部ä½ã‚’戻ã™
  @equip_type = last_equip_type
 end
end
Â
#=================================================#
Â
#==============================================================================
# â– Window_EquipStatus
#==============================================================================
Â
class Window_EquipStatus < Window_Base
 #--------------------------------------------------------------------------
 # ◠リフレッシュ
 #--------------------------------------------------------------------------
 alias refresh_KGC_EquipExtension refresh
 def refresh
  refresh_KGC_EquipExtension
Â
  draw_actor_ep(@actor, 120, 0, 56) if KGC::EquipExtension::USE_EP_SYSTEM
 end
end
Â
#=================================================#
Â
#==============================================================================
# â– Window_Status
#==============================================================================
Â
class Window_Status < Window_Base
Â
if KGC::EquipExtension::SHOW_STATUS_EP
 #--------------------------------------------------------------------------
 # â— åŸºæœ¬æƒ…å ±ã®æç”»
 #   x : æ画先 X 座標
 #   y : æ画先 Y 座標
 #--------------------------------------------------------------------------
 alias draw_basic_info_KGC_EquipExtension draw_basic_info
 def draw_basic_info(x, y)
  draw_basic_info_KGC_EquipExtension(x, y)
Â
  draw_actor_ep(@actor, x + 160, y + WLH * 4)
 end
end
Â
 #--------------------------------------------------------------------------
 # ◠装備å“ã®æç”»
 #   x : æ画先 X 座標
 #   y : æ画先 Y 座標
 #--------------------------------------------------------------------------
 def draw_equipments(x, y)
  self.contents.font.color = system_color
  self.contents.draw_text(x, y, 120, WLH, Vocab::equip)
Â
  item_number = [@actor.equips.size, @actor.armor_number + 1].min
  item_number.times { |i|
   draw_item_name(@actor.equips[i], x + 16, y + WLH * (i + 1))
  }
 end
end
Â
#=================================================#
Â
#==============================================================================
# â– Window_ShopStatus
#==============================================================================
Â
class Window_ShopStatus < Window_Base
 #--------------------------------------------------------------------------
 # ◠アクターã®ç¾è£…å‚™ã¨èƒ½åŠ›å€¤å¤‰åŒ–ã®æç”»
 #   actor : アクター
 #   x   : æ画先 X 座標
 #   y   : æ画先 Y 座標
 #--------------------------------------------------------------------------
 def draw_actor_parameter_change(actor, x, y)
  return if @item.is_a?(RPG::Item)
  enabled = actor.equippable?(@item)
  self.contents.font.color = normal_color
  self.contents.font.color.alpha = enabled ? 255 : 128
  self.contents.draw_text(x, y, 200, WLH, actor.name)
  if @item.is_a?(RPG::Weapon)
   item1 = weaker_weapon(actor)
  elsif actor.two_swords_style and @item.kind == 0
   item1 = nil
  else
   index = actor.equip_type.index(@item.kind)
   item1 = (index != nil ? actor.equips[1 + index] : nil)
  end
  if enabled
   if @item.is_a?(RPG::Weapon)
    atk1 = item1 == nil ? 0 : item1.atk
    atk2 = @item == nil ? 0 : @item.atk
    change = atk2 - atk1
   else
    def1 = item1 == nil ? 0 : item1.def
    def2 = @item == nil ? 0 : @item.def
    change = def2 - def1
   end
   self.contents.draw_text(x, y, 200, WLH, sprintf("%+d", change), 2)
  end
  draw_item_name(item1, x, y + WLH, enabled)
 end
end
Â
#=================================================#
Â
#==============================================================================
# â– Scene_Equip
#==============================================================================
Â
class Scene_Equip < Scene_Base
 #--------------------------------------------------------------------------
 # ◠定数
 #--------------------------------------------------------------------------
 EQUIP_TYPE_MAX = KGC::EquipExtension::EXTRA_EQUIP_KIND.size + 5
 #--------------------------------------------------------------------------
 # ◠オブジェクトåˆæœŸåŒ–
 #   actor_index : アクターインデックス
 #   equip_index : 装備インデックス
 #--------------------------------------------------------------------------
 alias initialize_KGC_EquipExtension initialize
 def initialize(actor_index = 0, equip_index = 0)
  initialize_KGC_EquipExtension(actor_index, equip_index)
Â
  unit = ($imported["LargeParty"] ?
   $game_party.all_members : $game_party.members)
  actor = unit[actor_index]
  @equip_index = [@equip_index, actor.armor_number].min
 end
 #--------------------------------------------------------------------------
 # ◠アイテムウィンドウã®ä½œæˆ
 #--------------------------------------------------------------------------
 alias create_item_windows_KGC_EquipExtension create_item_windows
 def create_item_windows
  create_item_windows_KGC_EquipExtension
Â
  kind = equip_kind(@equip_index)
  EQUIP_TYPE_MAX.times { |i|
   @item_windows[i].visible = (kind == i)
  }
 end
 #--------------------------------------------------------------------------
 # ◠アイテムウィンドウã®æ›´æ–°
 #--------------------------------------------------------------------------
 def update_item_windows
  kind = equip_kind(@equip_window.index)
  for i in 0...EQUIP_TYPE_MAX
   @item_windows[i].visible = (kind == i)
   @item_windows[i].update
  end
  @item_window = @item_windows[kind]
  @item_window.simple_refresh(@equip_window.index)
 end
 #--------------------------------------------------------------------------
 # â—‹ 装備欄ã®ç¨®åˆ¥ã‚’å–å¾—
 #   index : 装備欄インデックス
 #--------------------------------------------------------------------------
 def equip_kind(index)
  if index == 0
   return 0
  else
   return @actor.equip_type[index - 1] + 1
  end
 end
Â
unless $imported["ExtendedEquipScene"]
 #--------------------------------------------------------------------------
 # ◠ステータスウィンドウã®æ›´æ–°
 #--------------------------------------------------------------------------
 def update_status_window
  if @equip_window.active
   @status_window.set_new_parameters(nil, nil, nil, nil)
  elsif @item_window.active
   temp_actor = Marshal.load(Marshal.dump(@actor))
   temp_actor.change_equip(@equip_window.index, @item_window.item, true)
   new_atk = temp_actor.atk
   new_def = temp_actor.def
   new_spi = temp_actor.spi
   new_agi = temp_actor.agi
   @status_window.set_new_parameters(new_atk, new_def, new_spi, new_agi)
  end
  @status_window.update
 end
end
Â
 #--------------------------------------------------------------------------
 # ◠アイテムé¸æŠžã®æ›´æ–°
 #--------------------------------------------------------------------------
 alias update_item_selection_KGC_EquipExtension update_item_selection
 def update_item_selection
  if Input.trigger?(Input::C)
   # 装備ä¸å¯èƒ½ãªå ´åˆ
   index = @equip_window.index
   item = @item_window.item
   unless item == nil ||
     (@actor.equippable?(item) && @actor.ep_condition_clear?(index, item))
    Sound.play_buzzer
    return
   end
  end
Â
  update_item_selection_KGC_EquipExtension
 end
end
Â
#=================================================#
Â
#==============================================================================
# â– Scene_File
#==============================================================================
Â
class Scene_File < Scene_Base
 #--------------------------------------------------------------------------
 # ◠セーブデータã®èªã¿è¾¼ã¿
 #   file : èªã¿è¾¼ã¿ç”¨ãƒ•ã‚¡ã‚¤ãƒ«ã‚ªãƒ–ジェクト (オープン済ã¿)
 #--------------------------------------------------------------------------
 alias read_save_data_KGC_EquipExtension read_save_data
 def read_save_data(file)
  read_save_data_KGC_EquipExtension(file)
Â
  KGC::Commands.restore_equip
  Graphics.frame_reset
 end
end
Â
If you are wondering I have the codes placed like this as I was trying to fix my problem by myself...
Ammo
KGC Equip_Extension
Redefinitions
Game_ammo
I would greatly appreciate any assistance with this issue, and thank you for your time if you are even reading this.