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 - Enemy Levels
- # -- Author : Dekita
- # -- Version : 1.1
- # -- Level : Easy
- # -- Requires : N/A
- # -- Engine : RPG Maker VX Ace.
- #
- #===============================================================================
- # ☆ Import
- #-------------------------------------------------------------------------------
- $D13x={}if$D13x==nil
- $D13x[:Enemy_Levels]=true
- #===============================================================================
- # ☆ Updates
- #-------------------------------------------------------------------------------
- # D /M /Y
- # 19/11/2o13 - Small Bugfix,
- # 12/11/2o13 - Finished,
- # ??/??/2o13 - Started
- #
- #===============================================================================
- # ☆ Introduction
- #-------------------------------------------------------------------------------
- # This script simply allows for enemies to be given levels, based on the
- # current map.
- #
- # Levels are easily adustable via notetags.
- #
- # Enemies are also given a statistic bonus for each level. This is obviously,
- # Fully customizable.
- #
- #===============================================================================
- # ★☆★☆★☆★☆★☆★☆★☆★ 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.
- #
- #===============================================================================
- # ☆ Notetags
- #-------------------------------------------------------------------------------
- # ( enemies )
- # <level mod id: X>
- # X = the idof the Level_Mod for this enemy.
- #
- # ( maps )
- # <lv: X, Y>
- # X = Minimum Level for enemies on this map.
- # Y = Maximum level for enemies on this map.
- #
- # <ene lv: X, Y, Z>
- # X = Enemy Database ID.
- # Y = Min Level For X enemy on this map.
- # Z = Max Level For X enemy on this map.
- #
- #===============================================================================
- # ☆ HELP
- #-------------------------------------------------------------------------------
- #
- #===============================================================================
- # ☆ HELP
- #-------------------------------------------------------------------------------
- # PARAMS : # XPARAMS : # SPARAMS : #
- # stat = id # stat = id # stat = id #
- # mhp = 0 # hit = 0 # tgr = 0 #
- # mmp = 1 # eva = 1 # grd = 1 #
- # atk = 2 # cri = 2 # rec = 2 #
- # def = 3 # cev = 3 # pha = 3 #
- # mat = 4 # mev = 4 # mcr = 4 #
- # mdf = 5 # mrf = 5 # tcr = 5 #
- # agi = 6 # cnt = 6 # pdr = 6 #
- # luk = 7 # hrg = 7 # mdr = 7 #
- # # mrg = 8 # fdr = 8 #
- # # trg = 9 # exr = 9 #
- #-------------------------------------------------------------------------------
- # Remember :
- # All Params work with integer values, eg. 1, 5, 123, 653, 198123
- # All x/s-Params work with float values, eg. 1.0, 0.5, 0.1, 0.05, 0.01
- # 1.0 = 100%, 0.01 = 1%,
- #
- #===============================================================================
- module Enemy_Control
- #===============================================================================
- Level_Mod=[]# << Keep
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # ☆ General Settings :
- #-----------------------------------------------------------------------------
- # Minimum Level an Enemy can ever be.
- Min_Level = 1
- # Maximum Level an Enemy can ever be.
- Max_Level = 100
- # Use Pokemon Style Exp Calculation.
- Use_Exp_Gain_Formula = true
- # Use Pokemon Style Gold Calculation.
- Use_Gold_Gain_Formula = true
- # As enemy levels are based on maps and during battle test there is no map id,
- # you have to set the min and max level for enemies in test battles here.
- BattleTest_Level = [10, 20] # [min, max]
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # ☆ Notetag Settings :
- #-----------------------------------------------------------------------------
- Notetag = /<lv:(.*),(.*)>/i
- Notetag_B = /<ene lv:(.*),(.*),(.*)>/i
- Notetag_C = /<level mod id:(.*)>/i
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # ☆ Level Stat Modifcations :
- #-----------------------------------------------------------------------------
- # This is the default Level_Mod id for all enemies.
- # Can be changed via notetags.
- LM_Default = 1
- # Syntax is:
- # Level_Mod[id] = [
- # [:param , id, change],
- # [:x_param , id, change],
- # [:s_param , id, change],
- # [:atk_ele , id, change],
- # [:def_ele , id, change],
- # [:spds_stat , id, change]
- # [:atk_lvl , change],
- # [:def_lvl , change],
- # [:max_tp , change],
- # ]
- # NOTE : the value will be multiplied by the enemies level.
- Level_Mod[0]=[
- # -- Keep this stat set empty for monsters that should not receive any
- # -- stat increase based on levels
- ]# << End Stat_Set[0]
- Level_Mod[1]=[
- [:param , 0, 2.8],
- [:param , 1, 2.8],
- # [:param , 2, 0.6],
- # [:param , 3, 0.4],
- # [:param , 4, 0.4],
- # [:param , 5, 0.2],
- # [:param , 6, 1],
- # [:param , 7, 1],
- # [:x_param , 0, 0.01],
- # [:x_param , 1, 0.01],
- # [:x_param , 2, 0.01],
- # [:atk_ele , 4, 0.01],
- # [:def_ele , 4, -0.01],
- [:spds_stat, 0, 1],
- [:spds_stat, 1, 1],
- [:spds_stat, 2, 1],
- [:spds_stat, 3, 1],
- [:atk_lvl , 0.5],
- [:def_lvl , 0.5],
- [:max_tp , 1],
- # Insert other regular/x/s-param codes here (codes found above)
- # Rememer to put a comma , after each line.
- ]# << End Stat_Set[1]
- #####################
- # 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 DataManager
- #===============================================================================
- #---------------------------------------------------------------------------
- # Alias List
- #---------------------------------------------------------------------------
- class << self
- alias :lbd_enemy_lv_stat :load_database
- end
- #---------------------------------------------------------------------------
- # Load Database (alias)
- #---------------------------------------------------------------------------
- def self.load_database
- lbd_enemy_lv_stat
- loa_enemy_lv_stat
- end
- #---------------------------------------------------------------------------
- # Load Unique Shit
- #---------------------------------------------------------------------------
- def self.loa_enemy_lv_stat
- for o in $data_enemies
- next if o == nil
- o.load__lv_up_stat
- end
- end
- end # DataManager
- #===============================================================================
- class RPG::Enemy < RPG::BaseItem
- #===============================================================================
- #---------------------------------------------------------------------------
- # Pi Variables
- #---------------------------------------------------------------------------
- attr_accessor :stat_set_id_EL
- #---------------------------------------------------------------------------
- # Load Level Stat Notes
- #---------------------------------------------------------------------------
- def load__lv_up_stat
- @stat_set_id_EL = Enemy_Control::LM_Default
- self.note.split(/[\r\n]+/).each do |line|
- case line
- when Enemy_Control::Notetag_C
- @stat_set_id_EL = $1.to_i
- end
- end
- end
- end
- #===============================================================================
- class RPG::Map
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Level Range
- #-----------------------------------------------------------------------------
- def level_range
- if self.note =~ Enemy_Control::Notetag
- @level_range = [$1.to_i, $2.to_i]
- else
- @level_range = [Enemy_Control::Min_Level, Enemy_Control::Max_Level]
- end
- end
- #-----------------------------------------------------------------------------
- # Enemy Level Range
- #-----------------------------------------------------------------------------
- def enemy_level_range
- @enemy_level_range = []
- self.note.split(/[\r\n]+/).each do |line|
- case line
- when Enemy_Control::Notetag_B
- @enemy_level_range << [$1.to_i, $2.to_i, $3.to_i]
- end
- end
- return @enemy_level_range
- end
- end
- #===============================================================================
- class Game_Map
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Level Range
- #-----------------------------------------------------------------------------
- def level_range
- return @map.level_range
- end
- #-----------------------------------------------------------------------------
- # Enemy Level Range
- #-----------------------------------------------------------------------------
- def enemy_level_range
- return @map.enemy_level_range
- end
- end
- #===============================================================================#
- class Game_Enemy < Game_Battler
- #===============================================================================#
- #-----------------------------------------------------------------------------
- # Pi Variables
- #-----------------------------------------------------------------------------
- attr_accessor :level
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- alias :init_enemy_levels :initialize
- alias :nme_exp_natures :exp
- alias :pokgold :gold
- #-----------------------------------------------------------------------------
- # Initialize
- #-----------------------------------------------------------------------------
- def initialize(index, enemy_id)
- init_enemy_levels(index, enemy_id)
- setup_enemy_level(enemy_id)
- doda_stat_inc_for_level
- @hp = mhp
- @mp = mmp
- # p "Enemy Level is #{@level} ;; Hp = #{@hp}/#{mhp}"
- # p "Atk = #{self.atk}"
- # p "Def = #{self.def}"
- # p "Mat = #{self.mat}"
- # p "Mdf = #{self.mdf}"
- end
- #-----------------------------------------------------------------------------
- # Setup Enemy Levels
- #-----------------------------------------------------------------------------
- def setup_enemy_level(enemy_id)
- level = 1
- if $BTEST
- range = Enemy_Control::BattleTest_Level
- level = rand_between(range[0],range[1])
- else
- range = $game_map.level_range
- level = rand_between(range[0],range[1])
- $game_map.enemy_level_range.size.times do |i|
- checker = $game_map.enemy_level_range[i]
- next unless checker[0] == enemy_id
- level = rand_between(checker[1],checker[2])
- end
- end
- @level = [[level, Enemy_Control::Max_Level].min, Enemy_Control::Min_Level].max
- end
- #-----------------------------------------------------------------------------
- # Exp
- #-----------------------------------------------------------------------------
- def exp
- if Enemy_Control::Use_Exp_Gain_Formula
- _A = ((@level * 2) + 10)
- _B = (enemy.exp * @level / 5)
- _C = (@level + $game_party.battle_members[0].level + 10)
- val = ((_A)*(_A*_A).floor).floor*_B/((_C)*(_C*_C)).floor+1
- return val
- else
- return nme_exp_natures
- end
- end
- #-----------------------------------------------------------------------------
- # Gold
- #-----------------------------------------------------------------------------
- def gold
- if Enemy_Control::Use_Gold_Gain_Formula
- _A = ((@level * 2) + 10)
- _B = (enemy.gold * @level / 5)
- _C = (@level + $game_party.battle_members[0].level + 10)
- val = ((_A)*(_A*_A).floor).floor*_B/((_C)*(_C*_C)).floor+1
- return val
- else
- pokgold
- end
- end
- #---------------------------------------------------------------------------
- # Do Stat Increase
- #---------------------------------------------------------------------------
- def doda_stat_inc_for_level
- stat_set_type.each do |stat|
- case stat[0]
- when :param
- add_param(stat[1],(stat[2]*@level).to_i,false) if $D13x[:Stats_Control]
- when :x_param
- add_xparam(stat[1],(stat[2]*@level).to_f,false) if $D13x[:Stats_Control]
- when :s_param
- add_sparam(stat[1],(stat[2]*@level).to_f,false) if $D13x[:Stats_Control]
- when :atk_ele
- add_atk_ele(stat[1],(stat[2]*@level).to_f,false) if $D13x[:Elems_Control]
- when :def_ele
- add_def_ele(stat[1],(stat[2]*@level).to_f,false) if $D13x[:Elems_Control]
- when :atk_lvl
- add_atl((stat[1]*@level).to_i,false) if $D13x[:Atk_Def_Lvs]
- when :def_lvl
- add_dfl((stat[1]*@level).to_i,false) if $D13x[:Atk_Def_Lvs]
- when :max_tp
- add_max_tp((stat[1]*@level).to_i,false) if $D13x[:TP_Control]
- when :spds_stat
- add_spds_stats(stat[1],(stat[2]*@level).to_i,false) if $D13x[:ISPDS]
- end
- end
- refresh
- end
- #---------------------------------------------------------------------------
- # Get Stat Increase Type
- #---------------------------------------------------------------------------
- def stat_set_type
- set = Enemy_Control::Level_Mod[enemy.stat_set_id_EL]
- set
- end
- end
- #==============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #==============================================================================#
- end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement