Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Requesting Skills learned from equips.

I know someone requested this before. A skill system like FF9. Every equipment has an assigned skill/stat enchancement that a hero will learn if certain amount AP for that skill is reached. Allows learning of Passive/Offensive Skills.

Example(Passive)
Cotton Suit
Skill: HP+50(Permanent stat increase if (X)AP is reached.)
AP:15

Example: (Offensive)
Broad Sword
Skill: Vertical Slash
AP:35

*If two weapons has the same skill:
EX: Broad Sword--->Vertical Slash(AP35)
Bronse Sword--> Vertical Slash(AP35)
Even if you switch weapons, the aquired AP for the skill of the first equip will continue.
EX: You have 20AP out of 35AP for Broad Sword.
You change your equip with Bronse Sword.
The AP for bronse sword will not return to 0 but will also be 20Ap like the Broad Sword. If you mastered the skill, any equip with desame skill is also mastered.

I am not expecting of a quick reply but can anyone do this. I know many are also dying to have a skill system like this.
 
Try with this:
Code:
#==============================================================================
# ** Equipment Skills
#------------------------------------------------------------------------------
# SephirothSpawn
# 2006-03-12
# Version 1.1
#------------------------------------------------------------------------------
# * Instructions
#   ~ Show Victory Skills Window
#       - SHOW_VICTORY_SKILLS = true or false
#   ~ Show only Mastered Skills
#       - SHOW_ONLY_MASTERED = true or false
#   ~ Cannot Learn Skills through AP
#       - CANNOT_LEARN_SKILLS = true or false
#   ~ Default Enemy AP
#       - DEFAULT_ENEMY_AP = #
#   ~ Enemy AP Amounts
#       - ENEMY_AP_VALUES = { enemy_id => ap_amount, ... }
#       - (All Unassigned Ap Amounts will be the default)
#   ~ Weapon Skills
#       - WEAPON_SKILLS = { weapon_id => { skill_id, required_ap }, ... }
#   ~ Armor Skills
#       - ARMOR_SKILLS = { armor_id => { skill_id, required_ap }, ... }
# * Too see the Equipment Skills, press A in Scene_Skill & Scene_Shop
#==============================================================================

#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('Equipment Skills', 'SephirothSpawn', 1.1, '2006-03-12')

#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.state('Equipment Skills') == true

#==============================================================================
# ** Equipment_Skill_Learning
#==============================================================================

module Equipment_Skill_Learning
  #--------------------------------------------------------------------------
  # * Show Victory Skills Window
  #--------------------------------------------------------------------------
  SHOW_VICTORY_SKILLS = true
  #--------------------------------------------------------------------------
  # * Victory Skills Window : Show Only Mastered Skills
  #--------------------------------------------------------------------------
  SHOW_ONLY_MASTERED = true
  #--------------------------------------------------------------------------
  # * Cannot Learn Skills (Only get skills with equipment
  #--------------------------------------------------------------------------
  CANNOT_LEARN_SKILLS = false
  #--------------------------------------------------------------------------
  # * Default AP Given By Enemy
  #--------------------------------------------------------------------------
  DEFAULT_ENEMY_AP = 1
  #--------------------------------------------------------------------------
  # * Assigned AP for enemies
  #   ~ enemy_id => ap
  #--------------------------------------------------------------------------
  ENEMY_AP_VALUES = {
    1 => 3
  }
  #--------------------------------------------------------------------------
  # * Weapon Skills
  #   ~ weapon_id => { skill_id, required_ap }
  #--------------------------------------------------------------------------
  WEAPON_SKILLS = {
    1 => { 57 => 25, 58 => 50, 59 => 100, 60 => 200 },
    5 => { 61 => 25, 62 => 50, 63 => 100, 64 => 200 },
    25 => { 73 => 25, 74 => 50, 75 => 100, 76 => 200 },
    29 => { 77 => 25, 78 => 50, 79 => 100, 80 => 200 }
  }
  #--------------------------------------------------------------------------
  # * Armor Skills
  #   ~ armor_id => { skill_id, required_ap }
  #--------------------------------------------------------------------------
  ARMOR_SKILLS = {
    1 => { 1 => 30, 4 => 40 },
    5 => { 55 => 50 },
    9 => { 33 => 25, 35 => 60 },
    13 => { 56 => 60 },
    17 => { 56 => 50 },
    21 => { 37 => 25, 39 => 60 },
    25 => { 53 => 35 },
    26 => { 54 => 50 },
    29 => { 7 => 25, 8 => 50, 9 => 100 },
    30 => { 10 => 25, 11 => 50, 12 => 100 }
  }
end

#==============================================================================
# ** Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Include Equipment_Skill_Learning
  #--------------------------------------------------------------------------
  include Equipment_Skill_Learning
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :weapon_ap, :armor_ap
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias seph_weaponskills_gameactor_setup setup
  alias seph_weaponskills_gameactor_skills skills
  alias seph_weaponskills_gameactor_scu skill_can_use?
  #--------------------------------------------------------------------------
  # * Setup
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  def setup(actor_id)
    # Original Initialization
    seph_weaponskills_gameactor_setup(actor_id)
    # Creates Weapon AP
    @weapon_ap, @armor_ap = {}, {}
    # Adds In Weapon Skills and AP Amounts
    WEAPON_SKILLS.each { |weapon_id, skills|
      # Adds Weapon to Weapon Array
      @weapon_ap[weapon_id] = {}
      # Adds Weapon Skills and sets AP count
      skills.keys.each { |skill_id| @weapon_ap[weapon_id][skill_id] = 0 }
    }
    # Adds In Armor Skills and AP Amounts
    ARMOR_SKILLS.each { |armor_id, skills|
      # Adds Weapon to Weapon Array
      @armor_ap[armor_id] = {}
      # Adds Weapon Skills and sets AP count
      skills.keys.each { |skill_id| @armor_ap[armor_id][skill_id] = 0 }
    }
  end
  #--------------------------------------------------------------------------
  # * Determine if Skill can be Used
  #     skill_id : skill ID
  #--------------------------------------------------------------------------
  def skill_can_use?(skill_id)
    if self.skills.include?(skill_id)
      return super
    end
    # Original Skill Can use Method
  seph_weaponskills_gameactor_scu(skill_id)
  end
  #--------------------------------------------------------------------------
  # * Skills
  #--------------------------------------------------------------------------
  def skills
    # Gets Previous Skills
    s = seph_weaponskills_gameactor_skills.dup
    # Adds in Equipped Skills
    s.push(get_current_equipped_skills).dup
    # Adds in Mastered Skills
    s.push(get_mastered_skills).dup
    # Returns New Skills
    return s.flatten.sort.uniq.dup
  end
  #--------------------------------------------------------------------------
  # * Get Current Equipped Skills
  #--------------------------------------------------------------------------
  def get_current_equipped_skills
    # Creates Skills Array
    skills = []
    # Collects Weapon Skills
    unless @weapon_id == 0
      # Gets Weapon Skills
      if WEAPON_SKILLS.has_key?(@weapon_id)
        weapon_skills = WEAPON_SKILLS[@weapon_id]
        # Adds in Skills
        weapon_skills.keys.each { |skill_id| skills << skill_id }
      end
    end
    # Collects Shield Skills
    unless @armor1_id == 0
      # Gets Shield Skills
      if ARMOR_SKILLS.has_key?(@armor1_id)
        shield_skills = ARMOR_SKILLS[@armor1_id]
        # Adds in Skills
        shield_skills.keys.each { |skill_id| skills << skill_id }
      end
    end
    # Collects Helmet Skills
    unless @armor2_id == 0
      # Gets Helmet Skills
      if ARMOR_SKILLS.has_key?(@armor2_id)
        helmet_skills = ARMOR_SKILLS[@armor2_id]
        # Adds in Skills
        helmet_skills.keys.each { |skill_id| skills << skill_id }
      end
    end
    # Collects Body Armor Skills
    unless @armor3_id == 0
      # Gets Armor Skills
      if ARMOR_SKILLS.has_key?(@armor3_id)
        armor_skills = ARMOR_SKILLS[@armor3_id]
        # Adds in Skills
        armor_skills.keys.each { |skill_id| skills << skill_id }
      end
    end
    # Collects Accessory Skills
    unless @armor4_id == 0
      # Gets Accessory Skills
      if ARMOR_SKILLS.has_key?(@armor4_id)
        acc_skills = ARMOR_SKILLS[@armor4_id]
        # Adds in Skills
        acc_skills.keys.each { |skill_id| skills << skill_id }
      end
    end
    # Sends Skills Array
    return skills
  end
  #--------------------------------------------------------------------------
  # * Get Mastered Skills
  #--------------------------------------------------------------------------
  def get_mastered_skills
    # Creates Skills Array
    skills = []
    # Collects Matered Weapon Skills
    WEAPON_SKILLS.each { |weapon_id, skill_data|
      weapon_skills = WEAPON_SKILLS[weapon_id]
      # Passes through each skill
      weapon_skills.each { |skill_id, master_ap|
        if @weapon_ap[weapon_id][skill_id] == master_ap
          skills << skill_id
        end
      }
    }
    # Collects Matered Armor Skills
    ARMOR_SKILLS.each { |armor_id, skill_data|
      armor_skills = ARMOR_SKILLS[armor_id]
      # Passes through each skill
      armor_skills.each { |skill_id, master_ap|
        if @armor_ap[armor_id][skill_id] == master_ap
          skills << skill_id
        end
      }
    }
    # Sends Skills Array
    return skills
  end
  #--------------------------------------------------------------------------
  # * Earn AP
  #--------------------------------------------------------------------------
  def earn_ap(amount = 0)
    # Exits if Cannot Learn Skills
    return if CANNOT_LEARN_SKILLS
    # Earns Weapon AP
    unless @weapon_id == 0
      # If Skills Possessed
      if WEAPON_SKILLS.has_key?(@weapon_id)
        @weapon_ap[@weapon_id].each { |skill_id, ap|
          max = WEAPON_SKILLS[@weapon_id][skill_id]
          @weapon_ap[@weapon_id][skill_id] = [ap + amount, max].min
        }
      end
    end
    # Earns Shield AP
    unless @armor1_id == 0
      # If Skills Possessed
      if ARMOR_SKILLS.has_key?(@armor1_id)
        @armor_ap[@armor1_id].each { |skill_id, ap|
          max = ARMOR_SKILLS[@armor1_id][skill_id]
          @armor_ap[@armor1_id][skill_id] = [ap + amount, max].min
        }
      end
    end
    # Earns Helmet AP
    unless @armor2_id == 0
      # If Skills Possessed
      if ARMOR_SKILLS.has_key?(@armor2_id)
        @armor_ap[@armor2_id].each { |skill_id, ap|
          max = ARMOR_SKILLS[@armor2_id][skill_id]
          @armor_ap[@armor2_id][skill_id] = [ap + amount, max].min
        }
      end
    end
    # Earns Body Armor AP
    unless @armor3_id == 0
      # If Skills Possessed
      if ARMOR_SKILLS.has_key?(@armor3_id)
        @armor_ap[@armor3_id].each { |skill_id, ap|
          max = ARMOR_SKILLS[@armor3_id][skill_id]
          @armor_ap[@armor3_id][skill_id] = [ap + amount, max].min
        }
      end
    end
    # Earns Accessory AP
    unless @armor4_id == 0
      # If Skills Possessed
      if ARMOR_SKILLS.has_key?(@armor4_id)
        @armor_ap[@armor4_id].each { |skill_id, ap|
          max = ARMOR_SKILLS[@armor4_id][skill_id]
          @armor_ap[@armor4_id][skill_id] = [ap + amount, max].min
        }
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Get Equipment Skills
  #--------------------------------------------------------------------------
  def get_learning_skills
    skills = {}
    # Collects Weapon Skills
    unless @weapon_id == 0
      # Gets Weapon Skills
      if WEAPON_SKILLS.has_key?(@weapon_id)
        @weapon_ap[@weapon_id].each { |skill_id, ap|
          skills[skill_id] = [ap, WEAPON_SKILLS[@weapon_id][skill_id]]
        }
      end
    end
    # Collects Armor Skills
    unless @armor1_id == 0
      # Gets Weapon Skills
      if ARMOR_SKILLS.has_key?(@armor1_id)
        @armor_ap[@armor1_id].each { |skill_id, ap|
          skills[skill_id] = [ap, ARMOR_SKILLS[@armor1_id][skill_id]]
        }
      end
    end
    unless @armor2_id == 0
      # Gets Weapon Skills
      if ARMOR_SKILLS.has_key?(@armor2_id)
        @armor_ap[@armor2_id].each { |skill_id, ap|
          skills[skill_id] = [ap, ARMOR_SKILLS[@armor2_id][skill_id]]
        }
      end
    end
    unless @armor3_id == 0
      # Gets Weapon Skills
      if ARMOR_SKILLS.has_key?(@armor3_id)
        @armor_ap[@armor3_id].each { |skill_id, ap|
          skills[skill_id] = [ap, ARMOR_SKILLS[@armor3_id][skill_id]]
        }
      end
    end
    unless @armor4_id == 0
      # Gets Weapon Skills
      if ARMOR_SKILLS.has_key?(@armor4_id)
        @armor_ap[@armor4_id].each { |skill_id, ap|
          skills[skill_id] = [ap, ARMOR_SKILLS[@armor4_id][skill_id]]
        }
      end
    end
    return skills
  end
end

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

class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Include Equipment_Skill_Learning
  #--------------------------------------------------------------------------
  include Equipment_Skill_Learning
  #--------------------------------------------------------------------------
  # Draw Bar
  #--------------------------------------------------------------------------
  def draw_bar(x, y, min, max, width = 152, height = 6,
    bar_color = Color.new(150, 0, 0), end_color = Color.new(255, 255, 60))
    # Draw Background
    self.contents.fill_rect(x, y, width, height, Color.new(50, 50, 50, 255))
    # Draws Bar
    for i in 1..( (min.to_f / max.to_f) * width - 3)
      r = bar_color.red * (width - i) / width + end_color.red * i / width
      g = bar_color.green * (width - i) / width + end_color.green * i / width
      b = bar_color.blue * (width - i) / width + end_color.blue * i / width
      a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
      self.contents.fill_rect(x + 1 + i, y + 1, 1, height - 2, 
        Color.new(r, g, b, a))
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Skill Learn Status
  #--------------------------------------------------------------------------
  def draw_skill_learn_status(skill_id, skill_data, x, width = 160)
    # If In Battle
    if $game_temp.in_battle
      # If Show Only Mastered
      if SHOW_ONLY_MASTERED
        # If Mastered
        unless skill_data[0] == skill_data[1]
          return
        end
      end
    end
    # Gets Skill
    skill = $data_skills[skill_id]
    # Gets Icon
    bitmap = RPG::Cache.icon(skill.icon_name)    # Draws Icon
    self.contents.blt(x + 4, @y + 4, bitmap, Rect.new(0, 0, 24, 24))
    # Draws Skill Name
    self.contents.draw_text(x + 32, @y, 128, 16, skill.name)
    # Draws Status Bar
    draw_bar(x + width - 64, @y + 16, skill_data[0], skill_data[1], 64, 16)
    # Draws Progress
    text = skill_data[0] == skill_data[1] ? 
      'Mastered' : "#{skill_data[0] } / #{skill_data[1]}"
    self.contents.draw_text(x - 4, @y + 16, width, 16, text, 2)
    # Adds to Y
    @y += 32
  end
end

#==============================================================================
# ** Window_Skill
#==============================================================================

class Window_Skill < Window_Selectable
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias seph_weaponskills_windskill_drawitem draw_item
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    # If Equipment Skill
    skill = @data[index]
    change = false
    unless @actor.weapon_id == 0
      if WEAPON_SKILLS.has_key?(@actor.weapon_id)
        if @actor.weapon_ap[@actor.weapon_id].has_key?(skill.id)
          change = true
        end
      end
    end
    unless @actor.armor1_id == 0
      if ARMOR_SKILLS.has_key?(@actor.armor1_id)
        if @actor.armor_ap[@actor.armor1_id].has_key?(skill.id)
          change = true
        end
      end
    end
    unless @actor.armor2_id == 0
      if ARMOR_SKILLS.has_key?(@actor.armor2_id)
        if @actor.armor_ap[@actor.armor2_id].has_key?(skill.id)
          change = true
        end
      end
    end
    unless @actor.armor3_id == 0
      if ARMOR_SKILLS.has_key?(@actor.armor3_id)
        if @actor.armor_ap[@actor.armor3_id].has_key?(skill.id)
          change = true
        end
      end
    end
    unless @actor.armor4_id == 0
      if ARMOR_SKILLS.has_key?(@actor.armor4_id)
        if @actor.armor_ap[@actor.armor4_id].has_key?(skill.id)
          change = true
        end
      end
    end
    # If In Battle Override
    if $game_temp.in_battle || CANNOT_LEARN_SKILLS
      change = false
    end
    if change
      # Set Font Props
      self.contents.font.size = 16
      self.contents.font.bold = true
    else
      self.contents.font.size = 22
      self.contents.font.bold = false
    end
    # Original Draw Item Method
    seph_weaponskills_windskill_drawitem(index)
    # If Equipment Skill
    if change
      x, y = 4 + index % 2 * (288 + 32), index / 2 * 32
      # Gets AP & Max
      if @actor.weapon_ap.has_key?(@actor.weapon_id)
        if @actor.weapon_ap[@actor.weapon_id].has_key?(skill.id)
          ap = @actor.weapon_ap[@actor.weapon_id][skill.id]
          max = WEAPON_SKILLS[@actor.weapon_id][skill.id]
        end
      end
      if @actor.armor_ap.has_key?(@actor.armor1_id)
        if @actor.armor_ap[@actor.armor1_id].has_key?(skill.id)
          ap = @actor.armor_ap[@actor.armor1_id][skill.id]
          max = ARMOR_SKILLS[@actor.armor1_id][skill.id]
        end
      end
      if @actor.armor_ap.has_key?(@actor.armor2_id)
        if @actor.armor_ap[@actor.armor2_id].has_key?(skill.id)
          ap = @actor.armor_ap[@actor.armor2_id][skill.id]
          max = ARMOR_SKILLS[@actor.armor2_id][skill.id]
        end
      end
      if @actor.armor_ap.has_key?(@actor.armor3_id)
        if @actor.armor_ap[@actor.armor3_id].has_key?(skill.id)
          ap = @actor.armor_ap[@actor.armor3_id][skill.id]
          max = ARMOR_SKILLS[@actor.armor3_id][skill.id]
        end
      end
      if @actor.armor_ap.has_key?(@actor.armor4_id)
        if @actor.armor_ap[@actor.armor4_id].has_key?(skill.id)
          ap = @actor.armor_ap[@actor.armor4_id][skill.id]
          max = ARMOR_SKILLS[@actor.armor4_id][skill.id]
        end
      end
      unless ap.nil?
        # Draws Status Bar
        draw_bar(x + 132, y + 10, ap, max, 96, 14)
        # Draws Progress
        text = ap == max ? 'Mastered' : "#{ap} / #{max}"
        self.contents.draw_text(x + 132, y, 92, 32, text, 2)
      end
    end
  end
end

#==============================================================================
# ** Window_WSAP_Aquired
#==============================================================================

class Window_WSAP_Aquired < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(troop_id, y = 196)
    height = $data_troops[troop_id].members.size * 24 +56
    super(160, y, 320, height)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 160
    self.visible = false
    self.z = 9999
    refresh(troop_id)
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh(troop_id)
    self.contents.clear
    # Gets AP Earned
    ap = get_earned_ap(troop_id)
    # Draws Heading
    self.contents.font.color = system_color
    self.contents.draw_text(16, 0, contents.width - 32, 24, 'AP Aquired:')
    self.contents.draw_text(16, 0, contents.width - 32, 24, ap.to_s, 2)
    # Draws Enemies Names, and AP Given
    self.contents.font.color = normal_color
    enemies = $data_troops[troop_id].members
    for i in 0...enemies.size
      enemy = $data_enemies[enemies[i].enemy_id]
      self.contents.draw_text(4, i * 24 + 24, contents.width - 8, 24, 
        enemy.name)
      ap = ENEMY_AP_VALUES.has_key?(enemy.id) ? 
        ENEMY_AP_VALUES[enemy.id] : DEFAULT_ENEMY_AP
      self.contents.draw_text(4, i * 24 + 24, contents.width - 8, 24, 
        ap.to_s, 2)
    end
  end
  #--------------------------------------------------------------------------
  # * Get Earned AP
  #--------------------------------------------------------------------------
  def get_earned_ap(troop_id)
    ap = 0
    for enemy in $data_troops[troop_id].members
      enemy = $data_enemies[enemy.enemy_id]
      ap += (ENEMY_AP_VALUES.has_key?(enemy.id) ?
        ENEMY_AP_VALUES[enemy.id] : DEFAULT_ENEMY_AP)
    end
    return ap
  end
end

#==============================================================================
# ** Window_BattleStatus
#==============================================================================

class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Refresh Skill Status
  #--------------------------------------------------------------------------
  def refresh_skills_status
    # Alters Windows Contsnts
    if SHOW_ONLY_MASTERED
      h = 0
      for actor in $game_party.actors
        o_h = 0
        actor.get_learning_skills.values.each {|skill_data|
          if skill_data[0] == skill_data[1]
            o_h += 1
          end
        }
        h = [h, o_h].max
      end
      h *= 32
    else
      h = 0
      for actor in $game_party.actors
        h = [h, actor.get_learning_skills.size * 32].max
      end
    end
    self.contents = Bitmap.new(width - 32, [128, h].max)
    # Draws Skill Stuff
    for i in 0...$game_party.actors.size
      # Fixes Font
      self.contents.font.size = 14
      self.contents.font.bold = true
      x, actor = 160 * i, $game_party.actors[i]
      @y = 0
      # Draws Skills
      actor.get_learning_skills.each {|skill_id, skill_data|
        draw_skill_learn_status(skill_id, skill_data, x, 128)
      }
      # Draws no skills Mastered
      if @y == 0
        # Fixes Font
        self.contents.font.size = 22
        self.contents.font.bold = false
        actor_x = i * 160 + 4
        draw_actor_name(actor, actor_x, 0)
        draw_actor_hp(actor, actor_x, 32, 120)
        draw_actor_sp(actor, actor_x, 64, 120)
        if @level_up_flags[i]
          self.contents.font.color = normal_color
          self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
        else
          draw_actor_state(actor, actor_x, 96)
        end
      end
    end
  end
end

#==============================================================================
# ** Window_WSEquipment_Skills
#==============================================================================

class Window_WSEquipment_Skills < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(222, 120, 196, 240)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.visible = false
    self.z = 9999
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh(actor_id, equipment)
    @actor_id, @equipment = actor_id, equipment
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.font.size = 22
    self.contents.font.bold = false
    # If No Equipment
    if equipment.nil?
      self.contents.draw_text(0, 0, contents.width, 32, 'Nothing Equipped', 1)
      return
    end
    # If Equipment is a item
    if equipment.is_a?(RPG::Item)
      self.contents.draw_text(0, 0, contents.width, 32, 
        'No Skills for Items', 1)
      return
    end
    # Draws Equipment
    bitmap = RPG::Cache.icon(equipment.icon_name)
    self.contents.blt(4, 4, bitmap, Rect.new(0, 0, 24, 24))
    self.contents.draw_text(32, 0, 128, 32, equipment.name, 1)
    # Gets Equipment Skills
    if equipment.is_a?(RPG::Weapon)
      equipment_skills = WEAPON_SKILLS.has_key?(equipment.id) ?
        WEAPON_SKILLS[equipment.id] : []
    else
      equipment_skills = ARMOR_SKILLS.has_key?(equipment.id) ?
        ARMOR_SKILLS[equipment.id] : []
    end
    # Draws Skills
    self.contents.font.color = normal_color
    self.contents.font.size = 14
    self.contents.font.bold = true
    if equipment_skills.size == 0
      self.contents.draw_text(0, 32, contents.width, 32, 'None', 1)
    else
      @y = 32
      equipment_skills.each { |skill_id, max|
        unless actor_id == -1
          actor = $game_party.actors[actor_id]
          ap = equipment.is_a?(RPG::Weapon) ? actor.weapon_ap[equipment.id][skill_id] :
            actor.armor_ap[equipment.id][skill_id]
        else
          ap = 0
        end
        draw_skill_learn_status(skill_id, [ap, max], 4, 160) }
    end
  end
end

#==============================================================================
# ** Scene_Equip
#==============================================================================

class Scene_Equip
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias seph_weaponskills_sceneequip_main main
  alias seph_weaponskills_sceneequip_update update
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Weapon Skill Status Window
    @weapon_skill_status_window = Window_WSEquipment_Skills.new
    # Stores Indexes
    @r_index, @i_index = @equip_index, 0
    # Original Main Method
    seph_weaponskills_sceneequip_main
    # Disposes Skill Status Window
    @weapon_skill_status_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # If A Button is Pressed
    if Input.trigger?(Input::A)
      # Play Cursor SE
      $game_system.se_play($data_system.cursor_se)
      # If Window is off
      unless @weapon_skill_status_window.visible
        # Turn On Window
        @weapon_skill_status_window.visible = true
        # Refresh Window
        refresh_weapon_skills_window
      else
        # Turns Off Window
        @weapon_skill_status_window.visible = false
      end
    end
    # If Window On
    if @weapon_skill_status_window.visible
      # If Right Window Active
      if @right_window.active
        # If Index is different
        unless @right_window.index == @r_index
          @r_index = @right_window.index
          # Refresh Weappn Skills Window
          refresh_weapon_skills_window
        end
      elsif @item_window.active
        # If Index is different
        unless @item_window.index == @i_index
          @i_index = @item_window.index
          # Refresh Weappn Skills Window
          refresh_weapon_skills_window
        end
      end
    end
    # Original Update Method
    seph_weaponskills_sceneequip_update
  end
  #--------------------------------------------------------------------------
  # * Refresh : Weappn Skills Window
  #--------------------------------------------------------------------------
  def refresh_weapon_skills_window
    # Refresh Window
    if @right_window.active
      @weapon_skill_status_window.refresh(@actor_index, @right_window.item)
    elsif @item_window.active
      @weapon_skill_status_window.refresh(@actor_index, @item_window.item)
    end
  end
end

#==============================================================================
# ** Scene_Battle
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Include Equipment_Skill_Learning
  #--------------------------------------------------------------------------
  include Equipment_Skill_Learning
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias seph_weaponskills_scenebattle_main main
  alias seph_weaponskills_scenebattle_sp5 start_phase5
  alias seph_weaponskills_scenebattle_up5 update_phase5
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Original Main Method
    seph_weaponskills_scenebattle_main
    # Disposes AP Aquired Window
    @ap_result_window.dispose unless @ap_result_window.nil?
  end
  #--------------------------------------------------------------------------
  # * Start After Battle Phase
  #--------------------------------------------------------------------------
  def start_phase5
    # Orignal Start Phase 5 Method
    seph_weaponskills_scenebattle_sp5
    # Gain AP
    unless CANNOT_LEARN_SKILLS
      ap = 0
      for enemy in $data_troops[@troop_id].members
        enemy = $data_enemies[enemy.enemy_id]
        ap += (ENEMY_AP_VALUES.has_key?(enemy.id) ?
          ENEMY_AP_VALUES[enemy.id] : DEFAULT_ENEMY_AP)
      end
      for actor in $game_party.actors
        actor.earn_ap(ap)
      end
    end
    # Y
    y = 160 + @result_window.height / 2
    # If You can Learn Skills
    unless CANNOT_LEARN_SKILLS
      # Creates Aquired Ap Window
      @ap_result_window = Window_WSAP_Aquired.new(@troop_id, y)
      # Adds to Y
      y += @ap_result_window.height
    end
    # Show Victory Skills Window
    if SHOW_VICTORY_SKILLS
   #   @status_window.refresh_skills_status
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (after battle phase)
  #--------------------------------------------------------------------------
  def update_phase5
    # Orignal Update Phase 5 Method
    seph_weaponskills_scenebattle_up5
    # Show AP Result Window
    unless CANNOT_LEARN_SKILLS
      @ap_result_window.visible = @result_window.visible
    end
    # Show Victory Skills Window
    if SHOW_VICTORY_SKILLS
      if @phase5_wait_count == 0
        @phase5_wait_count -= 1
        @status_window.refresh_skills_status
      end
      if @status_window.contents.height > 128
        if Input.press?(Input::UP)
          if @status_window.oy > 0
            @status_window.oy -= 8
          end
        elsif Input.press?(Input::DOWN)
          if @status_window.oy < @status_window.contents.height - 128
            @status_window.oy += 8
          end
        end
      end
    end
  end
end

#==============================================================================
# ** Scene_Shop
#==============================================================================

class Scene_Shop
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias seph_weaponskills_sceneshop_main main
  alias seph_weaponskills_sceneshop_update update
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Weapon Skill Status Window
    @weapon_skill_status_window = Window_WSEquipment_Skills.new
    # Stores Index
    @b_index, @s_index = 0, 0
    # Original Main Method
    seph_weaponskills_sceneshop_main
    # Disposes Skill Status Window
    @weapon_skill_status_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # If buy window is active: call update_buy
    if @buy_window.active || @sell_window.active
      # Update Weapon Skills
      update_seph_weapon_skills
    else
      if @weapon_skill_status_window.visible
        @weapon_skill_status_window.visible = false
      end
    end
    # Orignal Update Method
    seph_weaponskills_sceneshop_update
  end
  #--------------------------------------------------------------------------
  # * Frame Update : Weapon Skills
  #--------------------------------------------------------------------------
  def update_seph_weapon_skills
    # If A Button is Pressed
    if Input.trigger?(Input::A)
      # Play Cursor SE
      $game_system.se_play($data_system.cursor_se)
      # If Window is off
      unless @weapon_skill_status_window.visible
        # Turn On Window
        @weapon_skill_status_window.visible = true
        # Refresh Window
        refresh_weapon_skills_window
      else
        # Turns Off Window
        @weapon_skill_status_window.visible = false
      end
    end
    # If Window On
    if @weapon_skill_status_window.visible
      # If Right Window Active
      if @buy_window.active
        # If Index is different
        unless @buy_window.index == @b_index
          @b_index = @buy_window.index
          # Refresh Weappn Skills Window
          refresh_weapon_skills_window
        end
      elsif @sell_window.active
        # If Index is different
        unless @sell_window.index == @s_index
          @s_index = @sell_window.index
          # Refresh Weappn Skills Window
          refresh_weapon_skills_window
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh : Weappn Skills Window
  #--------------------------------------------------------------------------
  def refresh_weapon_skills_window
    # Refresh Window
    if @buy_window.active
      @weapon_skill_status_window.refresh(-1, @buy_window.item)
    elsif @sell_window.active
      @weapon_skill_status_window.refresh(-1, @sell_window.item)
    end
  end
end
  
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end
Requires SDK!
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top