Skill Level System
#1
Skill Level System

Version 1.4
by Leon Westbrooke
Sep 16, 2006

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


This script is a skill-level system so skills can be powered up by the player. It now
also features a Weapon-Proficiency crossover that allows you to level up the actor's
weapon proficiency with skill points rather than the other way the weapon proficiency
is setup. To do this, change the 'false' to 'true' and install the Weapon Proficiency script
for more details.

Also, if you use the Weapon Proficiency Cross-over, make sure you add the proficiency skills for the actors weapons. that is very important.


Features:
1. You can set skill level's and skill max's custom to each actor.
2. You can set skills to have a standard skill max and starting point.
3. Shows skills in detail.
4. Skill points per level can be customized.
5. You can change skill levels and skill max's through events.
6. You can have level and Skill prerequisites (sorry, only one each.)
7. Skill Power goes up per level.
8. You can add status ailments, status curatives, and elements to skills.
9. You can have multiple passive skills, and have active skills add to stats permanently as well.
10. A cross-over with Weapon Proficiency now allows you to use skill points to raise proficiency rank.
(see ADDITIONAL NOTES for more info.)
11. NEW FEATURE Stealing. see script for more info.


INSTRUCTIONS:
1. Place this script under all your others and above Main.
2. Set Beginning_Default to the level you want all skills to start at.
3. Set Max_Default to the max level of the average skill
4. Level_Req sets the a required level for skills.
5. Skill_Req sets required skills.
7. Set all instances of INCREASE_PER_LEVEL to the same number, (Use Ctrl + F to find all instances)
8. Set all instances of PASSIVE_SKILL_ID to the same number. (Use Ctrl + F to find all instances)
9. Set the additive element ailments, curatives and elements in their respective places.
10. Set all of your passive skills in their right locations.
11. Scroll down through the module to set your specifications.
12. Search (Ctrl + F) and enter Leon_Edit for the last two locations for editing.


SCRIPT
Code:
#----------------------------------------------------------------------
#  Skill Level System
#----------------------------------------------------------------------
#  Leon
#  2006-09-16
#  v2.0
#----------------------------------------------------------------------
=begin
This script is a skill-level system so skills can be powered up by the player.  It now
also features a Weapon-Proficiency crossover that allows you to level up the actor's
weapon proficiency with skill points rather than the other way the weapon proficiency
is setup.  To do this, change the 'false' to 'true' and install the Weapon Proficiency script
for more details.
 
Features:
1.  You can set skill level's and skill max's custom to each actor.
2.  You can set skills to have a standard skill max and starting point.
3.  Shows skills in detail.
4.  Skill points per level can be customized.
5.  You can change skill levels and skill max's through events.
6.  You can have level and Skill prerequisites (sorry, only one each.)
7.  Skill Power goes up per level.
8.  You can add status ailments, status curatives, and elements to skills.
9.  You can have multiple passive skills, and have active skills add to stats permanently as well.
10.  A cross-over with Weapon Proficiency now allows you to use skill points to raise proficiency rank.
       (see ADDITIONAL NOTES for more info.)
11.  Steal has been implimented.

INSTRUCTIONS:
1.  Place this script under all your others and above Main.
2.  Set Beginning_Default to the level you want all skills to start at.
3.  Set Max_Default to the max level of the average skill
4.  Level_Req sets the a required level for skills.
5.  Skill_Req sets required skills.
7.  Set all instances of INCREASE_PER_LEVEL to the same number, (Use Ctrl + F to find all instances)
8.  Set all instances of PASSIVE_SKILL_ID to the same number. (Use Ctrl + F to find all instances)
9.  Set the additive element ailments, curatives and elements in their respective places.
10.  Set all of your passive skills in their right locations.
11.  Scroll down through the module to set your specifications.
12.  Search (Ctrl + F) and enter Leon_Edit for the last two locations for editing.

ADDITIONAL NOTES: for proficiency crossover only (not necissary)
1.  If you use the Weapon Proficiency cross-over, you must have my weapon proficiency script
     installed.
2.  If an actor is going to use a sword weapon, they MUST know the sword proficiency skill.
     This is true for every weapon type the actor uses.  Weapon types are defined in the
     weapon proficiency script.
3.  All proficiency skills must have the maximum of '4', which is 'S' by default.

THANKS TO:
Arkbennett and Houndchaser/Skyhunter for testing this script and the crossover.
Felicity (my gal) for giving me support in this script and helping a bit with the math.

Use this to add to current skill levels:
x = actor's number, y = skill id, z = amount.
use $game_actors[x].skill_level[y] += z

use this to add to current skill max's:
x = actor's number, y = skill id, z = amount.
use $game_actors[x].skill_max[y] += z

To subtract from the totals, change the '+' to '-'
=end
module Skill_Level
  #--------------------------------------------------------------------
  #  Skill_Default_Beginning_Level
  #--------------------------------------------------------------------
  Beginning_Default = 0
  #--------------------------------------------------------------------
  #  Skill default max level
  #--------------------------------------------------------------------
  Max_Default = 4
  #--------------------------------------------------------------------
  #  Actor Level Requirements
  #  skill_id => actor.level
  #--------------------------------------------------------------------
  Level_Req = {
  2 => 2
  }
  #--------------------------------------------------------------------
  #  Skill Level Requirements
  #  skill_id =>  [required skill_id, required skill_level, skill name of required skill]
  #--------------------------------------------------------------------
  Skill_Req = {
  57 => [1, 2, "Heal"]
  }
  #--------------------------------------------------------------------
  #  Skill Infliction Status Additions
  #  skill_id => [skill_level, plus_state_set id]
  #--------------------------------------------------------------------
  Skill_Add = {
  57 => [2, 3]
  }
  #--------------------------------------------------------------------
  #  Skill Cure Status Removals
  #  skill_id => [skill_level, minus_state_set id]
  #--------------------------------------------------------------------
  Skill_Minus = {
  1 => [2, 2]
  }
  #--------------------------------------------------------------------
  #  Skill Element Addition
  #  skill_id => [skill_level, element_set]
  #--------------------------------------------------------------------
  Skill_Element = {
  1 => [2, 4]
  }
  #--------------------------------------------------------------------
  #  Increase % per level
  #--------------------------------------------------------------------
  INCREASE_PER_LEVEL = 10
  #--------------------------------------------------------------------
  #  Base_MaxHP skills
  #  skill_id => % hp added
  #--------------------------------------------------------------------
  Base_hp = {
  81 => 5,
  82 => 7
  }
  #--------------------------------------------------------------------
  #  Base_MaxSP skills
  #  skill_id => % sp added
  #--------------------------------------------------------------------
  Base_sp = {
  81 => 5
  }  
  #--------------------------------------------------------------------
  #  Base_Str skills
  #  skill_id => % str added
  #--------------------------------------------------------------------
  Base_str = {
  81 => 5
  }
  #--------------------------------------------------------------------
  #  Base_Dex skills
  #  skill_id => % dex added
  #--------------------------------------------------------------------
  Base_dex = {
  81 => 5
  }
  #--------------------------------------------------------------------
  #  Base_Int skills
  #  skill_id => % int added
  #--------------------------------------------------------------------
  Base_int = {
  81 => 5
  }
  #--------------------------------------------------------------------
  #  Base_Agi skills
  #  skill_id => % agi added
  #--------------------------------------------------------------------
  Base_agi = {
  81 => 5
  }
  #--------------------------------------------------------------------
  #  Weapon proficiency crossover switch
  #--------------------------------------------------------------------
  Weapon_Cross = true
  #--------------------------------------------------------------------
  #  Weapon Proficiencies
  #  set only if you use the weapon proficiency crossover.
  #--------------------------------------------------------------------
  Weapon_Skills = [82, 83, 84, 85, 86, 87, 88, 89, 90]
end

#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#  Steal Module
#//////////////////////////////////////////////////////////////////////
module Steal_Script
  #--------------------------------------------------------------------
  #  Common_Item
  #  enemy.id => [item_id, item identifier, # to add]
  #  0 = item, 1 = weapon, 2 = armor
  #--------------------------------------------------------------------
  Common_Item = {
  1 => [3, 1, 2]
  }
  #--------------------------------------------------------------------
  #  Rare_Item
  #  enemy.id => [item_id, item identifier, # to add]
  #  0 = item, 1 = weapon, 2 = armor
  #--------------------------------------------------------------------
  Rare_Item = {
  1 => [3, 0, 2]
  }
  Failed_Message = "Couldn't Steal"
  Nothing_To_Steal = "Nothing to Steal"
  Steal_ID = 20
  Gold_ID = 21
end

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Game_Battler
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Game_Battler
  #--------------------------------------------------------------------
  #  Set's Percentage Increase
  #  Set each INCREASE_PER_LEVEL in the script to the same number
  #--------------------------------------------------------------------
  INCREASE_PER_LEVEL = 10
  #--------------------------------------------------------------------
  #  Alias Listings
  #--------------------------------------------------------------------
  alias leon_gb_skilleffect skill_effect
  #--------------------------------------------------------------------
  #  Skill Effect
  #--------------------------------------------------------------------
  def skill_effect(user, skill)
    ss = Steal_Script
    reqs = Skill_Level
    self.critical = false
    if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
       ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
      return false
    end
    effective = false
    effective |= skill.common_event_id > 0
    hit = skill.hit
    if skill.atk_f > 0
      hit *= user.hit / 100
    end
    hit_result = (rand(100) < hit)
    effective |= hit < 100
    if hit_result == true
      if skill.element_set.include?(ss::Steal_ID)
        if self.is_a?(Game_Enemy)
          steal = (rand(100) + user.skill_level[skill.id] * reqs::INCREASE_PER_LEVEL)
          if ss::Rare_Item.keys.include?(self.id)
            if steal > 90
              if ss::Rare_Item[self.id][1] == 0
                $game_party.gain_item(ss::Rare_Item[self.id][0], ss::Rare_Item[self.id][2])
                self.damage = "Stole #{ss::Rare_Item[self.id][2].to_i} #{$data_items[ss::Rare_Item[self.id][0]].name}"
                return
              elsif ss::Rare_Item[self.id][1] == 1
                $game_party.gain_weapon(ss::Rare_Item[self.id][0], ss::Rare_Item[self.id][2])
                self.damage = "Stole #{ss::Rare_Item[self.id][2].to_i} #{$data_weapons[ss::Rare_Item[self.id][0]].name}"
                return
              elsif ss::Rare_Item[self.id][1] == 2
                $game_party.gain_armor(ss::Rare_Item[self.id][0], ss::Rare_Item[self.id][2])
                self.damage = "Stole #{ss::Rare_Item[self.id][2].to_i} #{$data_armors[ss::Rare_Item[self.id][0]].name}"
                return
              end
            end
          end
          if ss::Common_Item.keys.include?(self.id)
            if ss::Rare_Item.keys.include?(self.id)
              if steal > 50
                if steal < 90
                  if ss::Common_Item[self.id][1] == 0
                    $game_party.gain_item(ss::Common_Item[self.id][0], ss::Common_Item[self.id][2])
                    self.damage = "Stole #{ss::Common_Item[self.id][2].to_i} #{$data_items[ss::Common_Item[self.id][0]].name}"
                    return
                  elsif ss::Common_Item[self.id][1] == 1
                    $game_party.gain_weapon(ss::Common_Item[self.id][0], ss::Common_Item[self.id][2])
                    self.damage = "Stole #{ss::Common_Item[self.id][2].to_i} #{$data_weapons[ss::Common_Item[self.id][0]].name}"
                    return
                  elsif ss::Common_Item[self.id][1] == 2
                    $game_party.gain_armor(ss::Common_Item[self.id][0], ss::Common_Item[self.id][2])
                    self.damage = "Stole #{ss::Common_Item[self.id][2].to_i} #{$data_armors[ss::Common_Item[self.id][0]].name}"
                    return
                  end
                end
              else
                self.damage = "#{ss::Failed_Message}"
                return
              end
            else
              if steal > 50
                if ss::Common_Item[self.id][1] == 0
                  $game_party.gain_item(ss::Common_Item[self.id][0], ss::Common_Item[self.id][2])
                  self.damage = "Stole #{ss::Common_Item[self.id][2].to_i} #{$data_items[ss::Common_Item[self.id][0]].name}"
                  return
                elsif ss::Common_Item[self.id][1] == 1
                  $game_party.gain_weapon(ss::Common_Item[self.id][0], ss::Common_Item[self.id][2])
                  self.damage = "Stole #{ss::Common_Item[self.id][2].to_i} #{$data_weapons[ss::Common_Item[self.id][0]].name}"
                  return
                elsif ss::Common_Item[self.id][1] == 2
                  $game_party.gain_armor(ss::Common_Item[self.id][0], ss::Common_Item[self.id][2])
                  self.damage = "Stole #{ss::Common_Item[self.id][2].to_i} #{$data_armors[ss::Common_Item[self.id][0]].name}"
                  return
                end
              end
            end
          else
            self.damage = "#{ss::Nothing_To_Steal}"
            return
          end
        end
      end
      if skill.element_set.include?(ss::Gold_ID)
        if self.is_a?(Game_Enemy)
          gold_steal = (rand(100))
          if gold_steal > 45
            gold_total = 0
            gold = self.gold
            gold1 = gold
            gold_var = (rand(gold1 / 2) * user.skill_level[skill.id])
            gold_pm = (rand(3))
            if gold_pm > 1
              gold_total = gold + gold_var
              $game_party.gain_gold(gold_total)
              self.damage = "Stole #{gold_total} #{$data_system.words.gold}"
              return
            else
              gold_total = gold - gold_var
              if gold_total < 0
                gold_total = 0
              end
              $game_party.gain_gold(gold_total)
              self.damage = "Stole #{gold_total} #{$data_system.words.gold}"
              return
            end
          else
            self.damage = "#{ss::Failed_Message}"
            return
          end
        end
      end
      if user.is_a?(Game_Actor)
        power = (skill.power + (reqs::INCREASE_PER_LEVEL * user.skill_level[skill.id][0] * 0.01 * skill.power)) + user.atk * skill.atk_f / 100
      else
        power = skill.power + user.atk * skill.atk_f / 100
      end
      power = power.round
      if power > 0
        power -= self.pdef * skill.pdef_f / 200
        power -= self.mdef * skill.mdef_f / 200
        power = [power, 0].max
      end
      rate = 20
      rate += (user.str * skill.str_f / 100)
      rate += (user.dex * skill.dex_f / 100)
      rate += (user.agi * skill.agi_f / 100)
      rate += (user.int * skill.int_f / 100)
      self.damage = power * rate / 20
      self.damage *= elements_correct(skill.element_set)
      self.damage /= 100
      if self.damage > 0
        if self.guarding?
          self.damage /= 2
        end
      end
      if skill.variance > 0 and self.damage.abs > 0
        amp = [self.damage.abs * skill.variance / 100, 1].max
        self.damage += rand(amp+1) + rand(amp+1) - amp
      end
      eva = 8 * self.agi / user.dex + self.eva
      hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
      hit = self.cant_evade? ? 100 : hit
      hit_result = (rand(100) < hit)
      effective |= hit < 100
    end
    if hit_result == true
      if skill.power != 0 and skill.atk_f > 0
        remove_states_shock
        effective = true
      end
      last_hp = self.hp
      self.hp -= self.damage
      effective |= self.hp != last_hp
      @state_changed = false
      effective |= states_plus(skill.plus_state_set)
      effective |= states_minus(skill.minus_state_set)
      if skill.power == 0
        self.damage = ""
        unless @state_changed
          self.damage = "Miss"
        end
      end
    else
      self.damage = "Miss"
    end
    unless $game_temp.in_battle
      self.damage = nil
    end
    return effective
  end
end



#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------
  #  Constant Variables
  #  Leon_Edit
  #  Set SKILL_POINTS equal to the number of skill points per level.
  #  Set SKILL_POINTS equal to 0 if none are to be earned.
  #--------------------------------------------------------------------
  SKILL_POINTS = 1
  #--------------------------------------------------------------------
  #  Attribute Listings
  #--------------------------------------------------------------------
  attr_accessor    :skill_level
  attr_accessor    :skill_max
  attr_accessor    :skill_points
  #--------------------------------------------------------------------
  #  Alias Listings
  #--------------------------------------------------------------------
  alias leon_ga_skill_level_setup setup
  alias leon_ga_skill_level_skill_learn? skill_learn?
  alias leon_ga_skill_level_exp exp
  alias leon_ga_skill_level_basehp base_maxhp
  alias leon_ga_skill_level_basesp base_maxsp
  alias leon_ga_skill_level_basestr base_str
  alias leon_ga_skill_level_basedex base_dex
  alias leon_ga_skill_level_baseagi base_agi
  alias leon_ga_skill_level_baseint base_int
  #--------------------------------------------------------------------
  #  Setup
  #--------------------------------------------------------------------
  def setup(actor_id)
  #--------------------------------------------------------------------
  #  Leon_Edit
  #  Put in unique beginning levels here.
  #  skill_id => starting_level
  #--------------------------------------------------------------------
    @skill_level = {
    1 => 2,
    57 => 0,
    81 => 0
    }
  #--------------------------------------------------------------------
  #  Leon_Edit
  #  Put unique max levels here.
  #  skill_id => skill_end
  #--------------------------------------------------------------------
    @skill_max = {
    1 => 3,
    57 => 7
    }
    @hp_skills = []
    @hp_percent = []
    @sp_skills = []
    @sp_percent = []
    @str_skills = []
    @str_percent = []
    @dex_skills = []
    @dex_percent = []
    @int_skills = []
    @int_percent = []
    @agi_skills = []
    @agi_percent = []
    @skill_points = 0
    @hp_bonus = 0
    @sp_bonus = 0
    @str_bonus = 0
    @dex_bonus = 0
    @int_bonus = 0
    @agi_bonus = 0
    leon_ga_skill_level_setup(actor_id)
  end
 
  def bonus(skill_id)
    #  HP calculations
    reqs = Skill_Level
    @hp_bonus = 0
    if reqs::Base_hp.keys.include?(skill_id)
      unless @hp_skills.include?(skill_id)
        @hp_skills.push(skill_id)
        @hp_percent.push(reqs::Base_hp[skill_id])
      end
    end
    if @hp_skills.size != nil
      for i in 0...@hp_skills.size
        @hp_bonus += @hp_percent[i] * skill_level[@hp_skills[i]]
      end
    end
    #  SP calculations
    @sp_bonus = 0
    if reqs::Base_sp.keys.include?(skill_id)
      unless @sp_skills.include?(skill_id)
        @sp_skills.push(skill_id)
        @sp_percent.push(reqs::Base_sp[skill_id])
      end
    end
    if @sp_skills.size != nil
      for i in 0...@sp_skills.size
        @sp_bonus += @sp_percent[i] * skill_level[@sp_skills[i]]
      end
    end
    #  STR calculations
    @str_bonus = 0
    if reqs::Base_str.keys.include?(skill_id)
      unless @str_skills.include?(skill_id)
        @str_skills.push(skill_id)
        @str_percent.push(reqs::Base_str[skill_id])
      end
    end
    if @str_skills.size != nil
      for i in 0...@str_skills.size
        @str_bonus += @str_percent[i] * skill_level[@str_skills[i]]
      end
    end
    #  DEX calculations
    @dex_bonus = 0
    if reqs::Base_dex.keys.include?(skill_id)
      unless @dex_skills.include?(skill_id)
        @dex_skills.push(skill_id)
        @dex_percent.push(reqs::Base_dex[skill_id])
      end
    end
    if @dex_skills.size != nil
      for i in 0...@dex_skills.size
        @dex_bonus += @dex_percent[i] * skill_level[@dex_skills[i]]
      end
    end
    #  INT calculations
    @int_bonus = 0
    if reqs::Base_int.keys.include?(skill_id)
      unless @int_skills.include?(skill_id)
        @int_skills.push(skill_id)
        @int_percent.push(reqs::Base_int[skill_id])
      end
    end
    if @int_skills.size != nil
      for i in 0...@int_skills.size
        @int_bonus += @int_percent[i] * skill_level[@int_skills[i]]
      end
    end
    #  AGI calculations
    @agi_bonus = 0
    if reqs::Base_agi.keys.include?(skill_id)
      unless @agi_skills.include?(skill_id)
        @agi_skills.push(skill_id)
        @agi_percent.push(reqs::Base_agi[skill_id])
      end
    end
    if @agi_skills.size != nil
      for i in 0...@agi_skills.size
        @agi_bonus += @agi_percent[i] * skill_level[@agi_skills[i]]
      end
    end
  end
 
  def base_maxhp
    n = leon_ga_skill_level_basehp
    o = @hp_bonus
    if o != nil
      p = o * 0.01 * n + n
      return p
    else
      return n
    end
  end
 
  def base_maxsp
    n = leon_ga_skill_level_basesp
    o = @sp_bonus
    if o != nil
      p = o * 0.01 * n + n
      return p
    else
      return n
    end
  end
 
  def base_str
    n = leon_ga_skill_level_basestr
    o = @str_bonus
    if o != nil
      p = o * 0.01 * n + n
      return p
    else
      return n
    end
  end
 
  def base_dex
    n = leon_ga_skill_level_basedex
    o = @dex_bonus
    if o != nil
      p = o * 0.01 * n + n
      return p
    else
      return n
    end
  end
 
  def base_int
    n = leon_ga_skill_level_baseint
    o = @int_bonus
    if o != nil
      p = o * 0.01 * n + n
      return p
    else
      return n
    end
  end
 
  def base_agi
    n = leon_ga_skill_level_baseint
    o = @agi_bonus
    if o != nil
      p = o * 0.01 * n + n
      return p
    else
      return n
    end
  end
 
  def skill_learn?(skill_id)
    reqs = Skill_Level
    unless @skill_level.include?(skill_id)
      @skill_level[skill_id] = reqs::Beginning_Default
   end
    unless @skill_max.include?(skill_id)
      @skill_max[skill_id] = reqs::Max_Default
    end
    leon_ga_skill_level_skill_learn?(skill_id)
  end
 
  def skill_can_learn?(skill_id)
    reqs = Skill_Level
    if reqs::Level_Req.has_key?(skill_id)
      unless level >= reqs::Level_Req[skill_id]
        return false
      end
    end
    if reqs::Skill_Req.has_key?(skill_id)
      unless level >= reqs::Skill_Req[skill_id][0]
        return false
      end
    end
    return true
  end
 
  def skill_can_use?(skill_id)
    reqs = Skill_Level
    if reqs::Skill_Add.has_key?(skill_id)
      if skill_level[skill_id] >= reqs::Skill_Add[skill_id][0]
        $data_skills[skill_id].plus_state_set.push(reqs::Skill_Add[skill_id][1])
      end
    end
    if reqs::Skill_Minus.has_key?(skill_id)
      if skill_level[skill_id] >= reqs::Skill_Minus[skill_id][0]
        $data_skills[skill_id].minus_state_set.push(reqs::Skill_Minus[skill_id][1])
      end
    end
    if reqs::Skill_Element.has_key?(skill_id)
      if skill_level[skill_id] >= reqs::Skill_Element[skill_id][0]
        unless $data_skills[skill_id].element_set.include?(reqs::Skill_Element[skill_id][1])
          $data_skills[skill_id].element_set.push(reqs::Skill_Element[skill_id][1])
        end
      end
    end
    return false unless leon_skill_level_levelcheck(skill_id)
    return false unless leon_skill_level_skillcheck(skill_id)
    if not skill_learn?(skill_id)
      return false
    end
    if skill_level[skill_id] == 0
      return false
    end
    return super
  end
 
  def leon_skill_level_levelcheck(skill_id)
    reqs = Skill_Level
    if reqs::Level_Req.has_key?(skill_id)
      unless level >= reqs::Level_Req[skill_id]
        return false
      end
    end
    return true
  end
 
  def leon_skill_level_skillcheck(skill_id)
    reqs = Skill_Level
    if reqs::Skill_Req.has_key?(skill_id)
      skill_number = reqs::Skill_Req[skill_id][0]
      unless skill_level[skill_number] >= reqs::Skill_Req[skill_id][1]
        return false
      end
    end
    return true
  end
    
  def exp=(exp)
    @exp = [[exp, 9999999].min, 0].max
    while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
      @level += 1
      @skill_points += SKILL_POINTS
      for j in $data_classes[@class_id].learnings
        if j.level == @level
          learn_skill(j.skill_id)
        end
      end
    end
    while @exp < @exp_list[@level]
      @level -= 1
    end
    @hp = [@hp, self.maxhp].min
    @sp = [@sp, self.maxsp].min
  end
 
end

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Window_Skill
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Window_Skill
 
  #--------------------------------------------------------------------
  #  Constant Listings
  #--------------------------------------------------------------------
  PASSIVE_SKILL_ID = 19
  #--------------------------------------------------------------------
  #  Alias Listings
  #--------------------------------------------------------------------
  alias leon_ws_skill_level_refresh refresh
 
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 0...@actor.skills.size
      skill = $data_skills[@actor.skills[i]]
      if skill != nil
        if @actor.skill_level[skill.id] > 0
          unless skill.element_set.include?(PASSIVE_SKILL_ID)
            @data.push(skill)
          end
        end
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      self.contents.font.name = $defaultfonttype
      self.contents.font.size = $defaultfontsize
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
end

#----------------------------------------------------------------------
#  Window_Skillinfo  Info Window
#----------------------------------------------------------------------
class Window_Skillinfo < Window_Base
  def initialize
    super(0, 0, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
  end
 
  def update(help_text)
    self.contents.clear
    self.contents.draw_text(0, 0, 600, 32, help_text)
  end

end

#----------------------------------------------------------------------
#  Window_Skillhero Hero Window
#----------------------------------------------------------------------
class Window_Skillhero < Window_Base
  def initialize(actor)
    super(0, 64, 180, 128)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
    @actor = actor
    refresh
  end
 
  def refresh
    self.contents.clear
    draw_actor_name(@actor, 50, 0)
    draw_actor_class(@actor, 50, 32)
    self.contents.draw_text(100, 64, 40, 32, @actor.skill_points.to_s)
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 45, 32, "Name:")
    self.contents.draw_text(0, 32, 45, 32, "Class:")
    self.contents.draw_text(0, 64, 95, 32, "Skill Points:")
  end
end
    


#----------------------------------------------------------------------
#  Window_Skillpre Prerequisite Window
#----------------------------------------------------------------------
class Window_Skillpre < Window_Base
 
  def initialize(skill)
    super(0, 288, 180, 192)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
  end
 
  def update(skill)
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 140, 32, "Prerequisites:")
    self.contents.draw_text(4, 32, 140, 32, "Level:")
    self.contents.draw_text(4, 64, 45, 32, "Skill:")
    self.contents.font.color = normal_color
    reqs = Skill_Level
    if reqs::Level_Req.has_key?(skill.id)
      self.contents.draw_text(55, 32, 140, 32, reqs::Level_Req[skill.id].to_s)
    else
      self.contents.draw_text(55, 32, 140, 32, "None")
    end
    if reqs::Skill_Req.has_key?(skill.id)
      self.contents.draw_text(8, 96, 140, 32, reqs::Skill_Req[skill.id][2].to_s)
      self.contents.draw_text(8, 128, 140, 32, "Lvl:  " + reqs::Skill_Req[skill.id][1].to_s)
    else
      self.contents.draw_text(8, 96, 140, 32, "None")
    end
  end
 
  def update1
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 140, 32, "Prerequisites:")
    self.contents.draw_text(4, 32, 140, 32, "Level:")
    self.contents.draw_text(4, 64, 45, 32, "Skill:")
  end
 
end
#----------------------------------------------------------------------
#  Window_Skilllist List Window
#----------------------------------------------------------------------
class Window_Skilllist < Window_Selectable
  #--------------------------------------------------------------------
  #  Set Passive Skill ID here.
  #--------------------------------------------------------------------
  PASSIVE_SKILL_ID = 19
 
  def initialize(actor)
    super(180, 64, 460, 416)
    @column_max = 2
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
    @actor = actor
    self.active = false
    self.index = -1
  end
 
  def skill
    if @data !=nil
      return @data[@index]
    end
  end
 
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 0...@actor.skills.size
      skill = $data_skills[@actor.skills[i]]
      if skill != nil
        unless skill.element_set.include?(PASSIVE_SKILL_ID)
          @data.push(skill)
        end
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      self.contents.font.name = $defaultfonttype
      self.contents.font.size = $defaultfontsize
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
    
  def draw_item(index)
    skill = @data[index]
    if @actor.skill_can_learn?(skill.id) == true
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    unless skill.element_set.include?(PASSIVE_SKILL_ID)
      x = 4 + index % 2 * (195 + 32)
      y = index / 2 * 32
      rect = Rect.new(x, y, self.width / @column_max - 32, 32)
      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
      bitmap = RPG::Cache.icon(skill.icon_name)
      opacity = self.contents.font.color == normal_color ? 255 : 128
      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
      self.contents.draw_text(x + 28, y, 134, 32, skill.name, 0)
      if @actor.skill_level[skill.id] == @actor.skill_max[skill.id]
        self.contents.font.color = Color.new(40, 250, 40, 255)
        self.contents.draw_text(x +155, y, 100, 32, "Max")
      else
        self.contents.font.color = Color.new(250, 250, 13, 255)
        self.contents.draw_text(x + 159, y, 100, 32,
        (@actor.skill_level[skill.id].to_s) + "/" + (@actor.skill_max[skill.id].to_s))
      end
    end
  end
 
  def refresh1
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 0...@actor.skills.size
      skill = $data_skills[@actor.skills[i]]
      if skill != nil
        if skill.element_set.include?(PASSIVE_SKILL_ID)
          @data.push(skill)
        end
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      self.contents.font.name = $defaultfonttype
      self.contents.font.size = $defaultfontsize
      for i in 0...@item_max
        draw_item1(i)
      end
    end
  end
    
  def draw_item1(index)
    skill = @data[index]
    if @actor.skill_can_learn?(skill.id) == true
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    if skill.element_set.include?(PASSIVE_SKILL_ID)
      x = 4 + index % 2 * (195 + 32)
      y = index / 2 * 32
      rect = Rect.new(x, y, self.width / @column_max - 32, 32)
      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
      bitmap = RPG::Cache.icon(skill.icon_name)
      opacity = self.contents.font.color == normal_color ? 255 : 128
      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
      self.contents.draw_text(x + 28, y, 134, 32, skill.name, 0)
      if @actor.skill_level[skill.id] == @actor.skill_max[skill.id]
        self.contents.font.color = Color.new(40, 250, 40, 255)
        self.contents.draw_text(x +155, y, 100, 32, "Max")
      else
        self.contents.font.color = Color.new(250, 250, 13, 255)
        self.contents.draw_text(x + 159, y, 100, 32,
        (@actor.skill_level[skill.id].to_s) + "/" + (@actor.skill_max[skill.id].to_s))
      end
    end
  end
 
end

#----------------------------------------------------------------------
#  Window_Skilldesc
#----------------------------------------------------------------------
class Window_Skilldesc < Window_Base
  #--------------------------------------------------------------------
  #  Set Passive skill ID to the same as above.
  #  Set INCREASE_PER_LEVEL the same as the ones above
  #--------------------------------------------------------------------
  PASSIVE_SKILL_ID = 19
  INCREASE_PER_LEVEL = 10
 
  def initialize(actor, skill)
    super(45, 40, 550, 400)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
    @actor = actor
    self.visible = false
    self.z = 1000
  end
 
  def refresh(skill)
    self.contents.clear
    reqs = Skill_Level
    for i in 0...reqs::Weapon_Skills.length
      if skill.id == reqs::Weapon_Skills[i]
        refresh2(skill)
        return
      end
    end
    @actor.skill_can_use?(skill.id)
    bitmap = RPG::Cache.icon(skill.icon_name)
    self.contents.font.color = system_color
    #Draws 'Elements:'
    self.contents.draw_text(205, 96, 120, 32, "Elements:")
    #Draws the word for SP
    self.contents.draw_text(410, 0, 80, 32, $data_system.words.sp + ":")
    #Draws 'Skill Level:'
    self.contents.draw_text(200, 0, 120, 32, "Skill Level:")  
    #Draws 'Cures:'
    self.contents.draw_text(0, 96, 120, 32, "Cures:")
    #Draws 'Inflicts:'
    self.contents.draw_text(0, 228, 120, 32, "Inflicts:")
    #Draws 'Next Level's Range:'
    self.contents.draw_text(355, 96, 165, 32, "Next Level's Range:", 1)
    #Attack Influence
    self.contents.font.size = 18
    #Draws 'Increase per Level:'
    self.contents.draw_text(145, 324, 150, 32, "Increase per Level:")
    #Draws 'Range'
    self.contents.draw_text(345, 304, 165, 32, "Range:")
    #Draws Attack Type
    self.contents.draw_text(345, 324, 120, 32, "Skill Type:")
    #Draws 'Attack' influence
    self.contents.draw_text(145, 228, 120, 32, "Atk Influence:")
    #Draws 'PDEF' influence
    self.contents.draw_text(145, 247, 120, 32, "P-DEF Influence:")
    #Draws 'MDEF' influence
    self.contents.draw_text(145, 266, 120, 32, "M-DEF Influence:")
    #Draws 'Accuracy'
    self.contents.draw_text(145, 285, 120, 32, "Accuracy:")
    self.contents.font.size = $defaultfontsize
    self.contents.font.color = normal_color
    #Sets Icon Opacity
    opacity = self.contents.font.color == normal_color ? 255 : 128
    #Draws Icon
    self.contents.blt(0, 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    #Draws Skill Name
    self.contents.draw_text(28, 0, 184, 32, skill.name, 0)
    #Draws SP cost
    self.contents.draw_text(450, 0, 90, 32, skill.sp_cost.to_s)
    #Draws Skill Level Number
    self.contents.font.color = Color.new(250, 250, 13, 255)
    self.contents.draw_text(290, 0, 50, 32,
    (@actor.skill_level[skill.id]).to_s +  "/" + (@actor.skill_max[skill.id]).to_s)
    self.contents.font.color = normal_color
    #Draws Skill Description
    self.contents.draw_text(4, 48, 330, 32, skill.description)
    #Draws Atk Influence
    self.contents.font.size = 18
    #Draws Skill Type
    if skill.atk_f > 0
      self.contents.draw_text(420, 324, 80, 32, "Physical")
    else
      self.contents.draw_text(420, 324, 80, 32, "Magical")
    end
    self.contents.draw_text(235, 228, 30, 32, skill.atk_f.to_s, 2)
    self.contents.draw_text(254, 247, 30, 32, skill.pdef_f.to_s, 2)
    self.contents.draw_text(257, 266, 30, 32, skill.mdef_f.to_s, 2)
    self.contents.draw_text(210, 285, 30, 32, skill.hit.to_s, 2)
    #Draws % increase
    self.contents.draw_text(277, 324, 50, 32, "+" + INCREASE_PER_LEVEL.to_s + "%")
    #Draws Range
    case skill.scope
    when 0
      self.contents.draw_text(399, 304, 165, 32, "None")
    when 1
      self.contents.draw_text(399, 304, 165, 32, "One Enemy")
    when 2
      self.contents.draw_text(399, 304, 165, 32, "All Enemies")
    when 3
      self.contents.draw_text(399, 304, 165, 32, "One Ally")
    when 4
      self.contents.draw_text(399, 304, 165, 32, "All Allies")
    when 5
      self.contents.draw_text(399, 304, 165, 32, "Ko'ed Allies")
    when 6
      self.contents.draw_text(399, 304, 165, 32, "User")
    end
    self.contents.font.size = $defaultfontsize
    #Formulas for Next Level Range    #Formula for when skills level up
    power1 = (((INCREASE_PER_LEVEL *  0.01 *  @actor.skill_level[skill.id])* skill.power) + skill.power)
    power2 = (((INCREASE_PER_LEVEL *  0.01 *  (@actor.skill_level[skill.id] +1))* skill.power) + skill.power)
    #Draws Range
    next_level_range = (power2 * (skill.variance * -0.01) + power2).to_s + " - " + (power2 * (skill.variance * 0.01) + power2).to_s    
    next_level_range2 = ((power2 * (skill.variance * -0.01) + power2) * -1).to_s + " - " + ((power2 * (skill.variance * 0.01) + power2) * -1).to_s
    #Draws skill elements.
    elements = []
    skill.element_set.each do |i|
      unless [PASSIVE_SKILL_ID].include?(i)
        elements << $data_system.elements[i]
      end
    end
    for i in 0...elements.size
      self.contents.font.size = 16
      self.contents.draw_text(165 + ((i % 2) * 94), 120 + (i / 2 * 12), 120, 32, elements[i])
    end
    #Draws negated effects
    minus_status_data = []
    for i in 1...$data_states.size
      if skill.minus_state_set.include?(i)
        minus_status_data.push($data_states[i].name)
      end
    end
    for i in 0...minus_status_data.size
      self.contents.font.size = 16
      self.contents.draw_text(0 + ((i % 2) * 85), 120 + (i / 2 * 12), 120, 32, minus_status_data[i])
    end
    #Draws added statuses
    plus_status_data = []
    for i in 1...$data_states.size
      if skill.plus_state_set.include?(i)
        plus_status_data.push($data_states[i].name)
      end
    end
    for i in 0...plus_status_data.size
      self.contents.font.size = 16
      self.contents.draw_text(0 + ((i % 2) * 85), 252 + (i / 2 * 12), 120, 32, plus_status_data[i])
    end
    #If skill is a heal skill...
    if skill.power < 0
      self.contents.font.size = $defaultfontsize
      self.contents.font.color = system_color
      self.contents.draw_text(355, 32, 165, 32, "Heal Range:", 1)
      self.contents.draw_text(355, 160, 170, 32, "Level's Healing Avg:")
      self.contents.draw_text(355, 228, 165, 32, "Next Level's Avg:", 1)
      self.contents.font.color = Color.new(64, 245, 128, 255)
      #If skill_level is higher than 0...
      if @actor.skill_level[skill.id] > 0
        #Draw level's Heal Range
        self.contents.draw_text(355, 64, 165, 32, (((skill.variance * -0.01) * power1 + power1) * -1).to_s + " - " + (((skill.variance * 0.01) * power1 + power1) * -1).to_s, 1)
      else
        #Draw level 0's heal range
        self.contents.draw_text(355, 64, 165, 32, 0.to_s + " - " + 0.to_s, 1)
      end
      #If skill_level is higher than 0...
      if @actor.skill_level[skill.id] > 0
        #Draw's Level's current average power
        self.contents.draw_text(355, 192, 165, 32, (power1 * -1).to_s, 1)
      else
        #Draws Level's Healing Average Power
        self.contents.draw_text(355, 192, 165, 32, 0.to_s, 1)
      end
      #Draws Next level's Healing Average
      if @actor.skill_level[skill.id] == @actor.skill_max[skill.id]
        self.contents.draw_text(355, 260, 165, 32, "----------", 1)
      else
        self.contents.draw_text(355, 260, 165, 32, (power2 * -1).to_s, 1)
      end
      #Draws Next level's range
      if @actor.skill_level[skill.id] == @actor.skill_max[skill.id]
        self.contents.draw_text(355, 128, 165, 32, "----------", 1)
      else
        self.contents.draw_text(355, 128, 165, 32, next_level_range2, 1)
      end
      self.contents.font.color = normal_color
    else
      self.contents.font.size = $defaultfontsize
      self.contents.font.color = system_color
      self.contents.draw_text(355, 32, 165, 32, "Power Range:", 1)
      self.contents.draw_text(355, 160, 165, 32, "Level's Power Avg:", 1)
      self.contents.draw_text(355, 228, 165, 32, "Next Level's Avg:", 1)
      self.contents.font.color = Color.new(210, 37, 2, 255)
      #If skill_level is higher than 0...
      if @actor.skill_level[skill.id] > 0
        #Draw Damage Range
        self.contents.draw_text(355, 64, 165, 32, ((skill.variance * -0.01) * power1 + power1).to_s + " - " + ((skill.variance * 0.01) * power1 + power1).to_s, 1)
      else
        #Draw level 0's range
        self.contents.draw_text(355, 64, 165, 32, 0.to_s + " - " + 0.to_s, 1)
      end
      #If skill_level is higher than 0...
      if @actor.skill_level[skill.id] > 0
        #Draw Damage Average
        self.contents.draw_text(355, 192, 165, 32, power1.to_s, 1)
      else
        #Draw level 0's Avg
        self.contents.draw_text(355, 192, 165, 32, 0.to_s, 1)
      end
      #Draw's Next Level's Avg.
      if @actor.skill_level[skill.id] == @actor.skill_max[skill.id]
        self.contents.draw_text(355, 260, 165, 32, "----------", 1)
      else
        self.contents.draw_text(355, 260, 165, 32, power2.to_s, 1)
      end
      #Draw's Next Level's Range
      if @actor.skill_level[skill.id] == @actor.skill_max[skill.id]
        self.contents.draw_text(355, 128, 165, 32, "----------", 1)
      else
        self.contents.draw_text(355, 128, 165, 32, next_level_range, 1)
      end
      self.contents.font.color = normal_color
    end
  end
 
  def refresh2(skill)
    self.contents.font.color = system_color
    #Draws 'Skill Level:'
    self.contents.draw_text(200, 0, 120, 32, "Skill Level:")  
    self.contents.draw_text(355, 32, 165, 32, "Percent of ATK:", 1)
    self.contents.draw_text(355, 96, 165, 32, "Next level's percent:", 1)
    #Draws Attack Type
    self.contents.draw_text(335, 324, 120, 32, "Skill Type:")
    #Draws Skill Name
    self.contents.draw_text(28, 0, 184, 32, skill.name, 0)
    #Draws Skill Level Number
    self.contents.font.color = Color.new(250, 250, 13, 255)
    self.contents.draw_text(290, 0, 50, 32,
    (@actor.skill_level[skill.id]).to_s +  "/" + (@actor.skill_max[skill.id]).to_s)
    #Draws Skill Description
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 48, 330, 32, skill.description)
    self.contents.draw_text(420, 324, 80, 32, "Proficiency")
    reqs = Skill_Level
    case @actor.skill_level[skill.id]
    when 0
      self.contents.draw_text(355, 64, 165, 32, ((@actor.rankd * 100).round).to_s + "%", 1)
      self.contents.draw_text(355, 128, 165, 32, ((@actor.rankc * 100).round).to_s + "%", 1)
    when 1
      self.contents.draw_text(355, 64, 165, 32, ((@actor.rankc * 100).round).to_s + "%", 1)
      self.contents.draw_text(355, 128, 165, 32, ((@actor.rankb * 100).round).to_s + "%", 1)
    when 2
      self.contents.draw_text(355, 64, 165, 32, ((@actor.rankb * 100).round).to_s + "%", 1)
      self.contents.draw_text(355, 128, 165, 32, ((@actor.ranka * 100).round).to_s + "%", 1)
    when 3
      self.contents.draw_text(355, 64, 165, 32, ((@actor.ranka * 100).round).to_s + "%", 1)
      self.contents.draw_text(355, 128, 165, 32, ((@actor.ranks * 100).round).to_s + "%", 1)
    when 4
      self.contents.draw_text(355, 64, 165, 32, ((@actor.ranks * 100).round).to_s + "%", 1)
      self.contents.draw_text(355, 128, 165, 32, "None", 1)
    end
    #Draws Icon
    bitmap = RPG::Cache.icon(skill.icon_name)
    self.contents.blt(0, 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  end
end

#===================================
#  Window_Confirm
#===================================
class Window_Skillconfirm < Window_Selectable
  def initialize
    super(256, 192, 128, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
    self.visible = false
    self.z = -1000
    self.index = -1
    self.active = false
  end
 
  def refresh
    self.contents.clear
    @data = [self.contents.draw_text(0, 0, 96, 32, "Yes", 1), self.contents.draw_text(0, 32, 96, 32, "No", 1)]
    @item_max = @data.size
  end
end



#+++++++++++++++++++++++++++++++++++
#  Scene_Skilllevel
#+++++++++++++++++++++++++++++++++++
class Scene_Skill_level
 
  def initialize(actor_index = 0, skilltype_index = 0)
    @actor_index = actor_index
    @skilltype_index = skilltype_index
  end
 
  def main
    @actor = $game_party.actors[@actor_index]
    @skillinfo_window = Window_Skillinfo.new
    @skillhero_window = Window_Skillhero.new(@actor)
    @skilllist_window = Window_Skilllist.new(@actor)
    @skillpre_window = Window_Skillpre.new(@skilllist_window.skill)
    @skilldesc_window = Window_Skilldesc.new(@actor, @skilllist_window.skill)
    @confirm_window = Window_Skillconfirm.new
    @skill = @skilllist_window.skill
    
    c1 = "Active"
    c2 = "Passive"
    
    @skilltype_window = Window_Command.new(180, [c1, c2])
    @skilltype_window.y = 192
    @skilltype_window.index = @skilltype_index
    
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @skillinfo_window.dispose
    @skillhero_window.dispose
    @skillpre_window.dispose
    @skilllist_window.dispose
    @skilltype_window.dispose
    @skilldesc_window.dispose
    @confirm_window.dispose
  end
 
  def update
    @skillhero_window.update
    @skilltype_window.update
    @skilldesc_window.update
    @skillpre_window.update1
    
    if @skilltype_window.active
      update_skilltype
      return
    end
    
    if @skilllist_window.active
      update_skilllist
      return
    end
    
    if @skilldesc_window.visible
      update_skilldesc
      return
    end
    
    if @confirm_window.active
      update_confirm
      return
    end
    
    if Input.trigger?(Input::L)
      $game_system.se_play($data_system.cursor_se)
      @actor_index += $game_party.actors.size - 1
      @actor_index %= $game_party.actors.size
      $scene = Scene_Skill_level.new
    end
      
    if Input.trigger?(Input::R)
      $game_system.se_play($data_system.cursor_se)
      @actor_index += 1
      @actor_index %= $game_party.actors.size
      $scene = Scene_Skill_level.new
    end
  end
    
  def update_skilltype
    if @skilltype_window.index == 0
      @skillinfo_window.update("Shows active skills.")
      @skilllist_window.refresh
      if Input.trigger?(Input::C)
        @skilltype_window.active = false
        @skilllist_window.active = true
        @skilllist_window.index = 0
      end
    else
      @skillinfo_window.update("Shows passive skills.")
      @skilllist_window.refresh1
      if Input.trigger?(Input::C)
        @skilltype_window.active = false
        @skilllist_window.active = true
        @skilllist_window.index = 0
      end
    end
    
    if Input.trigger?(Input::L)
      $game_system.se_play($data_system.cursor_se)
      @actor_index += $game_party.actors.size - 1
      @actor_index %= $game_party.actors.size
      $scene = Scene_Skill_level.new(@actor_index)
    end
      
    if Input.trigger?(Input::R)
      $game_system.se_play($data_system.cursor_se)
      @actor_index += 1
      @actor_index %= $game_party.actors.size
      $scene = Scene_Skill_level.new(@actor_index)
    end
    
    if Input.trigger?(Input::B)
      $scene = Scene_Map.new
    end
  end
 
  def update_skilllist
    @skillpre_window.update(@skilllist_window.skill)
    @skilllist_window.update
    @confirm_window.z = -1000
    @skillinfo_window.update("Press 'Z' for Skill Description")
    
    if Input.trigger?(Input::B)
      @skilllist_window.index = -1
      @skilllist_window.active = false
      @skilltype_window.active = true
      return
    end
    
    if Input.trigger?(Input::A)
      if @skilllist_window.skill != nil
        @skilldesc_window.refresh(@skilllist_window.skill)
        @skilllist_window.active = false
        @skilldesc_window.visible = true
      else
        $game_system.se_play($data_system.buzzer_se)
      end
    end
    
    if Input.trigger?(Input::L)
      $game_system.se_play($data_system.cursor_se)
      @actor_index += $game_party.actors.size - 1
      @actor_index %= $game_party.actors.size
      $scene = Scene_Skill_level.new(@actor_index)
    end
      
    if Input.trigger?(Input::R)
      $game_system.se_play($data_system.cursor_se)
      @actor_index += 1
      @actor_index %= $game_party.actors.size
      $scene = Scene_Skill_level.new(@actor_index)
    end
    
    if Input.trigger?(Input::C)
    skill = @skilllist_window.skill
      if skill != nil
        if @actor.skill_can_learn?(skill.id) == true
          if @actor.skill_level[@skilllist_window.skill.id] < @actor.skill_max[@skilllist_window.skill.id]
            if @actor.skill_points > 0
              @confirm_window.refresh
              @skilllist_window.active = false
              @confirm_window.active = true
              @confirm_window.visible = true
              @confirm_window.index = 0
            else
              $game_system.se_play($data_system.buzzer_se)
            end
          else
            $game_system.se_play($data_system.buzzer_se)
          end
        else
          $game_system.se_play($data_system.buzzer_se)
        end
      end
    end
  end  
 
  def update_skilldesc
    if @skilldesc_window.visible == true
      @skilllist_window.active = false
      if Input.trigger?(Input::B)
        @skilldesc_window.visible = false
        @skilllist_window.active = true
      end
    end
  end
 
  def update_confirm
    @skillpre_window.update(@skilllist_window.skill)
    @confirm_window.z = 1000
    @confirm_window.update
    @skillinfo_window.update("Are you sure?")
    if Input.trigger?(Input::B)
      @confirm_window.active = false
      @confirm_window.visible = false
      @skilllist_window.active = true
    end
    if Input.trigger?(Input::C)
      if @skilltype_window.index == 0
        case @confirm_window.index
        when 0
          @actor.skill_level[@skilllist_window.skill.id] += 1
          @actor.skill_points -= 1
          @skillhero_window.refresh
          @skilllist_window.refresh
          @confirm_window.visible = false
          @skilllist_window.active = true
          @confirm_window.index = -1
          @actor.bonus(@skilllist_window.skill.id)
          return
        when 1
          @confirm_window.visible = false
          @skilllist_window.active = true
          @confirm_window.index = -1
        end
      else
        case @confirm_window.index
        when 0
          @actor.skill_level[@skilllist_window.skill.id] += 1
          @actor.skill_points -= 1
          @skillhero_window.refresh
          @skilllist_window.refresh1
          @confirm_window.visible = false
          @skilllist_window.active = true
          @confirm_window.index = -1
          @actor.bonus(@skilllist_window.skill.id)
          return
        when 1
          @confirm_window.visible = false
          @skilllist_window.active = true
          @confirm_window.index = -1
        end
      end
    end
  end
end


DEMO

.zip   Proficiency_and_Skill_Level.zip (Size: 231.86 KB / Downloads: 6)


ADDITIONAL NOTES: for proficiency crossover only (not necissary)
1. If you use the Weapon Proficiency cross-over, you must have my weapon proficiency script
installed.
2. If an actor is going to use a sword weapon, they MUST know the sword proficiency skill.
This is true for every weapon type the actor uses. Weapon types are defined in the
weapon proficiency script.
3. All proficiency skills must have the maximum of '4', which is 'S' by default.


THANKS TO:
Arkbennett and Houndchaser/Skyhunter for testing this script and the crossover.
Felicity (my gal) for giving me support in this script and helping a bit with the math.

Use this to add to current skill levels:
x = actor's number, y = skill id, z = amount.
use $game_actors[x].skill_level[y] += z

use this to add to current skill max's:
x = actor's number, y = skill id, z = amount.
use $game_actors[x].skill_max[y] += z

To subtract from the totals, change the '+' to '-'


SDK COMPATIBLE?:
Sorry, untested.
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  Looting System Thieffer 0 2,639 06-18-2009, 01:00 PM
Last Post: Thieffer
  Difficulity Level System Ekhart 0 2,636 03-14-2008, 01:00 PM
Last Post: Ekhart
  Dragon Quest VII Class Changing System Sephirothtds 0 2,757 11-15-2007, 01:00 PM
Last Post: Sephirothtds
  Map Stats and Info System Dubealex 0 2,795 10-19-2007, 01:00 PM
Last Post: Dubealex
  Spell Tablet System GubiD 0 2,890 08-25-2007, 01:00 PM
Last Post: GubiD
  Orb Based Skill System El Conductor 0 2,602 07-29-2007, 01:00 PM
Last Post: El Conductor
  Party Deleting System Ekhart 0 2,638 07-05-2007, 01:00 PM
Last Post: Ekhart
  Class Stat Bonus System Shinami 0 2,544 05-20-2007, 01:00 PM
Last Post: Shinami
  MATERIA SYSTEM with AP illustrationism 0 2,886 05-06-2007, 01:00 PM
Last Post: illustrationism
  MMORPG Leveling System Lettuce 0 2,681 12-23-2006, 01:00 PM
Last Post: Lettuce



Users browsing this thread: 1 Guest(s)