Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # ☆ $D13x - Skill Levels
- # -- Author : Dekita
- # -- Version : 1.6
- # -- Level : Easy / Normal
- # -- Requires : $D13x - Statistic Control
- # -- Engine : RPG Maker VX Ace.
- #
- #===============================================================================
- # ☆ Import
- #-------------------------------------------------------------------------------
- $D13x={}if$D13x==nil
- $D13x[:Skill_Lv]=true
- #===============================================================================
- # ☆ Updates
- #-------------------------------------------------------------------------------
- # D /M /Y
- # 2o/o7/2o13 - Small bugfix, (when using damage items)
- # 28/o5/2o13 - Small Bugfix, (:dmg_deal |:dmg_take formulas)
- # 2o/o5/2o13 - Update, (:dmg_deal | :dmg_take eval formulas)
- # 17/o5/2o13 - Fixed Incorrect Notetag Info,
- # - Added reset_skills_exp script call,
- # 22/o4/2o13 - Fixed Bug, (forget skill error)
- # 23/o3/2o13 - Fixed Bug, (guard skill leveling)
- # - Added Guard && Attack Skill Lv Options,
- # - Added New Script Calls,
- # 21/o3/2o13 - Fixed Bug, (enemy damage)
- # - Fixed Bug, (Mp/Tp cost)
- # 2o/o3/2o13 - Finished,
- # 1o/o3/2o13 - Started
- #
- #===============================================================================
- # ☆ Introduction
- #-------------------------------------------------------------------------------
- # This script gives skills - levels.
- # You can have different growth types, exp requirements, max level,
- # level name and damage multiplier for each skill.
- # Simple notetag usage.
- # Plug-N-Play.
- #
- #===============================================================================
- # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
- #===============================================================================
- # 1. You MUST give credit to "Dekita" !!
- # 2. You are NOT allowed to repost this script.(or modified versions)
- # 3. You are NOT allowed to convert this script.
- # 4. You are NOT allowed to use this script for Commercial games.
- # 5. ENJOY!
- #
- # "FINE PRINT"
- # By using this script you hereby agree to the above terms and conditions,
- # if any violation of the above terms occurs "legal action" may be taken.
- # Not understanding the above terms and conditions does NOT mean that
- # they do not apply to you.
- # If you wish to discuss the terms and conditions in further detail you can
- # contact me at http://dekitarpg.wordpress.com/
- #
- #===============================================================================
- # ☆ Instructions
- #-------------------------------------------------------------------------------
- # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
- # Place Under My $D13x - Statistic Control Script.
- #
- #===============================================================================
- # ☆ Script Calls
- #-------------------------------------------------------------------------------
- # level_skill(actor_id, skill_id, show = true)
- # level_skill(actor_id, skill_id)
- # gain_skill_exp(actor_id, skill_id, value, show = true)
- # gain_skill_exp(actor_id, skill_id, value)
- #
- # actor_id = the id of the actor from the database.
- # skill_id = the id of the skill from the database.
- # value = the amount you wish to increase the exp.
- # show = make show false to not display skills level change.
- #
- #-------------------------------------------------------------------------------
- # $game_actors[ACTOR_ID].reset_skills_exp
- # $game_party.members[MEBMER_ID].reset_skills_exp
- # $game_party.leader.reset_skills_exp
- #
- # ACTOR_ID = the id of the actor from the database.
- # MEMBER_ID = the party members id (0 = leader)
- # This script call will reset all skills exp and level.
- #
- #===============================================================================
- # ☆ Notetags ( default )
- # For use with Skill Noteboxes only !
- #-------------------------------------------------------------------------------
- # <exp set: id>
- # replace id with the id of the Exp_Set (defined below) that you wish to use.
- #
- # <growth type: id>
- # replace id with the id of the Growth_Type (defined below) that you wish to use.
- #
- # <max level: value>
- # replace value with the maximum level for that skill
- # (cannot be higher than the Exp_Set hash size)
- #
- #===============================================================================
- # ☆ HELP
- #-------------------------------------------------------------------------------
- # The default max level is the size of its Exp_Set[id] hash.
- #
- #===============================================================================
- module Skill_Levels
- #===============================================================================
- Exp_Set=[]# << Keep
- Growth_Type=[]# << Keep
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # ☆ General Settings
- #--------------------------------------------------------------------------
- # Reset Exp to 0 after level up ?
- Exp_Reset_On_Lv_Up = false # true
- # Reset Level && Exp after forgetting skill ?
- Reset_On_Forget = true
- # If these are true, skill costs will be multiplied by the DMG Multi
- Dmg_Multi_Skill_Cost = { :mp => true , :tp => false }
- # Default Exp Set given to skills (unless notetagged)
- Default_Exp_Set_ID = 0
- # Default Growth Type given to skills (unless notetagged)
- Default_GrowthT_ID = 0
- # Make this true to allow the default Attack skill to level up
- Default_Attack_Can_Lv = false
- # Make this true to allow the default Guard skill to level up
- Default_Guard__Can_Lv = false
- # Default Notetags
- Notes={
- :exp_set => /<exp set:(.*)>/i ,
- :max_lev => /<max level:(.*)>/i ,
- :gro_typ => /<growth type:(.*)>/i ,
- }# << end Notes={}
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # ☆ Exp Setup - Settings
- #--------------------------------------------------------------------------
- # here is where you define the required exp for each level
- # as well as the level name and damage multiplier.
- # DMG Multi will also increase any statistics gained by
- # using the Statistic Control scripts notetags
- # you can add to this array as you please.
- Exp_Set[0]={#<< Exp Settings : 0 Begin
- # Level => [Exp Req, "Name", DMG Multi] ,
- 1 => [ 0, "Lv 1", 1.0 ] , # << Default level
- 2 => [ 25, "Lv 2", 1.1 ] ,
- 3 => [ 50, "Lv 3", 1.2 ] ,
- 4 => [ 100, "Lv 4", 1.4 ] ,
- 5 => [ 200, "Lv 5", 1.6 ] ,
- 6 => [ 400, "Lv 6", 1.8 ] ,
- 7 => [ 800, "Lv 7", 2.0 ] ,
- 8 => [ 1600, "Lv 8", 2.4 ] ,
- 9 => [ 3200, "Lv 9", 3.0 ] ,
- }# << Keep
- Exp_Set[1]={#<< Exp Settings : 1 Begin
- # Level => [Exp Req, "Name", DMG Multi] ,
- 1 => [ 0, "Lv 1", 1.0 ] , # << Default level
- 2 => [ 50, "Lv 2", 1.1 ] ,
- 3 => [ 100, "Lv 3", 1.2 ] ,
- 4 => [ 200, "Lv 4", 1.4 ] ,
- 5 => [ 400, "Lv 5", 1.6 ] ,
- 6 => [ 800, "Lv 6", 1.8 ] ,
- 7 => [ 1600, "Lv 7", 2.0 ] ,
- 8 => [ 3200, "Lv 8", 2.4 ] ,
- 9 => [ 6400, "Lv 9", 3.0 ] ,
- }# << Keep
- Exp_Set[2]={#<< Exp Settings : 2 Begin
- # Level => [Exp Req, "Name", DMG Multi] ,
- 1 => [ 0, "Lv 1", 1.0 ] , # << Default level
- 2 => [ 15, "Lv 2", 1.1 ] ,
- 3 => [ 45, "Lv 3", 1.2 ] ,
- 4 => [ 135, "Lv 4", 1.4 ] ,
- 5 => [ 405, "Lv 5", 1.6 ] ,
- 6 => [ 1215, "Lv 6", 1.8 ] ,
- 7 => [ 3645, "Lv 7", 2.0 ] ,
- 8 => [ 10935, "Lv 8", 2.4 ] ,
- 9 => [ 32805, "Lv 9", 3.0 ] ,
- }# << Keep
- Exp_Set[3]={#<< Exp Settings : 3 Begin
- # Level => [Exp Req, "Name", DMG Multi] ,
- # This Exp_Set Was Customized By Arrenjevleth @ http://forums.rpgmakerweb.com
- 1 => [ 0, "I", 1.0 ] , # << Default level
- 2 => [ 10, "II", 1.1 ] ,
- 3 => [ 30, "III", 1.25 ] ,
- 4 => [ 60, "IV", 1.45 ] ,
- 5 => [ 100, "V", 1.7 ] ,
- 6 => [ 150, "VI", 2.0 ] ,
- 7 => [ 210, "VII", 2.35 ] ,
- 8 => [ 280, "VIII", 2.75 ] ,
- 9 => [ 350, "IX", 3.15 ] ,
- 10 => [ 430, "X", 3.60 ] ,
- 11 => [ 520, "XI", 4.1 ] ,
- 12 => [ 620, "XII", 4.65 ] ,
- 13 => [ 730, "XIII", 5.25 ] ,
- 14 => [ 850, "XIV", 5.8 ] ,
- 15 => [ 1000, "XV", 6.5 ] ,
- 16 => [ 1250, "XVI", 7.25 ] ,
- 17 => [ 1600, "XVII", 8.05 ] ,
- 18 => [ 2050, "XVIII", 8.9 ] ,
- 19 => [ 2600, "XIX", 9.8 ] ,
- 20 => [ 5000, "*", 15.0 ] ,
- }# << Keep
- # << You can add more Exp_Set[ id ] here, simply copy the code from
- # above and change the id number and values to suit your needs.
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # ☆ Growth Type - Settings
- #--------------------------------------------------------------------------
- # Here is where you can define the exp gained for various conditions
- # you can add to this array as you please.
- # :per_use = exp gained per use of the skill
- # :per_dmg = per (100 * skill level) damage dealt
- # :per_bat = exp gained per battle (while you know the skill)
- # :per_die = exp gained when actor dies ( for the skill )
- # :per_esc = exp gained when actor escapes battle (for the skill)
- # :dmg_deal = formula to eval when actor deals damage using this skill
- # :dmg_take = formula to eval when actor takes damage FROM this skill
- # Exp wlil be given to the actor's skill if they know it
- # Pointless really, but there you go :p
- # When using :dmg_deal | :dmg_take you can use the arguements below
- # in your formulas (the formula is calculated in Game_Battler)
- # user = returns the actor/eney using the skill
- # self = returns the target actor/enemy of the skill
- # item = returns the item used
- # damage = returns the total value of the damage taken/dealt
- #--------------------------------------------------------------------------
- Growth_Type[0]={
- :per_use => 1,
- :per_dmg => 0,
- :per_bat => 1,
- :per_die => 0,
- :per_esc => 0,
- :dmg_deal => "1",
- :dmg_take => "0",
- } # << Keep
- Growth_Type[1]={
- :per_use => 0,
- :per_dmg => 1,
- :per_bat => 0,
- :per_die => 0,
- :per_esc => 0,
- :dmg_deal => "0",
- :dmg_take => "0",
- } # << Keep
- Growth_Type[2]={
- :per_use => 1,
- :per_dmg => 0,
- :per_bat => 0,
- :per_die => 0,
- :per_esc => 0,
- :dmg_deal => "0",
- :dmg_take => "0",
- } # << Keep
- # << You can add more Growth_Type[ id ] here, simply copy the code from
- # above and change the id number and values to suit your needs.
- #####################
- # CUSTOMISATION END #
- end #####################
- #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
- # #
- # http://dekitarpg.wordpress.com/ #
- # #
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
- #===============================================================================#
- # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
- # YES?\.\. #
- # OMG, REALLY? \| #
- # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
- # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
- #===============================================================================#
- module BattleManager
- #===============================================================================
- #--------------------------------------------------------------------------
- # Alias List
- #--------------------------------------------------------------------------
- class << self
- alias :gain_skill_exp :gain_exp
- end
- #--------------------------------------------------------------------------
- # EXP Acquisition and Level Up Display
- #--------------------------------------------------------------------------
- def self.gain_exp
- gain_skill_exp
- skills_gain_exp
- end
- #--------------------------------------------------------------------------
- # EXP Acquisition and Level Up Display (Skills)
- #--------------------------------------------------------------------------
- def self.skills_gain_exp
- $game_party.battle_members.each do |actor|
- actor.skills.each do |skill|
- next if skill == nil
- value = Skill_Levels::Growth_Type[skill.growth_type][:per_bat]
- actor.increase_skill_exp(skill, value)
- end
- end
- wait_for_message
- end
- end
- #===============================================================================
- class RPG::Skill < RPG::UsableItem
- #===============================================================================
- #---------------------------------------------------------------------------
- # Alias List
- #---------------------------------------------------------------------------
- alias :deki_skill_levz :load_stat_control
- #---------------------------------------------------------------------------
- # Pi Variables
- #---------------------------------------------------------------------------
- attr_accessor :exp_set
- attr_accessor :growth_type
- attr_accessor :max_lv
- #---------------------------------------------------------------------------
- # Load Stat Control
- #---------------------------------------------------------------------------
- def load_stat_control
- deki_skill_levz
- @exp_set = Skill_Levels::Default_Exp_Set_ID
- @growth_type = Skill_Levels::Default_GrowthT_ID
- @max_lv = Skill_Levels::Exp_Set[@exp_set].size
- self.note.split(/[\r\n]+/).each do |line|
- case line
- when Skill_Levels::Notes[:max_lev] then @max_lv = $1.to_i
- when Skill_Levels::Notes[:exp_set] then @exp_set = $1.to_i
- when Skill_Levels::Notes[:gro_typ] then @growth_type = $1.to_i
- end
- end
- end
- end
- #===============================================================================
- class Game_Battler < Game_BattlerBase
- #===============================================================================
- #--------------------------------------------------------------------------
- # Alias List
- #--------------------------------------------------------------------------
- alias :_MDV__skillev :make_damage_value
- alias :_APV__skillev :apply_variance
- #--------------------------------------------------------------------------
- # M.D.V
- #--------------------------------------------------------------------------
- def make_damage_value(user, item)
- @skillev_user = user
- @skillev_item = item
- _MDV__skillev(user, item)
- end
- #--------------------------------------------------------------------------
- # Apply Variance Mod ( HEAVY ALIAS )
- #--------------------------------------------------------------------------
- def apply_variance(damage, variance)
- user = @skillev_user
- item = @skillev_item
- orii = _APV__skillev(damage, variance)
- if item.is_a?(RPG::Skill)
- orig = apply_skill_variance(user,item,orii)
- do_dmg_exp_eval(user, item, orig)
- end
- orig
- end
- #--------------------------------------------------------------------------
- # Do Exp Gain Eval Formula
- #--------------------------------------------------------------------------
- def do_dmg_exp_eval(user, item, damage)
- return if item.id == (attack_skill_id || guard_skill_id)
- mod = Skill_Levels::Growth_Type[item.growth_type]
- if user.is_a?(Game_Actor)
- val = eval(mod[:dmg_deal]).to_i rescue 0
- val = 0 if ((val == nil) || (val < 0))
- user.increase_skill_exp(item, val)
- end
- if self.is_a?(Game_Actor)
- val = eval(mod[:dmg_take]).to_i rescue 0
- val = 0 if ((val == nil) || (val < 0))
- self.increase_skill_exp(item, val)
- end
- end
- #--------------------------------------------------------------------------
- # Apply Skill Variance
- #--------------------------------------------------------------------------
- def apply_skill_variance(user,item,orig)
- return orig if user.is_a?(Game_Enemy)
- return orig if item.id == (attack_skill_id || guard_skill_id)
- lvdmgmul = Skill_Levels::Exp_Set[item.exp_set][user.skills_lv(item.id)][2]
- valu = orig * lvdmgmul
- ex = ((valu/100)*user.skills_lv(item.id)*
- Skill_Levels::Growth_Type[item.growth_type][:per_dmg]).to_i
- user.increase_skill_exp(item, ex)
- valu
- end
- end
- #===============================================================================
- class Game_Actor < Game_Battler
- #===============================================================================
- #--------------------------------------------------------------------------
- # Alias List
- #--------------------------------------------------------------------------
- alias :ls_alias_SD13x :learn_skill
- alias :fs_alias_SD13x :forget_skill
- alias :from_suparr_pscc :pay_skill_cost
- alias :init_de_skeel :init_skills
- alias :die_exp_skill :die
- alias :escape_exp_skill :escape
- alias :skill_lv_mp_st :skill_mp_cost
- alias :skill_lv_tp_st :skill_tp_cost
- #--------------------------------------------------------------------------
- # Learn Skill
- #--------------------------------------------------------------------------
- def learn_skill(skill_id)
- old_skills = skills.clone
- ls_alias_SD13x(skill_id)
- if skills != old_skills
- @skills_lv[skill_id] = 1
- @skills_exp[skill_id] = 0
- @skills_list.push(skill_id)
- @skills_list.sort!
- end
- end
- #--------------------------------------------------------------------------
- # Initialize Skills
- #--------------------------------------------------------------------------
- def init_skills
- reset_skills_exp
- init_de_skeel
- end
- #--------------------------------------------------------------------------
- # Reset Skills Lv + Exp
- #--------------------------------------------------------------------------
- def reset_skills_exp
- ds = $data_skills.size
- @skills_lv = [1] * ds
- @skills_exp = [0] * ds
- end
- #--------------------------------------------------------------------------
- # Get Skill Level
- #--------------------------------------------------------------------------
- def skills_lv(id)
- @skills_lv[id]
- end
- #--------------------------------------------------------------------------
- # Get Skill Exp
- #--------------------------------------------------------------------------
- def skills_exp(id)
- @skills_exp[id] == nil ? 0 : @skills_exp[id]
- end
- #--------------------------------------------------------------------------
- # Increase Skill Exp
- #--------------------------------------------------------------------------
- def increase_skill_exp(skill, value = nil, show = true)
- mod = Skill_Levels
- return if skill.id == attack_skill_id unless mod::Default_Attack_Can_Lv
- return if skill.id == guard_skill_id unless mod::Default_Guard__Can_Lv
- value = mod::Growth_Type[skill.growth_type][:per_use] if value == nil
- return if value == nil || value <= 0
- return if @skills_lv[skill.id] >= skill.max_lv
- set_id = skill.exp_set
- value.times do
- break if @skills_lv[skill.id] >= skill.max_lv
- @skills_exp[skill.id] += 1
- need = mod::Exp_Set[set_id][(@skills_lv[skill.id]+1)][0]
- if @skills_exp[skill.id] >= need
- increase_skill_proficiency(skill.id, show)
- end
- end
- end
- #--------------------------------------------------------------------------
- # Increase Skill Level
- #--------------------------------------------------------------------------
- def increase_skill_proficiency(skill_id, show = true)
- return if @skills_lv[skill_id] >= $data_skills[skill_id].max_lv
- @skills_lv[skill_id] += 1
- if Skill_Levels::Exp_Reset_On_Lv_Up
- @skills_exp[skill_id] = 0
- end
- ltex = Skill_Levels::Exp_Set[$data_skills[skill_id].exp_set][@skills_lv[skill_id]][1]
- text = "#{self.name}'s #{$data_skills[skill_id].name} is now #{ltex}"
- $game_message.add(text) if show
- end
- #--------------------------------------------------------------------------
- # Forget Skill
- #--------------------------------------------------------------------------
- def forget_skill(skill_id)
- fs_alias_SD13x(skill_id)
- @skills_list.delete(skill_id)
- if Skill_Levels::Reset_On_Forget
- @skills_lv[skill_id] = 1
- @skills_exp[skill_id] = 0
- end
- end
- #--------------------------------------------------------------------------
- # Die
- #--------------------------------------------------------------------------
- def die
- die_exp_skill
- do_obscure_skill_exp(:per_die)
- end
- #--------------------------------------------------------------------------
- # Escape
- #--------------------------------------------------------------------------
- def escape
- escape_exp_skill
- do_obscure_skill_exp(:per_esc)
- end
- #--------------------------------------------------------------------------
- # Do Obscure Skill Exp Gain
- #--------------------------------------------------------------------------
- def do_obscure_skill_exp(type = :nil)
- return if type == :nil
- skills.each do |skill|
- next if skill == nil
- value = Skill_Levels::Growth_Type[skill.growth_type][type]
- next if value <= 0
- actor.increase_skill_exp(skill, value)
- end
- end
- #--------------------------------------------------------------------------
- # Pay Cost of Using Skill
- #--------------------------------------------------------------------------
- def pay_skill_cost(skill)
- from_suparr_pscc(skill)
- increase_skill_exp(skill)
- end
- #--------------------------------------------------------------------------
- # Calculate Skill's MP Cost
- #--------------------------------------------------------------------------
- def skill_mp_cost(skill)
- old = skill_lv_mp_st(skill)
- if Skill_Levels::Dmg_Multi_Skill_Cost[:mp]
- old *= Skill_Levels::Exp_Set[skill.exp_set][@skills_lv[skill.id]][2]
- end
- old.to_i
- end
- #--------------------------------------------------------------------------
- # Calculate Skill's TP Cost
- #--------------------------------------------------------------------------
- def skill_tp_cost(skill)
- old = skill_lv_tp_st(skill)
- if Skill_Levels::Dmg_Multi_Skill_Cost[:tp]
- old *= Skill_Levels::Exp_Set[skill.exp_set][@skills_lv[skill.id]][2]
- end
- old.to_i
- end
- end # << Game_Actor
- #===============================================================================
- class Window_SkillList < Window_Selectable
- #===============================================================================
- #--------------------------------------------------------------------------
- # Draw Item Name
- #--------------------------------------------------------------------------
- def draw_item_name(item, x, y, enabled = true, width = (Graphics.width/2))
- return unless item && @actor
- w = (width - (standard_padding*2) - 4)
- draw_icon(item.icon_index, x, y, enabled)
- change_color(normal_color, enabled)
- skill_lv = @actor.skills_lv(item.id)
- if $D13x[:Skill_Scene] && !SceneManager.scene_is?(Scene_Battle)
- refresh_font
- text = Skill_Levels::Exp_Set[item.exp_set][skill_lv][1]
- draw_text(x + 24, y, w-24, line_height, item.name)
- draw_text(x, y, w, line_height, text, 2)
- else
- text = "#{item.name} #{Skill_Levels::Exp_Set[item.exp_set][skill_lv][1]}"
- draw_text(x + 24, y, w-24, line_height, text)
- end
- end
- end
- #===============================================================================
- class Game_Interpreter
- #===============================================================================
- #--------------------------------------------------------------------------
- # Increase Skill Level
- #--------------------------------------------------------------------------
- def level_skill(actor_id, skill_id, show = true)
- actor = $game_actors[actor_id]
- return if actor == nil
- return if (skill_id == nil) || (skill_id <= 0)
- actor.increase_skill_proficiency(skill_id, show)
- end
- #--------------------------------------------------------------------------
- # Gain Skill Exp
- #--------------------------------------------------------------------------
- def gain_skill_exp(actor_id, skill_id, value = 0, show = true)
- actor = $game_actors[actor_id]
- skill = $data_skills[skill_id]
- return if actor == nil
- return if skill == nil
- return if value <= 0
- actor.increase_skill_exp(skill,value,show)
- end
- end
- #==============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #==============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement