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.

Skill Level Up

I know that there is a Skill Level Up script, but what I'm reqeusting is something different and probobaly easier.

Basically, I want a script that skills level up similar to this one

Code:
#==============================================================================
# ** Skill Update   Ver. 4.6.1                     by Claimh
#------------------------------------------------------------------------------
#     * System to create each skill's own 'level'... Draw_skill_exp
#     Introduces a system to increase skill potential by their own levels.
#     Skills can increase in individual levels (the skill's power can increase,
#     SP usage decreases, the skill's to-hit ratio rises) after use.
#
#     NOTE by DERVVULFMAN:
#     Place 'below' Tactical Skills (aka BLITZ) and the Tactical Command Add-On
#     for both systems to work together. If placed above both of these systems,
#     the actual skill leveling and changes  will not be performed...  only the
#     level indication system will work.
#
#==============================================================================

module Skill_updata
  S_MIGHT = []
  S_COST = []
  S_HIT = []
  S_LEVEL = []
  S_INTER = []
  S_SLOPE = []
  S_ANIME = []
  S_ELEMENT = []
  S_STATE_P = []
  S_STATE_N = []
#==============================================================================
# ** Customization point
#==============================================================================
  #----------------------------------------------------------------------------
  # Basic Update Settings
  #----------------------------------------------------------------------------
  # Skill Power Increase
  SKILL_MIGHT_UP = true          # Nil → false
  # SP Usage Decreased
  SP_COST_DOWN = true            # Nil → false
  # To-Hit Ratio Increased
  SKILL_HIT_UP = true            # Nil → false
  # Attribute Change system used
  ELEMENT_CHANGE = true          # Nil → false
  # State Change system used
  STATE_CHANGE = true            # Nil → false
  
  # Level Increase display is used
  SHOW_SKILL_LV_UP = true        # Nil -> false
  # Level Increase SE 
  SKILLUP_SE = "056-Right02"     # Sets to Nil if there's no SE file
  # Field Menu allows for Increase (Level Increase display & sound do not play.)
  MENU_COUNT = true

  # Number of times to use skill for the skill to grow
  UPDATA_INTERVAL = 1            # 1 or more
  # Level Limit for Skill Growth
  LEVEL_LIMIT = 5               # 1 or more

  # Skill Power Increase rate(%)
  MIGHT_RATE = 0.5
  # SP Usage Decrease rate(%)
  COST_RATE = 3
  # Skill To-Hit Increase Rate(%)
  HIT_RATE = 1.2

  #----------------------------------------------------------------------------
  # Skill & detail settings
  #----------------------------------------------------------------------------
  # Skill Limit per Actor
  # S_LEVEL[Skill ID] = [Actor ID = Level Limit, ...]
  # * The default limit (LEVEL_LIMIT) is used if a specific limit isn't listed.
  # * If the Actor ID is set to 0, the limit applies to all unspecified actors.

  
  # Skill 'Power' Increase Rate per Actor
  # S_MIGHT[Skill ID] = [Actor ID => Power Rate Increase, ...]
  # * The default rate (MIGHT_RATE) is used for any Power rates not included.
  # * If the Actor ID is set to 0, the rate applies to all unspecified actors.



  # Skill 'SP Usage' Decrease Rate per Actor.
  # S_COST[Skill ID] = [Actor ID => SP Use Decrease Rate, ...]
  # * The default rate (COST_RATE) is used for any SP rates not included.  
  # * If the Actor ID is set to 0, the rate applies to all unspecified actors.



  # Skill 'To-Hit' Increase Rate per Actor.
  # S_HIT[Skill ID] = [Actor ID => To-Hit Increase Rate, ...]
  # * The default rate (HIT_RATE) is used for any To-Hit rates not included.  
  # * If the Actor ID is set to 0, the rate applies to all unspecified actors.
  S_HIT[57] = {0=>1,1=>2, 2=>1, 3=>1, 4=>1, 5=>1, 6=>1, 7=>1, 8=>1}

  #----------------------------------------------------------------------------
  # Details setting of growth of skill
  #----------------------------------------------------------------------------
  # Growth pattern of skill
  # 0 : Skill increases uniformly every update interval
  # 1 : Skill update interval grows larger each increase (Interval + Skill Lvl)
  SKILL_PATTERN = 1
  
  # Skill 'Level Interval' Rate per Actor.
  # S_INTER[Skill ID] = [Actor ID=> Level Interval, ...]
  #  * The default leveling rate (UPDATA_INTERVAL) is used for any Interval 
  #    rates that are not included.
  #  * If the Actor ID is set to 0, the rate applies to all unspecified actors.  
  
  
  # Skill Interval Growth per Actor (Only if SKILL_PATTERN is set to '1')
  # S_SLOPE[Skill ID] = [Actor ID => Interval Increase, ...]
  #  * The Growth Increase of '1' cumulative level is used when not specified.
  #  * If the Actor ID is set to 0, the increase works on all unspecified actors.  
  S_SLOPE[57] = {0=>10}

  #----------------------------------------------------------------------------
  # Change 'Target' Battle Animation based on Skill Level.  No change if false.
  #  Example: S_ANIME[Skill ID] = [Actor ID=>[[Level, Animation ID]], ...]
  #----------------------------------------------------------------------------
  # The animation changes for every skill growth level?
  USE_S_ANIME = true
  
  # Animation Settings
  # Each skill can have multiple settings for each actor.
  # As for Aluxes when Cross Cut becomes Lv.5 and Lv.10, the animation changes.
  # As for Basil when Cross Cut finally becomes Lv.11, the animation changes.
  # * When set to 0, the animation change applies to all unspecified actors.    
  S_ANIME[57] = {0=>[[5, 69]], 1=>[[5, 69], [10, 70]], 2=>[[11, 70]]}

  #----------------------------------------------------------------------------
  # If ELEMENT_CHANGE and/or STATE_CHANGE, this section is disregarded.
  #----------------------------------------------------------------------------
  # Element Attribute change
  # S_ELEMENT[Skill ID] = {Actor ID=>{Level =>[Element ID, Element ID,...]}, ...}
  # * If the Actor ID is set to 0, the element changes work on all unset actors.
  S_ELEMENT[57] = {1=>{1=>[1], 2=>[2], 3=>[3]}, 2=>{1=>[2], 2=>[5]}}

  # State change +
  # S_STATE_P[Skill ID] = {Actor ID=>{Level =>[State ID, State ID, ...]}, ...}
  # * If the Actor ID is set to 0, the state increases work on all unset actors.
  S_STATE_P[57] = {1=>{1=>[1], 2=>[2], 3=>[3]}, 2=>{1=>[2], 2=>[5]}}

  # State change?
  # S_STATE_N[Skill ID] = {Actor ID=>{Level =>[State ID, State ID...]}, ...}
  # * If the Actor ID is set to 0, the state removals work on all unset actors.
  S_STATE_N[57] = {1=>{1=>[1], 2=>[2], 3=>[3]}, 2=>{1=>[2], 2=>[5]}}

#==============================================================================
# ** Customization point end
#==============================================================================
end


class Game_Actor
  include Skill_updata
  attr_accessor   :skill_use      # Frequency of skill use
  attr_accessor   :skill_level    # Skill level
  attr_accessor   :skill_power    # Skill power renewal value
  attr_accessor   :skill_sp_cost  # Skill SP consumption renewal value
  attr_accessor   :skill_hit      # Skill on-target hit ratio
  attr_accessor   :skill_up       # Levelling up flag
  attr_accessor   :skill_list     # Skill EXP list
  alias skill_updata_init setup
  def setup(actor_id)
    skill_updata_init(actor_id)
    @skill_use = []
    @skill_level = []
    @skill_power = []
    @skill_sp_cost = []
    @skill_hit = []
    @skill_up = false
    @skill_list = []
    for id in 1...$data_skills.size
      @skill_use[id] = 0
      @skill_level[id] = 0
      @skill_power[id] = $data_skills[id].power
      @skill_sp_cost[id] = $data_skills[id].sp_cost
      @skill_hit[id] = $data_skills[id].hit
      @skill_list[id] = make_skill_list(id)
    end
  end

  #--------------------------------------------------------------------------
  # * Skill EXP calculation
  #--------------------------------------------------------------------------
  def make_skill_list(skill_id)
    interval = S_INTER[skill_id]
    if !interval.nil? and !interval[@actor_id].nil?
      up_interval = interval[@actor_id]
    elsif !interval.nil? and !interval[0].nil?
      up_interval = interval[0]
    else
      up_interval = UPDATA_INTERVAL
    end
    # Inclination
    slope = S_SLOPE[skill_id]
    if !slope.nil? and !slope[@actor_id].nil?
      up_slope = slope[@actor_id]
    elsif !slope.nil? and !slope[0].nil?
      up_slope = slope[0]
    else
      up_slope = 1
    end
    limit = S_LEVEL[skill_id]
    # Limited level
    if !limit.nil? and !limit[@actor_id].nil?
      limit_lv = limit[@actor_id]
    elsif !limit.nil? and !limit[0].nil?
      limit_lv = limit[0]
    else
      limit_lv = LEVEL_LIMIT
    end
    list = []
    list[0] = 0
    # Skill EXP list compilation
    for lv in 1...limit_lv+1
      exp = 0
      case SKILL_PATTERN
      when 0
        exp = up_interval * lv
      when 1
        exp = list[lv-1] + up_slope * lv + up_interval
      end
      list[lv] = exp.truncate
    end
    return list
  end
end


class Game_Battler
  include Skill_updata
  #--------------------------------------------------------------------------
  # * Apply Skill Effects
  #     user  : the one using skills (battler)
  #     skill : skill
  #--------------------------------------------------------------------------
  alias skill_effect_update skill_effect
  def skill_effect(user, skill)
    up_flag = false
    if user.is_a?(Game_Actor) and ($scene.is_a?(Scene_Battle) or MENU_COUNT)
      skill_update_main(user, skill)
      skill_base = $data_skills[skill.id].dup
      # Power rise
      if SKILL_MIGHT_UP
        skill.power = user.skill_power[skill.id]
      end
      # On-target hit ratio rise
      if SKILL_HIT_UP
        skill.hit = user.skill_hit[skill.id]
      end
      # Attribute change
      if ELEMENT_CHANGE and S_ELEMENT != []
        ele1 = S_ELEMENT[skill.id]
        if !ele1.nil? and !ele1[user.id].nil?
          ele2 = ele1[user.id]
        elsif !ele1.nil? and !ele1[0].nil?
          ele2 = ele1[0]
        else
          # If there is no setting, disregard
          ele2 = nil
        end
        if !ele2.nil? and ele2[user.skill_level[skill.id]] != nil
          skill.element_set = ele2[user.skill_level[skill.id]]
        end
      end
      # State change
      if STATE_CHANGE
        if S_STATE_P != []
          pst1 = S_STATE_P[skill.id]
          if !pst1.nil? and !pst1[user.id].nil?
            pst2 = pst1[user.id]
          elsif !pst1.nil? and !pst1[0].nil?
            pst2 = pst1[0]
          else
            # If there is no setting, disregard
            pst2 = nil
          end
          if pst2 != nil and pst2[user.skill_level[skill.id]] != nil
            skill.plus_state_set = pst2[user.skill_level[skill.id]]
          end
        end
        if S_STATE_N != []
          nst1 = S_STATE_N[skill.id]
          if !nst1.nil? and !nst1[user.id].nil?
            nst2 = nst1[user.id]
          elsif !nst1.nil? and !nst1[0].nil?
            nst2 = nst1[0]
          else
            # If there is no setting, disregard
            nst2 = nil
          end
          if nst1 != nil and nst2[user.skill_level[skill.id]] != nil
            skill.minus_state_set = nst2[user.skill_level[skill.id]]
          end
        end
      end
      up_flag = true
    end
    ret = skill_effect_update(user, skill)    # Original
    if up_flag
      $data_skills[skill.id] = skill_base.dup
      # if Miss occurs
      if self.damage == "Miss"
        skill_use_recount(user, skill)
      end
    end
    return ret
  end
  
  #--------------------------------------------------------------------------
  # * Skill rise count
  #--------------------------------------------------------------------------
  def skill_update_main(actor, skill)
    # Count of frequency of skill use
    actor.skill_use[skill.id] += 1
    # Limit acquisition
    limit = S_LEVEL[skill.id]
    if !limit.nil? and !limit[actor.id].nil?
      s_limit = limit[actor.id]
    elsif !limit.nil? and !limit[0].nil?
      s_limit = limit[0]
    else
      s_limit = LEVEL_LIMIT
    end
    # Rewriting limited arrival
    if s_limit == false or actor.skill_level[skill.id] < s_limit
      # Levelling up interval acquisition
      interval = actor.skill_list[skill.id]
      # Rewriting frequency arrival
      if actor.skill_use[skill.id] == interval[actor.skill_level[skill.id]+1]
        # Skill level rise
        actor.skill_level[skill.id] += 1
        actor.skill_up = true
        # Power rise = validity
        if SKILL_MIGHT_UP
          might = S_MIGHT[skill.id]
          if !might.nil? and !might[actor.id].nil?
            might_rate = might[actor.id]
          elsif !might.nil? and !might[0].nil?
            might_rate = might[0]
          else
            might_rate = MIGHT_RATE
          end
          # Correction value renewal
          actor.skill_power[skill.id] += skill.power * might_rate / 100
          actor.skill_power[skill.id] = actor.skill_power[skill.id].truncate
        end
        # SP consumption decrease = validity
        if SP_COST_DOWN
          cost = S_COST[skill.id]
          if !cost.nil? and !cost[actor.id].nil?
            cost_rate = cost[actor.id]
          elsif !cost.nil? and !cost[0].nil?
            cost_rate = cost[0]
          else
            cost_rate = COST_RATE
          end
          actor.skill_sp_cost[skill.id] -= skill.sp_cost * cost_rate / 100
          actor.skill_sp_cost[skill.id] = actor.skill_sp_cost[skill.id].truncate
          # SP consumption cannot be 0 or less
          if actor.skill_sp_cost[skill.id] < 0
            actor.skill_sp_cost[skill.id] = 0
          end
        end
        # On-target hit ratio rise = validity
        if SKILL_HIT_UP
          hit = S_HIT[skill.id]
          if !hit.nil? and !hit[actor.id].nil?
            hit_rate = hit[actor.id]
          elsif !hit.nil? and !hit[0].nil?
            hit_rate = hit[0]
          else
            hit_rate = HIT_RATE
          end
          actor.skill_hit[skill.id] += skill.hit * hit_rate / 100
          actor.skill_hit[skill.id] = actor.skill_hit[skill.id].truncate
          # Cannot be 100 or more
          if actor.skill_hit[skill.id] > 100
            actor.skill_hit[skill.id] = 100
          end
        end
      end
    end
  end
  
  #--------------------------------------------------------------------------
  # * Re-count
  #--------------------------------------------------------------------------
  def skill_use_recount(actor, skill)
    if actor.skill_up
      actor.skill_level[skill.id] -= 1
      # Power recalculate
      if SKILL_MIGHT_UP
        actor.skill_power[skill.id] = skill.power
        might = S_MIGHT[skill.id]
        if !might.nil? and !might[actor.id].nil?
          might_rate = might[actor.id]
        elsif !might.nil? and !might[0].nil?
          might_rate = might[0]
        else
          might_rate = MIGHT_RATE
        end
        for i in 1...actor.skill_level[skill.id]
          actor.skill_power[skill.id] += skill.power * might_rate / 100
          actor.skill_power[skill.id] = actor.skill_power[skill.id].truncate
        end
      end
      # SP consumption recalculate
      if SP_COST_DOWN
        actor.skill_sp_cost[skill.id] = skill.sp_cost
        cost = S_COST[skill.id]
        if !cost.nil? and !cost[actor.id].nil?
          cost_rate = cost[actor.id]
        elsif !cost.nil? and !cost[0].nil?
          cost_rate = cost[0]
        else
          cost_rate = COST_RATE
        end
        for i in 1...actor.skill_level[skill.id]
          actor.skill_sp_cost[skill.id] -= skill.sp_cost * cost_rate / 100
          actor.skill_sp_cost[skill.id] = actor.skill_sp_cost[skill.id].truncate
        end
        # SP consumption cannot be 0 or less
        if actor.skill_sp_cost[skill.id] < 0
          actor.skill_sp_cost[skill.id] = 0
        end
      end
      # On-target hit ratio recalculate
      if SKILL_HIT_UP
        actor.skill_hit[skill.id] = skill.hit
        hit = S_HIT[skill.id]
        if !hit.nil? and !hit[actor.id].nil?
          hit_rate = hit[actor.id]
        elsif !hit.nil? and !hit[0].nil?
          hit_rate = hit[0]
        else
          hit_rate = HIT_RATE
        end
        for i in 1...actor.skill_level[skill.id]
          actor.skill_hit[skill.id] += skill.hit * hit_rate / 100
          actor.skill_hit[skill.id] = actor.skill_hit[skill.id].truncate
        end
        # Cannot be 100 or more
        if actor.skill_hit[skill.id] > 100
          actor.skill_hit[skill.id] = 100
        end
      end
      actor.skill_up = false
    end
    actor.skill_use[skill.id] -= 1
  end
end

#==============================================================================
# The animation change with skill growth
#==============================================================================
class Scene_Battle
  include Skill_updata
  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 4 : animation for target)
  #--------------------------------------------------------------------------
  alias update_phase4_step4_skillup update_phase4_step4
  def update_phase4_step4
    update_phase4_step4_skillup
    if @active_battler.is_a?(Game_Actor) and USE_S_ANIME
      s_anime = S_ANIME[@skill.id]
      if !s_anime.nil? and !s_anime[@active_battler.id].nil?
        s_anime_set = s_anime[@active_battler.id]
      elsif !s_anime.nil? and !s_anime[0].nil?
        s_anime_set = s_anime[0]
      else
        # If there is no setting, disregard
        return
      end
      for i in 0...s_anime_set.size
        s_anime_def = s_anime_set[i]
        # If above stipulated level animation change
        if @active_battler.skill_level[@skill.id] >= s_anime_def[0]
          # Setting object side animation
          for target in @target_battlers
            target.animation_id = s_anime_def[1]
          end
        end
      end
    end
  end
end

#==============================================================================
# * If the leveling up display system is not needed, turn it off.  OK?
#==============================================================================
class Scene_Battle
  include Skill_updata
  if SHOW_SKILL_LV_UP
  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 2 : start action)
  #--------------------------------------------------------------------------
  alias update_phase4_step2_skillup update_phase4_step2
  def update_phase4_step2
    if @active_battler.is_a?(Game_Actor)
      @active_battler.skill_up = false
    end
    @skillup = false
    update_phase4_step2_skillup   # Original
  end

  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 3 : animation for action performer)
  #--------------------------------------------------------------------------
  alias update_phase4_step3_skillup update_phase4_step3
  def update_phase4_step3
    if @active_battler.is_a?(Game_Actor) and @active_battler.skill_up != false
      @skillup = true
      @skill_up_window = Window_Skillup.new(@active_battler)
      if SKILLUP_SE != nil
        Audio.se_play("Audio/SE/" + SKILLUP_SE)
        sleep(0.1)
      end
    end
    update_phase4_step3_skillup
  end

  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 5 : damage display)
  #--------------------------------------------------------------------------
  alias update_phase4_step5_skillup update_phase4_step5
  def update_phase4_step5
    if @active_battler.is_a?(Game_Actor) and @skillup
      @skill_up_window.dispose
      @active_battler.skill_up = false
      @skillup = false
    end
    update_phase4_step5_skillup     # Original
  end

  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias update_skillup update
  def update
    if @active_battler.is_a?(Game_Actor) and @active_battler.skill_up and @skillup
      @skill_up_window.contents_opacity -= 4
    end
    update_skillup              # Original
  end
  end # if SHOW_SKILL_LV_UP
end

class Window_Skillup < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     actor : actor
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(actor.screen_x-140, 260, 250, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    self.contents.font.color = Color.new(255, 64, 0)
    self.contents.draw_text(80, 0, 150, 32, "MAGIC LEVEL UP!")
  end
end



#==============================================================================
# * Below, the edited part is marked. If the (SP Use Decreased) system is not 
#   being used, turn it off. OK?
#==============================================================================
class Window_Skill < Window_Selectable
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    skill = @data[index]
    if @actor.skill_can_use?(skill.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % 2 * (288 + 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)
#-Correction-----
    @actor.skill_level[skill.id] = 0 if @actor.skill_level[skill.id] == nil
    name_level = skill.name + " [LV " + @actor.skill_level[skill.id].to_s + "]" 
    self.contents.draw_text(x + 28, y, 204, 32, name_level, 0)
    @actor.skill_sp_cost[skill.id] = skill.sp_cost if @actor.skill_sp_cost[skill.id] == nil
    self.contents.draw_text(x + 232, y, 48, 32, @actor.skill_sp_cost[skill.id].to_s, 2)
#----------------
  end
end

class Scene_Skill
  #--------------------------------------------------------------------------
  # * Frame Update (when target window is active)
  #--------------------------------------------------------------------------
  def update_target 
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Erase target window
      @skill_window.active = true
      @target_window.visible = false
      @target_window.active = false
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # If unable to use because SP ran out
      unless @actor.skill_can_use?(@skill.id)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # If target is all
      if @target_window.index == -1
        # Apply skill use effects to entire party
        used = false
        for i in $game_party.actors
          used |= i.skill_effect(@actor, @skill)
        end
      end
      # If target is user
      if @target_window.index <= -2
        # Apply skill use effects to target actor
        target = $game_party.actors[@target_window.index + 10]
        used = target.skill_effect(@actor, @skill)
      end
      # If single target
      if @target_window.index >= 0
        # Apply skill use effects to target actor
        target = $game_party.actors[@target_window.index]
        used = target.skill_effect(@actor, @skill)
      end
      # If skill was used
      if used
        # Play skill use SE
        $game_system.se_play(@skill.menu_se)
#-----Correction------------------------------------------------
        @actor.skill_sp_cost[@skill.id] = @skill.sp_cost if @actor.skill_sp_cost[@skill.id] == nil
        # Use up SP
        @actor.sp -= @actor.skill_sp_cost[@skill.id]
#---------------------------------------------------------------
        # Remake each window content
        @status_window.refresh
        @skill_window.refresh
        @target_window.refresh
        # If entire party is dead
        if $game_party.all_dead?
          # Switch to game over screen
          $scene = Scene_Gameover.new
          return
        end
        # If command event ID is valid
        if @skill.common_event_id > 0
          # Command event call reservation
          $game_temp.common_event_id = @skill.common_event_id
         # Switch to map screen
          $scene = Scene_Map.new
          return
        end
      end
      # If skill wasn't used
      unless used
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
      end
      return
    end
  end
end

class Scene_Battle
  include Skill_updata
  #--------------------------------------------------------------------------
  # * Make Skill Action Results
  #--------------------------------------------------------------------------
  alias make_skill_action_result_skill_update make_skill_action_result
  def make_skill_action_result
    make_skill_action_result_skill_update
    # SP Consumption
    if SP_COST_DOWN and @active_battler.is_a?(Game_Actor)
      @active_battler.sp += @skill.sp_cost
      @active_battler.sp -= @active_battler.skill_sp_cost[@skill.id]
    end
  end
end

class Game_Battler
  #--------------------------------------------------------------------------
  # * Determine Usable Skills
  #     skill_id : skill ID
  #--------------------------------------------------------------------------
  alias skill_update_can_use? skill_can_use?
  def skill_can_use?(skill_id)
    ret = skill_update_can_use?(skill_id)
    if !ret and SP_COST_DOWN
      # When SP is not enough, it became use failure?
      if $data_skills[skill_id].sp_cost > self.sp
        if self.is_a?(Game_Actor)
          skill_sp_cost = self.skill_sp_cost[skill_id]
          if skill_sp_cost < self.sp
            ret = true
          end
        end
      end
    end
    return ret
  end
end

#==============================================================================
# ** Interpreter
#==============================================================================
class Interpreter
  include Skill_updata
  #--------------------------------------------------------------------------
  # ● Skill level setting (level set)
  #     actor_id  :   Actor ID
  #     skill_id  :   Skill ID
  #     level     :   Setting level
  #--------------------------------------------------------------------------
  def set_skill_level(actor_id, skill_id, level)
    actor = $game_actors[actor_id]
    skill = $data_skills[skill_id]
    # Acquire Limit
    limit = S_LEVEL[skill_id]
    if !limit.nil? and !limit[actor.id].nil?
      s_limit = limit[actor.id]
    elsif !limit.nil? and !limit[0].nil?
      s_limit = limit[0]
    else
      s_limit = LEVEL_LIMIT
    end
    if level > s_limit or level < 0
      return
    end
    # Level
    actor.skill_level[skill.id] = level
    # Frequency of use
    use_list = actor.skill_list[skill.id]
    actor.skill_use[skill.id] = use_list[level]
    # Power recalculate
    if SKILL_MIGHT_UP
      actor.skill_power[skill.id] = skill.power
      might = S_MIGHT[skill.id]
      if !might.nil? and !might[actor.id].nil?
        might_rate = might[actor.id]
      elsif !might.nil? and !might[0].nil?
        might_rate = might[0]
      else
        might_rate = MIGHT_RATE
      end
      for i in 0...level
        actor.skill_power[skill.id] += skill.power * might_rate / 100
        actor.skill_power[skill.id] = actor.skill_power[skill.id].truncate
      end
    end
    # SP consumption recalculate
    if SP_COST_DOWN
      actor.skill_sp_cost[skill.id] = skill.sp_cost
      cost = S_COST[skill.id]
      if !cost.nil? and !cost[actor.id].nil?
        cost_rate = cost[actor.id]
      elsif !cost.nil? and !cost[0].nil? and !cost.nil?
        cost_rate = cost[0]
      else
        cost_rate = COST_RATE
      end
      for i in 0...level
        actor.skill_sp_cost[skill.id] -= skill.sp_cost * cost_rate / 100
        actor.skill_sp_cost[skill.id] = actor.skill_sp_cost[skill.id].truncate
      end
      # SP consumption cannot be 0 or less
      if actor.skill_sp_cost[skill.id] < 0
        actor.skill_sp_cost[skill.id] = 0
      end
    end
    # On-target hit ratio recalculate
    if SKILL_HIT_UP
      actor.skill_hit[skill.id] = skill.hit
      hit = S_HIT[skill.id]
      if !hit.nil? and !hit[actor.id].nil?
        hit_rate = hit[actor.id]
      elsif !hit.nil? and !hit[0].nil? and !hit.nil?
        hit_rate = hit[0]
      else
        hit_rate = HIT_RATE
      end
      for i in 0...level
        actor.skill_hit[skill.id] += skill.hit * hit_rate / 100
        actor.skill_hit[skill.id] = actor.skill_hit[skill.id].truncate
      end
      # Cannot be 100 or more
      if actor.skill_hit[skill.id] > 100
        actor.skill_hit[skill.id] = 100
      end
    end
  end
  
  #--------------------------------------------------------------------------
  # * Skill level setting (level up)
  #     actor_id  :   Actor ID
  #     skill_id  :   Skill ID
  #--------------------------------------------------------------------------
  def skill_level_up(actor_id, skill_id)
    actor = $game_actors[actor_id]
    set_skill_level(actor_id, skill_id, actor.skill_level[skill_id]+1)
  end
  
  #--------------------------------------------------------------------------
  # * Skill level setting (level down)
  #     actor_id  :   Actor ID
  #     skill_id  :   Skill ID
  #--------------------------------------------------------------------------
  def skill_level_down(actor_id, skill_id)
    actor = $game_actors[actor_id]
    set_skill_level(actor_id, skill_id, actor.skill_level[skill_id]-1)
  end
end

class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Draw Skill Experience (frequency of use/NEXT)
  #     actor        : Actor
  #     skill_id     : Skill ID
  #     x            : Draw X Coordinates
  #     y            : Draw Y Coordinates
  #--------------------------------------------------------------------------
  def draw_skill_exp(actor, skill_id, x, y)
    list = actor.skill_list[skill_id]
    limit = Skill_updata::S_LEVEL[skill_id]
    if !limit.nil? and !limit[actor.id].nil?
      skill_limit = limit[actor.id]
    elsif !limit.nil? and !limit[0].nil?
      skill_limit = limit[0]
    else
      skill_limit = Skill_updata::LEVEL_LIMIT
    end
    if actor.skill_level[skill_id] == skill_limit
      next_exp = "-"
    else
      next_exp = list[actor.skill_level[skill_id]+1].to_s
    end
    use = actor.skill_use[skill_id]
    skill_exp = use.to_s + "/" + next_exp
    self.contents.draw_text(x, y, 100, 32, skill_exp)
  end
end

But, instead of increasing power or such when leveling up, the skill is simply replaced with another skill in the database.

I would need it so you can set the amount of times you need to use a skilll as a different number for each individual skill. I would also need to be able to set what each skill "evolves" to.

For example, if you use Skill A 20 times, it will be replaced with Skill B. If you use Skill 1 15 times, it will be replaced with Skill 2. If you use Skill B 35 times, it will be replaced with Skill C. However, Skill C is the final step in the skill "evolution". No matter how many times you use it, it will remain the same.

If possible, I would like the option to switch whether the effects of a skill leveling up are immediate or only take place after the battle.

If anyone can do this, thanks. If you have any questions, feel free to ask or PM me.
 

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