Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if true # << Make true to use this script, false to disable.
- #===============================================================================
- #
- # ☆ $D13x - Equipment - Levels / Exp
- # -- Author : Dekita
- # -- Version : 1.1
- # -- Level : Easy / Normal
- # -- Requires : $D13x - Unique Equipment
- # -- Engine : RPG Maker VX Ace.
- #
- #===============================================================================
- # ☆ Import
- #-------------------------------------------------------------------------------
- $D13x={}if$D13x==nil
- $D13x[:Equip_Levels] = true
- #===============================================================================
- # ☆ Updates
- #-------------------------------------------------------------------------------
- # D /M /Y
- # 18/o3/2o13 - Updated Final version before release,
- # 23/o2/2o13 - Started, Finished,
- #
- #===============================================================================
- # ☆ Introduction
- #-------------------------------------------------------------------------------
- # This Script allows weapons and armors to gain exp along with each actor,
- # The exp gained and the requirements for each level are defined in
- # the customisation module.
- #
- # You can also enable enemies stats to increase along with the average level
- # of all battle members equipment.(to make balancing your database easier ??)
- #
- # Your equipment "Level" can be named anything, as well as what is shown for
- # each level, ie. Lv 1 weapon could say "Grade I" or "Newbie" or whatever..
- #
- # Equipment can also have its own exp rate similar to actors(exr) defined by
- # notetags. Default is 1.0
- #
- #===============================================================================
- # ★☆★☆★☆★☆★☆★☆★☆★ 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 Equipment Individualize script.
- #
- #===============================================================================
- # ☆ Notetags ( default )
- # For use with Weapon / Armor noteboxes !
- #-------------------------------------------------------------------------------
- # <max level: I>
- # <exp rate: F>
- # I = An Interger value eg 1, 2, 3, 4
- # F = A Float Value eg. 1.25, 0.67, 1.75
- # To be given to equipment
- #
- #===============================================================================
- # ☆ Script Calls
- #-------------------------------------------------------------------------------
- # equip_gain_exp(actor_id, eqp_slot_id, exp)
- # equip_gain_lv(actor_id, eqp_slot_id)
- #
- # actor_has_weapon_level?(actor_id, equip_id, lv)
- # actor_has_wpn_teir_and_lv?(actor_id, equip_id, teir, lv)
- # actor_has_armor_level?(actor_id, equip_id, lv)
- # actor_has_armr_teir_and_lv?(actor_id, equip_id, teir, lv)
- #
- # pty_has_weapon_level?(equip_id, lv)
- # pty_has_wpn_teir_and_lv?(equip_id, teir, lv)
- # pty_has_armor_level?(equip_id, lv)
- # pty_has_armr_teir_and_lv?(equip_id, teir, lv)
- #
- # actor_id = the actor id from the database
- # eqp_slot_id = the actors equipment slot id (0 = weapons)
- # equip_id = weapon / armor id from the database
- # teir = equipments teir
- # lv = equipments level
- #
- #===============================================================================
- module Equip_Exp
- #===============================================================================
- #---------------------------------------------------------------------------
- # General Settings
- #--------------------------------------------------------------------------
- Exp_Reset_On_Level = false#true
- # Mod enemies params using the bonus param multiplier based on the average
- # equipment level (from all battle members), true = yes, false = no
- Enemy_Param_Mod = true
- # if this is true, equipment will gain exp (Battle Points) from battle.
- Gain_Exp_From_Battle = true # false
- #---------------------------------------------------------------------------
- # Level Settings
- #---------------------------------------------------------------------------
- Level_Names={
- # Lv => Vocab
- 0 => "N/A", # DONT DELETE
- 1 => "+1",
- 2 => "+2",
- 3 => "+3",
- 4 => "+4",
- 5 => "+5",
- 6 => "+6",
- 7 => "+7",
- 8 => "+8",
- 9 => "+9",
- }#DONT DELETE
- Max_Level_Note = /<max level:(.*)>/i
- #---------------------------------------------------------------------------
- # Exp Settings
- #---------------------------------------------------------------------------
- Exp_Required={
- # Lv => Exp Required
- 0 => 0, # DONT DELETE
- 1 => 100,
- 2 => 200,
- 3 => 300,
- 4 => 400,
- 5 => 500,
- 6 => 600,
- 7 => 700,
- 8 => 800,
- 9 => 900,
- }#DONT DELETE
- Exp_Vocab = "Battle Points"
- Exp_Rate_Note = /<exp rate:(.*)>/i
- Exp_Rate_Vocab = "BP Rate"
- def self.exp_gain_vocab(a, e)
- text = "#{a.name}'s #{e.name} Gained #{default_exp(a,e)} #{Exp_Vocab}!"
- return text
- end
- def self.default_exp(actor, equip)
- base = ($game_troop.exp_total/10)
- membs = $game_party.battle_members.size
- value = (base / membs) * equip.exp_rate #* actor.exr
- return value.to_i
- end
- #---------------------------------------------------------------------------
- # Bonus Param Settings
- #---------------------------------------------------------------------------
- # Note: Default equip params are multiplied by the value set for their level
- # the current params are then replaced by the new value(default * multiplier)
- # ALL unique features from equipment remain the same
- #---------------------------------------------------------------------------
- Bonus_Params_Mult={
- # Lv => Params Multiplier
- 0 => 1.0, # DONT DELETE
- 1 => 1.2,
- 2 => 1.4,
- 3 => 1.7,
- 4 => 2.1,
- 5 => 2.6,
- 6 => 3.2,
- 7 => 3.9,
- 8 => 4.7,
- 9 => 5.5,
- }#DONT DELETE
- #####################
- # 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.\..\.. #
- #===============================================================================#
- class RPG::EquipItem < RPG::BaseItem
- #===============================================================================
- #---------------------------------------------------------------------------
- # Included modules
- #---------------------------------------------------------------------------
- include Equip_Exp
- #---------------------------------------------------------------------------
- # Alias List
- #---------------------------------------------------------------------------
- alias :deki_equip_Exp :load_unique_equip
- #---------------------------------------------------------------------------
- # Pi Variables
- #---------------------------------------------------------------------------
- attr_accessor :level
- attr_accessor :exp
- attr_accessor :exp_rate
- attr_accessor :grade
- #---------------------------------------------------------------------------
- # load unique shit
- #---------------------------------------------------------------------------
- def load_unique_equip
- deki_equip_Exp
- @level = 0
- @exp = 0
- @exp_rate = 1.0
- @max_level = (Exp_Required.size - 1)
- @grade = 1
- self.note.split(/[\r\n]+/).each do |line|
- case line
- when Exp_Rate_Note
- @exp_rate = $1.to_f
- when Max_Level_Note
- @max_level = $1.to_i
- when /<GRADE:(.*)>/i
- @grade = $1.to_i
- end
- end
- end
- #---------------------------------------------------------------------------
- # Gain Exp
- #---------------------------------------------------------------------------
- def gain_exp(actor, value = 1)
- value.times do
- @exp += 1
- level_up(actor) if did_level?
- end
- end
- #---------------------------------------------------------------------------
- # Max Level Reached ?
- #---------------------------------------------------------------------------
- def at_max_level?
- return true if @level >= @max_level
- return false
- end
- #---------------------------------------------------------------------------
- # Did Equip Level ?
- #---------------------------------------------------------------------------
- def did_level?
- return false if at_max_level?
- return true if @exp >= Exp_Required[@level+1]
- return false
- end
- #---------------------------------------------------------------------------
- # Do Level Increase
- #---------------------------------------------------------------------------
- def level_up(actor)
- @level += 1
- @exp = 0 if Exp_Reset_On_Level
- display_lv_up(actor)
- mod_de_parzz(actor)
- end
- #---------------------------------------------------------------------------
- # Change Params
- #---------------------------------------------------------------------------
- def mod_de_parzz(actor)
- index = 0
- d = $data_weapons[@database_id] if self.is_a?(RPG::Weapon)
- d = $data_armors [@database_id] if self.is_a?(RPG::Armor)
- d.params.each do |par|
- stored = self.params[index] - (par * Bonus_Params_Mult[@level-1]).to_i
- new_val = (par * Bonus_Params_Mult[@level] + stored).to_i
- params[index] = new_val
- increase = (params[index] - stored).to_i
- display_lv_up_stat_inc(actor, index, increase, d.params[index])
- index += 1
- end
- if $D13x[:Stats_Control]
- index = 0
- d.pars.each do |pars|
- stored = self.pars[index] - (pars * Bonus_Params_Mult[@level-1]).to_i
- new_val = (pars * Bonus_Params_Mult[@level] + stored).to_i
- @pars[index] = new_val
- increase = (@pars[index] - stored).to_i
- display_lv_up_stat_inc(actor, index, increase, d.pars[index])
- index += 1
- end
- index = 0
- d.xpars.each do |xpars|
- stored = self.xpars[index] - (xpars * Bonus_Params_Mult[@level-1]).to_f
- new_val = (xpars * Bonus_Params_Mult[@level] + stored).to_f
- @xpars[index] = new_val
- increase = (@xpars[index] - stored).to_f
- display_lv_up_stat_inc(actor, index, increase, d.xpars[index], :x_param)
- p @xpars[index]
- index += 1
- end
- index = 0
- d.spars.each do |spars|
- stored = self.spars[index] - (spars * Bonus_Params_Mult[@level-1]).to_f
- new_val = (spars * Bonus_Params_Mult[@level] + stored).to_f
- @spars[index] = new_val
- increase = (@spars[index] - stored).to_f
- display_lv_up_stat_inc(actor, index, increase, d.spars[index], :s_param)
- p @spars[index]
- index += 1
- end
- end#if $D13x[:Stats_Control]
- end
- #---------------------------------------------------------------------------
- # Display Level Up
- #---------------------------------------------------------------------------
- def display_lv_up(actor)
- $game_message.new_page
- msg = "#{actor.name}'s #{@name} is now #{Level_Names[@level]}"
- $game_message.add(msg)
- end
- #---------------------------------------------------------------------------
- # Display Items Stats (after evel up)
- #---------------------------------------------------------------------------
- def display_lv_up_stat_inc(act, pid, val, par, type = :param)
- return if val == 0.0
- return if par == 0.0
- case type
- when :param
- $game_message.add("#{@name}'s Base #{Vocab::param(pid)} is now #{val}")
- when :x_param
- $game_message.add("#{@name}'s Base #{Vocab::x_param(pid)} is now #{val}")
- when :s_param
- $game_message.add("#{@name}'s Base #{Vocab::s_param(pid)} is now #{val}")
- end
- end
- end # RPG::EquipItem
- #==============================================================================
- module BattleManager
- #==============================================================================
- #---------------------------------------------------------------------------
- # Alias List
- #---------------------------------------------------------------------------
- class << self
- alias :disp_unique_exp :display_exp
- alias :gain_unique_exp :gain_exp
- end
- #--------------------------------------------------------------------------
- # Display Party EXP Earned
- #--------------------------------------------------------------------------
- def self.display_exp
- disp_unique_exp
- display_equip_exp
- end
- #--------------------------------------------------------------------------
- # Display Equip EXP Earned
- #--------------------------------------------------------------------------
- def self.display_equip_exp
- return unless Equip_Exp::Gain_Exp_From_Battle
- $game_party.battle_members.each do |actor|
- actor.equips.each do |equip|
- next if equip == nil
- next if equip.at_max_level?
- if Equip_Exp.default_exp(actor,equip) > 0
- tex = Equip_Exp.exp_gain_vocab(actor,equip)
- $game_message.add('\.' + tex)
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # Party EXP Acquisition and Level Up Display
- #--------------------------------------------------------------------------
- def self.gain_exp
- gain_unique_exp
- gain_equip_exp
- end
- #--------------------------------------------------------------------------
- # Equip EXP Acquisition and Level Up Display
- #--------------------------------------------------------------------------
- def self.gain_equip_exp
- $game_party.battle_members.each do |actor|
- actor.equips.each do |equip|
- next if equip == nil
- next if equip.at_max_level?
- if Equip_Exp.default_exp(actor,equip) > 0
- equip.gain_exp(actor,Equip_Exp.default_exp(actor,equip))
- end
- end
- end
- wait_for_message
- end
- end
- #==============================================================================
- class Game_Enemy < Game_Battler
- #==============================================================================
- if Equip_Exp::Enemy_Param_Mod
- #--------------------------------------------------------------------------
- # Alias List
- #--------------------------------------------------------------------------
- alias :param_base_EQUIP_EXP :param_base
- #--------------------------------------------------------------------------
- # Get Base Value of Parameter
- #--------------------------------------------------------------------------
- def param_base(param_id)
- param_base_EQUIP_EXP(param_id) * Equip_Exp::Bonus_Params_Mult[average_party_equip_level]
- end
- #--------------------------------------------------------------------------
- # Get Average Party Equipment Level
- #--------------------------------------------------------------------------
- def average_party_equip_level
- c = 0
- d = 0
- $game_party.battle_members.each do |memb|
- memb.equips.each do |eqp|
- next if eqp == nil
- c += 1
- d += eqp.level
- end
- end
- c = 1 if d == 0
- return (d / c).to_i
- end
- end # if Enemy_Param_Mod
- end
- #==============================================================================
- class Game_Interpreter
- #==============================================================================
- #---------------------------------------------------------------------------
- # Adds Exp to an actors equipment
- #---------------------------------------------------------------------------
- def equip_gain_exp(aid, eqp_id, exp)
- return if aid == (nil || 0)
- actor = $game_actors[aid]
- return if actor.equip[eqp_id] == nil
- actor.equips[eqp_id].gain_exp(actor,exp)
- end
- #---------------------------------------------------------------------------
- # Adds Level to an actors equipment
- #---------------------------------------------------------------------------
- def equip_gain_lv(aid, eqp_id)
- return if aid == (nil || 0)
- actor = $game_actors[aid]
- return if actor.equip[eqp_id] == nil
- actor.equips[eqp_id].level_up(actor)
- end
- #---------------------------------------------------------------------------
- # Checks if actor has specific level weapon equipped
- #---------------------------------------------------------------------------
- def actor_has_weapon_level?(aid, wid, level)
- bool = false
- $game_actors[aid].weapons.each do |wep|
- bool = true if $data_weapons[wep.id].database_id == wid &&
- $data_weapons[wep.id].level == level
- end
- return bool
- end
- #---------------------------------------------------------------------------
- # Checks if actor has specific level weapon equipped
- #---------------------------------------------------------------------------
- def actor_has_wpn_teir_and_lv?(aid, wid, teir, lv)
- bool = false
- $game_actors[aid].weapons.each do |wep|
- bool = true if $data_weapons[wep.id].database_id == wid &&
- $data_weapons[wep.id].level == level &&
- $data_weapons[wep.id].teir == teir
- end
- return bool
- end
- #---------------------------------------------------------------------------
- # Checks if party has specific level weapon
- #---------------------------------------------------------------------------
- def pty_has_weapon_level?(wid, level)
- bool = false
- $game_party.weapons.each do |wep|
- bool = true if $data_weapons[wep.id].database_id == wid &&
- $data_weapons[wep.id].level == level
- end
- return bool
- end
- #---------------------------------------------------------------------------
- # Checks if party has specific level weapon
- #---------------------------------------------------------------------------
- def pty_has_wpn_teir_and_lv?(wid, teir, lv)
- bool = false
- $game_party.weapons.each do |wep|
- bool = true if $data_weapons[wep.id].database_id == wid &&
- $data_weapons[wep.id].level == level &&
- $data_weapons[wep.id].teir == teir
- end
- return bool
- end
- #---------------------------------------------------------------------------
- # Checks if actor has specific level armor equipped
- #---------------------------------------------------------------------------
- def actor_has_armor_level?(aid, wid, level)
- bool = false
- $game_actors[aid].armors.each do |wep|
- bool = true if $data_armors[wep.id].database_id == wid &&
- $data_armors[wep.id].level == level
- end
- return bool
- end
- #---------------------------------------------------------------------------
- # Checks if actor has specific level armor equipped
- #---------------------------------------------------------------------------
- def actor_has_armr_teir_and_lv?(aid, wid, teir, lv)
- bool = false
- $game_actors[aid].armors.each do |wep|
- bool = true if $data_armors[wep.id].database_id == wid &&
- $data_armors[wep.id].level == level &&
- $data_armors[wep.id].teir == teir
- end
- return bool
- end
- #---------------------------------------------------------------------------
- # Checks if party has specific level armor
- #---------------------------------------------------------------------------
- def pty_has_armor_level?(wid, level)
- bool = false
- $game_party.armors.each do |wep|
- bool = true if $data_armors[wep.id].database_id == wid &&
- $data_armors[wep.id].level == level
- end
- return bool
- end
- #---------------------------------------------------------------------------
- # Checks if party has specific level armor
- #---------------------------------------------------------------------------
- def pty_has_armr_teir_and_lv?(wid, teir, lv)
- bool = false
- $game_party.armors.each do |wep|
- bool = true if $data_armors[wep.id].database_id == wid &&
- $data_armors[wep.id].level == level &&
- $data_armors[wep.id].teir == teir
- end
- return bool
- end
- end
- #==============================================================================#
- # - SCRIPT END - #
- #==============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #==============================================================================#
- end # if false / true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement