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.

Equipment Skills Script

this is for RPG Maker VX. so in my game i have the equipment skills script made by Yeyinde, the one that gives party members skills they can amster when equpping certain items, and it always worked fine but now since i added the sideview battle system by RPG Tankentai which was tranlated by Kylock, the scipt doesnt really work anymore. i use the skills but the mastering percentage never goes up at all and i cant figure out why. help please
 
http://rmvx.org/forums/index.php?topic=45777.0    is the battle system, i wont post the entire script because its in 3 parts



http://rmvx.org/forums/index.php?topic=42188.0    is the equipment skills script
in my game its slightly different, but thats just from me adding some of the normal skills into the script, nothing was changed outside of that

#==============================================================================
# ** Equipment Skills
#------------------------------------------------------------------------------
#  © Yeyinde, 2008
#  03/01/08
#------------------------------------------------------------------------------
#  INSTRUCTIONS:
#  1) Insert this script into a new section.
#  2) Edit the constants in the EquipmentSkills module
#  3) ???
#  4) Profit
#==============================================================================


#==============================================================================
#  ** EquipmentSkills Configuration
#==============================================================================

module EquipmentSkills
  # AP - The number of times a skill must be used in order to be mastered
  #      If set to 0, the skill cannot be mastered. (Default value = 0)
  AP = { 1 => 10,  2 => 20,  3 => 30,  4 => 12,  5 => 20,  6 => 15,
        7 => 10,  8 => 20,  9 => 30, 10 => 10, 11 => 20, 12 => 30,
        25 => 30}
  AP.default = 0
  # WEAPON - Contains weapon ID followed by a hash of skills with their
  #          level requirement
  #          SYNTAX: weapon_id => {skill_id => level, skill_id => level}
  WEAPON = {
    1 => {4 => 1},
    2 => {1 => 1, 2 => 3, 3 => 5},
    3 => {5 => 3},
    4 => {6 => 10},
  }
  WEAPON.default = {}
  # ARMOR - Contains armor ID followed by a hash of skills with their
  #        level requirement
  #        SYNTAX: armor_id => {skill_id => level, skill_id => level}
  ARMOR = {
    1 => {7 => 1, 8 => 3, 9 => 5},
    2 => {10 => 1, 11 => 3, 12 => 5},
    10 => {25 => 30}
  }
  ARMOR.default = {}
  # PERCENT_VIEW - Show the mastery completion as a percentage in battle only
  PERCENT_VIEW = true
end

# Set this to what text will be shown when a skill is mastered
Vocab::MasterSkill = "%s was mastered!"

#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  This class deals with battlers. It's used as a superclass of the Game_Actor
# and Game_Enemy classes.
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # * Object aliasing
  #-------------------------------------------------------------------------- 
  alias equipment_skill skill_effect
  #--------------------------------------------------------------------------
  # * Apply Skill Effects
  #    user  : Skill user
  #    skill : skill
  #--------------------------------------------------------------------------
  def skill_effect(user, skill)
    return unless equipment_skill(user, skill) && user.is_a?(Game_Actor)
    user.add_ap(skill.id)
  end
end

#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles actors. It's used within the Game_Actors class
# ($game_actors) and referenced by the Game_Party class ($game_party).
#==============================================================================

class Game_Actor
  #--------------------------------------------------------------------------
  # * Object aliasing
  #-------------------------------------------------------------------------- 
  alias equipment_init initialize
  alias learned_skills skills
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader :equipment_skills
  attr_writer :ap_gained
  #--------------------------------------------------------------------------
  # * Object Initialization
  #    actor_id : actor ID
  #--------------------------------------------------------------------------
  def initialize(actor_id)
    equipment_init(actor_id)
    @equipment_skills = {}
    @equipment_skills.default = 0
    @ap_gained = false
  end
  #--------------------------------------------------------------------------
  # * Get Skill Object Array
  #--------------------------------------------------------------------------
  def skills
    array = learned_skills
    EquipmentSkills::WEAPON[@weapon_id].each do |skill_id, req_level|
      array << $data_skills[skill_id] if @level >= req_level
    end
    if two_swords_style
      EquipmentSkills::WEAPON[@armor1_id].each do |skill_id, req_level|
        array << $data_skills[skill_id] if @level >= req_level
      end
    else
      EquipmentSkills::ARMOR[@armor1_id].each do |skill_id, req_level|
        array << $data_skills[skill_id] if @level >= req_level
      end
    end
    EquipmentSkills::ARMOR[@armor2_id].each do |skill_id, req_level|
      array << $data_skills[skill_id] if @level >= req_level
    end
    EquipmentSkills::ARMOR[@armor3_id].each do |skill_id, req_level|
      array << $data_skills[skill_id] if @level >= req_level
    end
    EquipmentSkills::ARMOR[@armor4_id].each do |skill_id, req_level|
      array << $data_skills[skill_id] if @level >= req_level
    end
    return array.uniq
  end
  #--------------------------------------------------------------------------
  # * Determine Usable Skills
  #    skill : skill
  #--------------------------------------------------------------------------
  def skill_can_use?(skill)
    return false unless skills.include?(skill)
    return super
  end
  #--------------------------------------------------------------------------
  # * Increase Skill AP
  #    skill_id : skill id
  #--------------------------------------------------------------------------
  def add_ap(skill_id)
    return if EquipmentSkills::AP[skill_id] == 0 || @ap_gained
    @ap_gained = true
    equipment_skills[skill_id] = [equipment_skills[skill_id] + 1,
      EquipmentSkills::AP[skill_id]].min
    if equipment_skills[skill_id] >= EquipmentSkills::AP[skill_id]
      learn_skill(skill_id)
    end
  end
end

#==============================================================================
# ** Window_Skill
#------------------------------------------------------------------------------
#  This window displays a list of usable skills on the skill screen, etc.
#==============================================================================

class Window_Skill
  #--------------------------------------------------------------------------
  # * Draw Item
  #    index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    skill = @data[index]
    if skill != nil
      rect.width -= 4
      enabled = @actor.skill_can_use?(skill)
      draw_item_name(skill, rect.x, rect.y, enabled)
      mp = @actor.calc_mp_cost(skill)
      cap = @actor.equipment_skills[skill.id]
      map = EquipmentSkills::AP[skill.id]
      string = ''
      if @actor.learned_skills.include?(skill) || map == 0
        string = mp
      else
        if EquipmentSkills::PERCENT_VIEW && $game_temp.in_battle
          string = sprintf("%d (%d%%)", mp, cap * 100 / map)
        else
          string = sprintf("%d (%d/%d)", mp, cap, map)
        end
      end
      self.contents.draw_text(rect, string, 2)
    end
  end
end

class Scene_Skill
  #--------------------------------------------------------------------------
  # * Object aliasing
  #--------------------------------------------------------------------------
  alias equipment_target determine_target
  alias equipment_nontarget use_skill_nontarget
  #--------------------------------------------------------------------------
  # * Confirm Target
  #    If there is no effect (such as using a potion on an incapacitated
  #    character), play a buzzer SE.
  #--------------------------------------------------------------------------
  def determine_target
    equipment_target
    @actor.ap_gained = false
  end
  #--------------------------------------------------------------------------
  # * Use Skill (apply effects to non-ally targets)
  #--------------------------------------------------------------------------
  def use_skill_nontarget
    equipment_nontarget
    if @skill.common_event_id > 0
      @actor.add_ap(@skill.id)
    end
  end
end

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Object aliasing
  #--------------------------------------------------------------------------
  alias equip_skill_execute execute_action_skill
  #--------------------------------------------------------------------------
  # * Execute Battle Action: Skill
  #--------------------------------------------------------------------------
  def execute_action_skill
    old_skills = []
    if @active_battler.is_a?(Game_Actor)
      old_skills = @active_battler.learned_skills
    end
    equip_skill_execute
    if @active_battler.is_a?(Game_Actor)
      @active_battler.ap_gained = false
      if old_skills != @active_battler.learned_skills
        (@active_battler.learned_skills - old_skills).each do |new_skill|
          text = sprintf(Vocab::MasterSkill, new_skill.name)
          $game_message.texts.push(text)
        end
      end
    end
  end
end
   
 
RPGS":3rylsxh3 said:
Where can I find the sideview battlescript ?
AlbinoWalken69":3rylsxh3 said:
http://rmvx.org/forums/index.php?topic=45777.0    is the battle system, i wont post the entire script because its in 3 parts



http://rmvx.org/forums/index.php?topic=42188.0     is the equipment skills script
in my game its slightly different, but thats just from me adding some of the normal skills into the script, nothing was changed outside of that

#==============================================================================
# ** Equipment Skills
#------------------------------------------------------------------------------
#  © Yeyinde, 2008
#  03/01/08
#------------------------------------------------------------------------------
#  INSTRUCTIONS:
#   1) Insert this script into a new section.
#   2) Edit the constants in the EquipmentSkills module
#   3) ???
#   4) Profit
#==============================================================================


#==============================================================================
#  ** EquipmentSkills Configuration
#==============================================================================

module EquipmentSkills
  # AP - The number of times a skill must be used in order to be mastered
  #      If set to 0, the skill cannot be mastered. (Default value = 0)
  AP = { 1 => 10,  2 => 20,  3 => 30,  4 => 12,  5 => 20,  6 => 15,
         7 => 10,  8 => 20,  9 => 30, 10 => 10, 11 => 20, 12 => 30,
        25 => 30}
  AP.default = 0
  # WEAPON - Contains weapon ID followed by a hash of skills with their
  #          level requirement
  #          SYNTAX: weapon_id => {skill_id => level, skill_id => level}
  WEAPON = {
    1 => {4 => 1},
    2 => {1 => 1, 2 => 3, 3 => 5},
    3 => {5 => 3},
    4 => {6 => 10},
  }
  WEAPON.default = {}
  # ARMOR - Contains armor ID followed by a hash of skills with their
  #         level requirement
  #         SYNTAX: armor_id => {skill_id => level, skill_id => level}
  ARMOR = {
    1 => {7 => 1, 8 => 3, 9 => 5},
    2 => {10 => 1, 11 => 3, 12 => 5},
    10 => {25 => 30}
  }
  ARMOR.default = {}
  # PERCENT_VIEW - Show the mastery completion as a percentage in battle only
  PERCENT_VIEW = true
end

# Set this to what text will be shown when a skill is mastered
Vocab::MasterSkill = "%s was mastered!"

#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  This class deals with battlers. It's used as a superclass of the Game_Actor
# and Game_Enemy classes.
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # * Object aliasing
  #-------------------------------------------------------------------------- 
  alias equipment_skill skill_effect
  #--------------------------------------------------------------------------
  # * Apply Skill Effects
  #     user  : Skill user
  #     skill : skill
  #--------------------------------------------------------------------------
  def skill_effect(user, skill)
    return unless equipment_skill(user, skill) && user.is_a?(Game_Actor)
    user.add_ap(skill.id)
  end
end

#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles actors. It's used within the Game_Actors class
# ($game_actors) and referenced by the Game_Party class ($game_party).
#==============================================================================

class Game_Actor
  #--------------------------------------------------------------------------
  # * Object aliasing
  #-------------------------------------------------------------------------- 
  alias equipment_init initialize
  alias learned_skills skills
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader :equipment_skills
  attr_writer :ap_gained
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  def initialize(actor_id)
    equipment_init(actor_id)
    @equipment_skills = {}
    @equipment_skills.default = 0
    @ap_gained = false
  end
  #--------------------------------------------------------------------------
  # * Get Skill Object Array
  #--------------------------------------------------------------------------
  def skills
    array = learned_skills
    EquipmentSkills::WEAPON[@weapon_id].each do |skill_id, req_level|
      array << $data_skills[skill_id] if @level >= req_level
    end
    if two_swords_style
      EquipmentSkills::WEAPON[@armor1_id].each do |skill_id, req_level|
        array << $data_skills[skill_id] if @level >= req_level
      end
    else
      EquipmentSkills::ARMOR[@armor1_id].each do |skill_id, req_level|
        array << $data_skills[skill_id] if @level >= req_level
      end
    end
    EquipmentSkills::ARMOR[@armor2_id].each do |skill_id, req_level|
      array << $data_skills[skill_id] if @level >= req_level
    end
    EquipmentSkills::ARMOR[@armor3_id].each do |skill_id, req_level|
      array << $data_skills[skill_id] if @level >= req_level
    end
    EquipmentSkills::ARMOR[@armor4_id].each do |skill_id, req_level|
      array << $data_skills[skill_id] if @level >= req_level
    end
    return array.uniq
  end
  #--------------------------------------------------------------------------
  # * Determine Usable Skills
  #     skill : skill
  #--------------------------------------------------------------------------
  def skill_can_use?(skill)
    return false unless skills.include?(skill)
    return super
  end
  #--------------------------------------------------------------------------
  # * Increase Skill AP
  #     skill_id : skill id
  #--------------------------------------------------------------------------
  def add_ap(skill_id)
    return if EquipmentSkills::AP[skill_id] == 0 || @ap_gained
    @ap_gained = true
    equipment_skills[skill_id] = [equipment_skills[skill_id] + 1,
      EquipmentSkills::AP[skill_id]].min
    if equipment_skills[skill_id] >= EquipmentSkills::AP[skill_id]
      learn_skill(skill_id)
    end
  end
end

#==============================================================================
# ** Window_Skill
#------------------------------------------------------------------------------
#  This window displays a list of usable skills on the skill screen, etc.
#==============================================================================

class Window_Skill
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    skill = @data[index]
    if skill != nil
      rect.width -= 4
      enabled = @actor.skill_can_use?(skill)
      draw_item_name(skill, rect.x, rect.y, enabled)
      mp = @actor.calc_mp_cost(skill)
      cap = @actor.equipment_skills[skill.id]
      map = EquipmentSkills::AP[skill.id]
      string = ''
      if @actor.learned_skills.include?(skill) || map == 0
        string = mp
      else
        if EquipmentSkills::PERCENT_VIEW && $game_temp.in_battle
          string = sprintf("%d (%d%%)", mp, cap * 100 / map)
        else
          string = sprintf("%d (%d/%d)", mp, cap, map)
        end
      end
      self.contents.draw_text(rect, string, 2)
    end
  end
end

class Scene_Skill
  #--------------------------------------------------------------------------
  # * Object aliasing
  #--------------------------------------------------------------------------
  alias equipment_target determine_target
  alias equipment_nontarget use_skill_nontarget
  #--------------------------------------------------------------------------
  # * Confirm Target
  #    If there is no effect (such as using a potion on an incapacitated
  #    character), play a buzzer SE.
  #--------------------------------------------------------------------------
  def determine_target
    equipment_target
    @actor.ap_gained = false
  end
  #--------------------------------------------------------------------------
  # * Use Skill (apply effects to non-ally targets)
  #--------------------------------------------------------------------------
  def use_skill_nontarget
    equipment_nontarget
    if @skill.common_event_id > 0
      @actor.add_ap(@skill.id)
    end
  end
end

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Object aliasing
  #--------------------------------------------------------------------------
  alias equip_skill_execute execute_action_skill
  #--------------------------------------------------------------------------
  # * Execute Battle Action: Skill
  #--------------------------------------------------------------------------
  def execute_action_skill
    old_skills = []
    if @active_battler.is_a?(Game_Actor)
      old_skills = @active_battler.learned_skills
    end
    equip_skill_execute
    if @active_battler.is_a?(Game_Actor)
      @active_battler.ap_gained = false
      if old_skills != @active_battler.learned_skills
        (@active_battler.learned_skills - old_skills).each do |new_skill|
          text = sprintf(Vocab::MasterSkill, new_skill.name)
          $game_message.texts.push(text)
        end
      end
    end
  end
end
   
Good job you have the brainiest request ever seen on mankind
 

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