Battle : Auto Level Enemies (v3.0)

Battle : Auto Level Enemies
Version: 3.0
By: Kain Nobel

Introduction

This is a script which globally/individually inflates each enemies' base stats by a bonus multipled by the current party's average level. Whats different from the older version, I chose to re-release this because it is coded cleaner and it is generally easier to assign inflation percents individually to enemies now rather than them all have the same exact kind of *boost*.

Features

[list]
[*]Enemy stats are modified based off game party's average level.
[*]Bonus percent can be set individually for any/all enemies' stats
[*]Stat influence is adjusted for capped stats so it doesn't accidentally go overboard!
[/list]

Script

Battle : Auto Level Enemies (XP Version) Spoiler
  1. #===============================================================================
  2. # ** Battle : Auto-Level Enemies
  3. #-------------------------------------------------------------------------------
  4. # * Description :
  5. #
  6. #    This script influences individual/all enemies' stats to be modified by a
  7. #    bonus percent which is based off the active game party's average level.
  8. #-------------------------------------------------------------------------------
  9. # * Syntax :
  10. #
  11. #    To set individual enemy's to have a special bonus percent, you'll do
  12. #    something like this...
  13. #
  14. #       Bonus_<stat> = {enemy_id => bonus, ...}
  15. #
  16. #    ...or...
  17. #
  18. #       Bonus_<stat>[enemy_id] = bonus
  19. #
  20. #    For enemys which aren't individually defined, you must always have a
  21. #    'default' setting because the script looks for it reguardless. To make
  22. #    sure you have a default setting, all of your constants must have a...
  23. #
  24. #       Bonus_<stat>.default = (Numeric) # 0 by default
  25. #-------------------------------------------------------------------------------
  26. # * Formula :
  27. #
  28. #    The default formula used in this script is....
  29. #
  30. #       level = $game_party.average('level')
  31. #       level /= 10.0
  32. #       bonus = eval("Bonus_#{stat}[#{id}]")
  33. #       bonus = bonus.is_a?(Numeric) ? (bonus * level) : 0
  34. #       return Integer(bonus)
  35. #
  36. #    ...If you have a better formula than feel free to change it, but this
  37. #    basically takes the set bonus multiplied by the $game_party's average
  38. #    level (as a percent), then adds it to the enemy's base stat.
  39. #===============================================================================
  40.  
  41. #-------------------------------------------------------------------------------
  42. # * SDK Log
  43. #-------------------------------------------------------------------------------
  44. SDK.log('Battle.AutoLevelEnemies', 'Kain Nobel  ©', 3.0, '04.08.2009')
  45. #-------------------------------------------------------------------------------
  46. # * SDK Enabled Test : BEGIN
  47. #-------------------------------------------------------------------------------
  48. if SDK.enabled?('Battle.AutoLevelEnemies')
  49.  
  50. #===============================================================================
  51. # ** Game_Enemy::AutoLevel
  52. #===============================================================================
  53.  
  54. module Game_Enemy::AutoLevel
  55. ################################################################################
  56. # ~**                        CUSTOMIZABLE CONSTANTS - BEGIN                                    **~ #
  57. ################################################################################
  58.   #-----------------------------------------------------------------------------
  59.   # * Bonus : MaxHP
  60.   #-----------------------------------------------------------------------------
  61.   Bonus_MaxHP = {}
  62.   Bonus_MaxHP.default = 0
  63.   #-----------------------------------------------------------------------------
  64.   # * Bonus : MaxSP
  65.   #-----------------------------------------------------------------------------
  66.   Bonus_MaxSP = {}
  67.   Bonus_MaxSP.default = 0
  68.   #-----------------------------------------------------------------------------
  69.   # * Bonus : Str
  70.   #-----------------------------------------------------------------------------
  71.   Bonus_Str    = {}
  72.   Bonus_Str.default = 0
  73.   #-----------------------------------------------------------------------------
  74.   # * Bonus : Dex
  75.   #-----------------------------------------------------------------------------
  76.   Bonus_Dex    = {}
  77.   Bonus_Dex.default = 0
  78.   #-----------------------------------------------------------------------------
  79.   # * Bonus : Agi
  80.   #-----------------------------------------------------------------------------
  81.   Bonus_Agi    = {}
  82.   Bonus_Agi.default = 0
  83.   #-----------------------------------------------------------------------------
  84.   # * Bonus : Int
  85.   #-----------------------------------------------------------------------------
  86.   Bonus_Int    = {}
  87.   Bonus_Int.default = 0
  88.   #-----------------------------------------------------------------------------
  89.   # * Bonus : Atk
  90.   #-----------------------------------------------------------------------------
  91.   Bonus_Atk    = {}
  92.   Bonus_Atk.default = 0
  93.   #-----------------------------------------------------------------------------
  94.   # * Bonus : PDef
  95.   #-----------------------------------------------------------------------------
  96.   Bonus_PDef   = {}
  97.   Bonus_PDef.default = 0
  98.   #-----------------------------------------------------------------------------
  99.   # * Bonus : MDef
  100.   #-----------------------------------------------------------------------------
  101.   Bonus_MDef   = {}
  102.   Bonus_MDef.default = 0
  103.   #-----------------------------------------------------------------------------
  104.   # * Bonus : Eva
  105.   #-----------------------------------------------------------------------------
  106.   Bonus_Eva    = {}
  107.   Bonus_Eva.default = 0
  108.   #-----------------------------------------------------------------------------
  109.   # * Bonus : Gold
  110.   #-----------------------------------------------------------------------------
  111.   Bonus_Gold   = {}
  112.   Bonus_Gold.default = 0
  113.   #-----------------------------------------------------------------------------
  114.   # * Bonus : Exp
  115.   #-----------------------------------------------------------------------------
  116.   Bonus_Exp    = {}
  117.   Bonus_Exp.default = 0
  118.   #-----------------------------------------------------------------------------
  119.   # * Capped : MaxHP
  120.   #-----------------------------------------------------------------------------
  121.   Capped_MaxHP = {}
  122.   Capped_MaxHP.default = 9999999
  123.   #-----------------------------------------------------------------------------
  124.   # * Capped : MaxSP
  125.   #-----------------------------------------------------------------------------
  126.   Capped_MaxSP = {}
  127.   Capped_MaxSP.default = 9999999
  128.   #-----------------------------------------------------------------------------
  129.   # * Capped : Str
  130.   #-----------------------------------------------------------------------------
  131.   Capped_Str = {}
  132.   Capped_Str.default = 999
  133.   #-----------------------------------------------------------------------------
  134.   # * Capped : Dex
  135.   #-----------------------------------------------------------------------------
  136.   Capped_Dex = {}
  137.   Capped_Dex.default = 999
  138.   #-----------------------------------------------------------------------------
  139.   # * Capped : Agi
  140.   #-----------------------------------------------------------------------------
  141.   Capped_Agi = {}
  142.   Capped_Agi.default = 999
  143.   #-----------------------------------------------------------------------------
  144.   # * Capped : Int
  145.   #-----------------------------------------------------------------------------
  146.   Capped_Int = {}
  147.   Capped_Int.default = 999
  148.   #-----------------------------------------------------------------------------
  149.   # * Capped : Atk
  150.   #-----------------------------------------------------------------------------
  151.   Capped_Atk = {}
  152.   Capped_Atk.default = 999
  153.   #-----------------------------------------------------------------------------
  154.   # * Capped : PDef
  155.   #-----------------------------------------------------------------------------
  156.   Capped_PDef = {}
  157.   Capped_PDef.default = 999
  158.   #-----------------------------------------------------------------------------
  159.   # * Capped : MDef
  160.   #-----------------------------------------------------------------------------
  161.   Capped_MDef = {}
  162.   Capped_MDef.default = 999
  163.   #-----------------------------------------------------------------------------
  164.   # * Capped : Eva
  165.   #-----------------------------------------------------------------------------
  166.   Capped_Eva = {}
  167.   Capped_Eva.default = 100
  168.   #-----------------------------------------------------------------------------
  169.   # * Capped : Gold
  170.   #-----------------------------------------------------------------------------
  171.   Capped_Gold = {}
  172.   Capped_Gold.default = 9999999
  173.   #-----------------------------------------------------------------------------
  174.   # * Capped : Exp
  175.   #-----------------------------------------------------------------------------
  176.   Capped_Exp = {}
  177.   Capped_Exp.default = 9999999
  178. ################################################################################
  179. # ~**                         CUSTOMIZABLE CONSTANTS - END                                     **~ #
  180. ################################################################################
  181.   #-----------------------------------------------------------------------------
  182.   # * Bonus
  183.   #-----------------------------------------------------------------------------
  184.   def self.bonus(id, stat)
  185.      level = $game_party.average('level')
  186.      level /= 10.0
  187.      bonus = eval("Bonus_#{stat}[#{id}]")
  188.      bonus = bonus.is_a?(Numeric) ? (bonus * level) : 0
  189.      return Integer(bonus)
  190.   end
  191.   #-----------------------------------------------------------------------------
  192.   # * Cap
  193.   #-----------------------------------------------------------------------------
  194.   def self.cap(id, stat)
  195.      cap = eval("Capped_#{stat}[#{id}]")
  196.      return cap
  197.   end
  198. end
  199.  
  200. #===============================================================================
  201. # ** Game_Enemy
  202. #===============================================================================
  203.  
  204. class Game_Enemy < Game_Battler
  205.   #-----------------------------------------------------------------------------
  206.   # * Alias Listings
  207.   #-----------------------------------------------------------------------------
  208.   alias_method :autolevel_gmenemy_basemaxhp,   :base_maxhp
  209.   alias_method :autolevel_gmenemy_basemaxsp,   :base_maxsp
  210.   alias_method :autolevel_gmenemy_basestr,      :base_str
  211.   alias_method :autolevel_gmenemy_basedex,      :base_dex
  212.   alias_method :autolevel_gmenemy_baseagi,      :base_agi
  213.   alias_method :autolevel_gmenemy_baseint,      :base_int
  214.   alias_method :autolevel_gmenemy_baseatk,      :base_atk
  215.   alias_method :autolevel_gmenemy_basepdef,    :base_pdef
  216.   alias_method :autolevel_gmenemy_basemdef,    :base_mdef
  217.   alias_method :autolevel_gmenemy_baseeva,      :base_eva
  218.   alias_method :autolevel_gmenemy_gold,          :gold
  219.   alias_method :autolevel_gmenemy_exp,            :exp
  220.   #-----------------------------------------------------------------------------
  221.   # * Auto Level Bonus
  222.   #-----------------------------------------------------------------------------
  223.   def autolevel_bonus(stat)
  224.      return AutoLevel.bonus(self.id, stat)
  225.   end
  226.   #-----------------------------------------------------------------------------
  227.   # * Auto Level Cap
  228.   #-----------------------------------------------------------------------------
  229.   def autolevel_cap(stat)
  230.      return AutoLevel.cap(self.id, stat)
  231.   end
  232.   #-----------------------------------------------------------------------------
  233.   # * Base MaxHP
  234.   #-----------------------------------------------------------------------------
  235.   def base_maxhp
  236.      n = autolevel_gmenemy_basemaxhp
  237.      n += autolevel_bonus('MaxHP')
  238.      return [[n, 1].max, autolevel_cap('MaxHP')].min
  239.   end
  240.   #-----------------------------------------------------------------------------
  241.   # * Base MaxSP
  242.   #-----------------------------------------------------------------------------
  243.   def base_maxsp
  244.      n = autolevel_gmenemy_basemaxsp
  245.      n += autolevel_bonus('MaxSP')
  246.      return [[n, 0].max, autolevel_cap('MaxSP')].min
  247.   end
  248.   #-----------------------------------------------------------------------------
  249.   # * Base Str
  250.   #-----------------------------------------------------------------------------
  251.   def base_str
  252.      n = autolevel_gmenemy_basestr
  253.      n += autolevel_bonus('Str')
  254.      return [[n, 1].max, autolevel_cap('Str')].min
  255.   end
  256.   #-----------------------------------------------------------------------------
  257.   # * Base Dex
  258.   #-----------------------------------------------------------------------------
  259.   def base_dex
  260.      n = autolevel_gmenemy_basedex
  261.      n += autolevel_bonus('Dex')
  262.      return [[n, 1].max, autolevel_cap('Dex')].min
  263.   end
  264.   #-----------------------------------------------------------------------------
  265.   # * Base Agi
  266.   #-----------------------------------------------------------------------------
  267.   def base_agi
  268.      n = autolevel_gmenemy_baseagi
  269.      n += autolevel_bonus('Agi')
  270.      return [[n, 1].max, autolevel_cap('Agi')].min
  271.   end
  272.   #-----------------------------------------------------------------------------
  273.   # * Base Int
  274.   #-----------------------------------------------------------------------------
  275.   def base_int
  276.      n = autolevel_gmenemy_baseint
  277.      n += autolevel_bonus('Int')
  278.      return [[n, 1].max, autolevel_cap('Int')].min
  279.   end
  280.   #-----------------------------------------------------------------------------
  281.   # * Base Atk
  282.   #-----------------------------------------------------------------------------
  283.   def base_atk
  284.      n = autolevel_gmenemy_baseatk
  285.      n += autolevel_bonus('Atk')
  286.      return [[n, 0].max, autolevel_cap('Atk')].min
  287.   end
  288.   #-----------------------------------------------------------------------------
  289.   # * Base PDef
  290.   #-----------------------------------------------------------------------------
  291.   def base_pdef
  292.      n = autolevel_gmenemy_basepdef
  293.      n += autolevel_bonus('PDef')
  294.      return [[n, 0].max, autolevel_cap('PDef')].min
  295.   end
  296.   #-----------------------------------------------------------------------------
  297.   # * Base MDef
  298.   #-----------------------------------------------------------------------------
  299.   def base_mdef
  300.      n = autolevel_gmenemy_basemdef
  301.      n += autolevel_bonus('MDef')
  302.      return [[n, 0].max, autolevel_cap('MDef')].min
  303.   end
  304.   #-----------------------------------------------------------------------------
  305.   # * Base Eva
  306.   #-----------------------------------------------------------------------------
  307.   def base_eva
  308.      n = autolevel_gmenemy_baseeva
  309.      n += autolevel_bonus('Eva')
  310.      return [[n, -100].max, autolevel_cap('Eva')].min
  311.   end
  312.   #-----------------------------------------------------------------------------
  313.   # * Gold
  314.   #-----------------------------------------------------------------------------
  315.   def gold
  316.      n = autolevel_gmenemy_gold
  317.      n += autolevel_bonus('Gold')
  318.      return [[n, 0].max, autolevel_cap('Gold')].min
  319.   end
  320.   #-----------------------------------------------------------------------------
  321.   # * Exp
  322.   #-----------------------------------------------------------------------------
  323.   def exp
  324.      n = autolevel_gmenemy_exp
  325.      n += autolevel_bonus('Exp')
  326.      return [[n, 0].max, autolevel_cap('Exp')].min
  327.   end
  328. end
  329.  
  330. #===============================================================================
  331. # ** Game_Party
  332. #===============================================================================
  333.  
  334. class Game_Party
  335.   #-----------------------------------------------------------------------------
  336.   # * Name         : Average
  337.   #    Info         : Returns average of party's stats, based on parameter
  338.   #    Author      : Kain Nobel
  339.   #    Call Info : Parameter is a string representing parameter in question
  340.   #-----------------------------------------------------------------------------
  341.   unless self.method_defined?(:average)
  342.      def average(stat)
  343.         return 0 if @actors.size == 0
  344.         avg = 0
  345.         case stat.downcase
  346.         when 'hp'      ; @actors.each {|actor| avg += actor.hp}
  347.         when 'maxhp' ; @actors.each {|actor| avg += actor.maxhp}
  348.         when 'sp'      ; @actors.each {|actor| avg += actor.sp}
  349.         when 'maxsp' ; @actors.each {|actor| avg += actor.maxsp}
  350.         when 'level' ; @actors.each {|actor| avg += actor.level}
  351.         when 'exp'    ; @actors.each {|actor| avg += actor.exp}
  352.         when 'str'    ; @actors.each {|actor| avg += actor.str}
  353.         when 'dex'    ; @actors.each {|actor| avg += actor.dex}
  354.         when 'agi'    ; @actors.each {|actor| avg += actor.agi}
  355.         when 'int'    ; @actors.each {|actor| avg += actor.int}
  356.         when 'atk'    ; @actors.each {|actor| avg += actor.atk}
  357.         when 'pdef'   ; @actors.each {|actor| avg += actor.pdef}
  358.         when 'mdef'   ; @actors.each {|actor| avg += actor.mdef}
  359.         when 'eva'    ; @actors.each {|actor| avg += actor.eva}
  360.         end
  361.         return (avg / @actors.size)
  362.      end
  363.   end
  364. end
  365.  
  366. #-------------------------------------------------------------------------------
  367. # * SDK Enabled Test : END
  368. #-------------------------------------------------------------------------------
  369. end
Expand to see the code.

Battle : Auto Level Enemies (VX Version) Spoiler
  1. #===============================================================================
  2. # ** Battle : Auto-Level Enemies
  3. #-------------------------------------------------------------------------------
  4. # * Description :
  5. #
  6. #   This script influences individual/all enemies' stats to be modified by a
  7. #   bonus percent which is based off the active game party's average level.
  8. #-------------------------------------------------------------------------------
  9. # * Syntax :
  10. #
  11. #   To set individual enemy's to have a special bonus percent, you'll do
  12. #   something like this...
  13. #
  14. #     Bonus_<stat> = {enemy_id => bonus, ...}
  15. #
  16. #   ...or...
  17. #
  18. #     Bonus_<stat>[enemy_id] = bonus
  19. #
  20. #   For enemys which aren't individually defined, you must always have a
  21. #   'default' setting because the script looks for it reguardless. To make
  22. #   sure you have a default setting, all of your constants must have a...
  23. #
  24. #     Bonus_<stat>.default = (Numeric) # 0 by default
  25. #-------------------------------------------------------------------------------
  26. # * Formula :
  27. #
  28. #   The default formula used in this script is....
  29. #
  30. #     level = $game_party.average('level')
  31. #     level /= 10.0
  32. #     bonus = eval("Bonus_#{stat}[#{id}]")
  33. #     bonus = bonus.is_a?(Numeric) ? (bonus * level) : 0
  34. #     return Integer(bonus)
  35. #
  36. #   ...If you have a better formula than feel free to change it, but this
  37. #   basically takes the set bonus multiplied by the $game_party's average
  38. #   level (as a percent), then adds it to the enemy's base stat.
  39. #===============================================================================
  40.  
  41. #===============================================================================
  42. # ** Game_Enemy::AutoLevel
  43. #===============================================================================
  44.  
  45. module Game_Enemy::AutoLevel
  46. ################################################################################
  47. # ~**                CUSTOMIZABLE CONSTANTS - BEGIN                        **~ #
  48. ################################################################################
  49.   #-----------------------------------------------------------------------------
  50.   # * Bonus : MaxHP
  51.   #-----------------------------------------------------------------------------
  52.   Bonus_MaxHP = {}
  53.   Bonus_MaxHP.default = 0
  54.   #-----------------------------------------------------------------------------
  55.   # * Bonus : MaxMP
  56.   #-----------------------------------------------------------------------------
  57.   Bonus_MaxMP = {}
  58.   Bonus_MaxMP.default = 0
  59.   #-----------------------------------------------------------------------------
  60.   # * Bonus : Atk
  61.   #-----------------------------------------------------------------------------
  62.   Bonus_Atk   = {}
  63.   Bonus_Atk.default = 0
  64.   #-----------------------------------------------------------------------------
  65.   # * Bonus : Def
  66.   #-----------------------------------------------------------------------------
  67.   Bonus_Def  = {}
  68.   Bonus_Def.default = 0
  69.   #-----------------------------------------------------------------------------
  70.   # * Bonus : Spi
  71.   #-----------------------------------------------------------------------------
  72.   Bonus_Spi  = {}
  73.   Bonus_Spi.default = 0
  74.   #-----------------------------------------------------------------------------
  75.   # * Bonus : Agi
  76.   #-----------------------------------------------------------------------------
  77.   Bonus_Agi   = {}
  78.   Bonus_Agi.default = 0
  79.   #-----------------------------------------------------------------------------
  80.   # * Bonus : Gold
  81.   #-----------------------------------------------------------------------------
  82.   Bonus_Gold  = {}
  83.   Bonus_Gold.default = 0
  84.   #-----------------------------------------------------------------------------
  85.   # * Bonus : Exp
  86.   #-----------------------------------------------------------------------------
  87.   Bonus_Exp   = {}
  88.   Bonus_Exp.default = 0
  89.   #-----------------------------------------------------------------------------
  90.   # * Capped : MaxHP
  91.   #-----------------------------------------------------------------------------
  92.   Capped_MaxHP = {}
  93.   Capped_MaxHP.default = 9999999
  94.   #-----------------------------------------------------------------------------
  95.   # * Capped : MaxMP
  96.   #-----------------------------------------------------------------------------
  97.   Capped_MaxMP = {}
  98.   Capped_MaxMP.default = 9999999
  99.   #-----------------------------------------------------------------------------
  100.   # * Capped : Atk
  101.   #-----------------------------------------------------------------------------
  102.   Capped_Atk = {}
  103.   Capped_Atk.default = 999
  104.   #-----------------------------------------------------------------------------
  105.   # * Capped : Def
  106.   #-----------------------------------------------------------------------------
  107.   Capped_Def = {}
  108.   Capped_Def.default = 999
  109.   #-----------------------------------------------------------------------------
  110.   # * Capped : Spi
  111.   #-----------------------------------------------------------------------------
  112.   Capped_Spi = {}
  113.   Capped_Spi.default = 999
  114.   #-----------------------------------------------------------------------------
  115.   # * Capped : Agi
  116.   #-----------------------------------------------------------------------------
  117.   Capped_Agi = {}
  118.   Capped_Agi.default = 999
  119.   #-----------------------------------------------------------------------------
  120.   # * Capped : Gold
  121.   #-----------------------------------------------------------------------------
  122.   Capped_Gold = {}
  123.   Capped_Gold.default = 9999999
  124.   #-----------------------------------------------------------------------------
  125.   # * Capped : Exp
  126.   #-----------------------------------------------------------------------------
  127.   Capped_Exp = {}
  128.   Capped_Exp.default = 9999999
  129. ################################################################################
  130. # ~**                 CUSTOMIZABLE CONSTANTS - END                         **~ #
  131. ################################################################################
  132.   #-----------------------------------------------------------------------------
  133.   # * Bonus
  134.   #-----------------------------------------------------------------------------
  135.   def self.bonus(id, stat)
  136.     level = $game_party.average('level')
  137.     level /= 10.0
  138.     bonus = eval("Bonus_#{stat}[#{id}]")
  139.     bonus = bonus.is_a?(Numeric) ? (bonus * level) : 0
  140.     return Integer(bonus)
  141.   end
  142.   #-----------------------------------------------------------------------------
  143.   # * Cap
  144.   #-----------------------------------------------------------------------------
  145.   def self.cap(id, stat)
  146.     cap = eval("Capped_#{stat}[#{id}]")
  147.     return cap
  148.   end
  149. end
  150.  
  151. #===============================================================================
  152. # ** Game_Enemy
  153. #===============================================================================
  154.  
  155. class Game_Enemy < Game_Battler
  156.   #-----------------------------------------------------------------------------
  157.   # * Alias Listings
  158.   #-----------------------------------------------------------------------------
  159.   alias_method :autolevel_gmenemy_basemaxhp,  :base_maxhp
  160.   alias_method :autolevel_gmenemy_basemaxmp,  :base_maxmp
  161.   alias_method :autolevel_gmenemy_baseatk,    :base_atk
  162.   alias_method :autolevel_gmenemy_basedef,    :base_def
  163.   alias_method :autolevel_gmenemy_basespi,    :base_spi
  164.   alias_method :autolevel_gmenemy_baseagi,    :base_agi
  165.   alias_method :autolevel_gmenemy_gold,       :gold
  166.   alias_method :autolevel_gmenemy_exp,        :exp
  167.   #-----------------------------------------------------------------------------
  168.   # * Auto Level Bonus
  169.   #-----------------------------------------------------------------------------
  170.   def autolevel_bonus(stat)
  171.     AutoLevel.bonus(self.id, stat)
  172.   end
  173.   #-----------------------------------------------------------------------------
  174.   # * Auto Level Cap
  175.   #-----------------------------------------------------------------------------
  176.   def autolevel_cap(stat)
  177.     AutoLevel.cap(self.id, stat)
  178.   end
  179.   #-----------------------------------------------------------------------------
  180.   # * Base MaxHP
  181.   #-----------------------------------------------------------------------------
  182.   def base_maxhp
  183.     n = autolevel_gmenemy_basemaxhp
  184.     n += autolevel_bonus('MaxHP')
  185.     [[n, 1].max, autolevel_cap('MaxHP')].min
  186.   end
  187.   #-----------------------------------------------------------------------------
  188.   # * Base MaxMP
  189.   #-----------------------------------------------------------------------------
  190.   def base_maxmp
  191.     n = autolevel_gmenemy_basemaxmp
  192.     n += autolevel_bonus('MaxMP')
  193.     [[n, 0].max, autolevel_cap('MaxMP')].min
  194.   end
  195.   #-----------------------------------------------------------------------------
  196.   # * Base Attack
  197.   #-----------------------------------------------------------------------------
  198.   def base_atk
  199.     n = autolevel_gmenemy_baseatk
  200.     n += autolevel_bonus('Atk')
  201.     [[n, 1].max, autolevel_cap('Atk')].min
  202.   end
  203.   #-----------------------------------------------------------------------------
  204.   # * Base Defense
  205.   #-----------------------------------------------------------------------------
  206.   def base_def
  207.     n = autolevel_gmenemy_basedef
  208.     n += autolevel_bonus('Def')
  209.     [[n, 1].max, autolevel_cap('Def')].min
  210.   end
  211.   #-----------------------------------------------------------------------------
  212.   # * Base Spirit
  213.   #-----------------------------------------------------------------------------
  214.   def base_spi
  215.     n = autolevel_gmenemy_basespi
  216.     n += autolevel_bonus('Spi')
  217.     [[n, 1].max, autolevel_cap('Spi')].min
  218.   end
  219.   #-----------------------------------------------------------------------------
  220.   # * Base Int
  221.   #-----------------------------------------------------------------------------
  222.   def base_agi
  223.     n = autolevel_gmenemy_baseagi
  224.     n += autolevel_bonus('Agi')
  225.     [[n, 1].max, autolevel_cap('Agi')].min
  226.   end
  227.   #-----------------------------------------------------------------------------
  228.   # * Gold
  229.   #-----------------------------------------------------------------------------
  230.   def gold
  231.     n = autolevel_gmenemy_gold
  232.     n += autolevel_bonus('Gold')
  233.     [[n, 0].max, autolevel_cap('Gold')].min
  234.   end
  235.   #-----------------------------------------------------------------------------
  236.   # * Exp
  237.   #-----------------------------------------------------------------------------
  238.   def exp
  239.     n = autolevel_gmenemy_exp
  240.     n += autolevel_bonus('Exp')
  241.     [[n, 0].max, autolevel_cap('Exp')].min
  242.   end
  243. end
  244.  
  245. #===============================================================================
  246. # ** Game_Party
  247. #===============================================================================
  248.  
  249. class Game_Party
  250.   #-----------------------------------------------------------------------------
  251.   # * Name      : Average
  252.   #   Info      : Returns average of party's stats, based on parameter
  253.   #   Author    : Kain Nobel
  254.   #   Call Info : Parameter is a string representing parameter in question
  255.   #-----------------------------------------------------------------------------
  256.   unless self.method_defined?(:average)
  257.     def average(stat)
  258.       return 0 if @actors.size == 0
  259.       avg = 0
  260.       @actors.compact.each {|a|
  261.       next if members[a].nil?
  262.       case stat.downcase
  263.       when 'hp'    then avg += $game_party.members[a].hp
  264.       when 'maxhp' then avg += $game_party.members[a].maxhp
  265.       when 'mp'    then avg += $game_party.members[a].mp
  266.       when 'maxmp' then avg += $game_party.members[a].maxmp
  267.       when 'level' then avg += $game_party.members[a].level
  268.       when 'exp'   then avg += $game_party.members[a].exp
  269.       when 'atk'   then avg += $game_party.members[a].atk
  270.       when 'def'   then avg += $game_party.members[a].def
  271.       when 'spi'   then avg += $game_party.members[a].spi
  272.       when 'agi'   then avg += $game_party.members[a].agi
  273.       end}
  274.       return (avg / @actors.size)
  275.     end
  276.   end
  277. end
  278.  
Expand to see the code.


Instructions

The instructions and the default formula used are documented in the script's header, please if you have any questions just ask and if you want your own special formula and don't know how you can ask me in privately to write you a different formula.

Compatibility

Place this script below anything that directly overwrites any of the Game_Enemy stats or it will not work. This script DOES NOT require SDK to use so if you need to remove the SDK delete the SDK.log, SDK.enabled?() test and the last end in the script.

This script was designed based off the default Battle System so anything outside of that concept, such as an ABS system, don't expect it to work. Things like RTAB and stuff which further enhance the default battle system, it should work on but if not you can request some sort of patch.

Credits and Thanks

Credits and thanks again still go to khmp and whoever else might've helped me on the origional script (which was written a year or two ago when I barely knew what I was doing).

Terms and Conditions

Free to use in commercial/non-commercial games so long as credit is given, please do not redistribute outside of the community without notifying me first.
94 views and no feedback... lame... please just one comment people or I'm not going to be releasing anymore scripts for a long long time XD
Nice to see an upgraded version of this!

If you don't remember, I posted in your previous version of your Auto-Level enemies script, and it was very useful for my game! This version sounds a lot spiffier, but I have yet to try it. The ability to have it work differently for different enemies sounds great!

I'm posting now because you sounded sad you weren't getting any replies, so I thought I'd cheer you up by replying!
Yup, I remember you replying on the older version's topic. Thank you, all I needed is 1 reply so I feel better now :thumb:

BTW slight update, I changed the settings for stat caps and made constants for them. Origionally, I had them set the way the database caps an enemy stat when you edit it but now you can define individually the highest each stat can go for each enemy.

Say, for instance, you don't want a Ghost (enemy id # 1) to have more than 2000 Max HP, then you'd do...

Capped_MaxHP[1] = 2000

...that way you're not fighting a silly Ghost with 9999999 MaxHP when you're level 99 reguardless of your bonus inflation for MaxHP being high. The minimums are automatically adjusted to what the database allows, and the maximums are whatever you set in the settings.

Enjoy people! Don't be shy to leave some comments, questions, suggestions and/or bug reports :smoke:
Nice script!
Awesome script Kain Nobel! Really! The cap stats feature is also awesome and easy to use.

Good job! I'm using this in my project and no error so far. It does sound like bug free :thumb:
Awesome, glad you guys are liking it! I'm thinking of making a VX version, so if anybody needs a VX version then please tell me so and I'll start one next week since I have VX up and running now.
I am working on trying to do an open-world rmvx game and a script like this would work really good with it. If you still are thinking about making a VX version, I would definetly use it! One question though: Is there a way to set it so that certain enemies don't level up (for certain bosses and story fights)
The only enemies who gain anything are the ones you define to specifically gain a percent (or all of them if you set a Bonus_XXX.default to something besides 0). So, for instance...

Bonus_Gold = {}
Bonus_Gold[3] = 5
Bonus_Gold.default = 0


...the enemy with ID #3 (in database) will drop gold * 5% when an actor kills it. Everybody else will drop their normal ammount with no inflation based on level. The same steps apply to defining any/all stats for any/all enemies.

Alternatively, you can set the .default to something higher than 0 and every enemy undefined above that will drop X ammount of gold (due to the default value), thats the easy/lazy way to do it for every enemy lol.

I'll post a VX version tomorrow night. Please, if its not up by the 12th (Tuesday), PM because I am forgetful lately :P
good script, i might use it if it doesnt take to long set up ;)
Yeah, it can be time consuming if you're like me and customize the bonus/caps for every enemy in the database, but thats my fault because I'm picky. So, in other words, its only as time-consuming as you are picky lol!

Okay, VX version has been posted everybody, please visit the opening post to gnab yours! I didn't playtest it or test any settings but I'm fairly confident that it'll work 100% bug free (purely speculation), feel free to let me know if any problems arise I won't be shy to fix them for ya!
-Example you have, lets say,a lvl 1 monster in the starting place of the game, but if you come to that place later, with high lvled party members, the monsters will be stronger?

If im right this looks good and i'll try!!



[sorry for my bad english]
Loving the vx script version of this good job. 😀
alright this might be a little necro but all the same i really like the idea of the script and would love to get it to work for me. im using the VX script more or less plug and play, and even on a game with no other scripts i get the following error before the menu even comes up:

"Script ' ' line 160: NameError occurred.
undefined method 'base_maxsp" for class 'Game_Enemy'

so in my tinkering i say ok what happens when i remove all cases of maxsp, and doing so i actually get into the game which will then crash on any encounter giving the error:

"Script ' ' Line 250: NoMethodError occured
undefined method 'level' for 1:Fixnum"

so since i havent been able to figure things out on my own (seeing as my script skills are pretty minor), here i am asking for any help on the matter. sorry for the ramble but this script is certainly worth it, excellent job Kain and thanks in advance for any help anyone can give
Necropost? Nah, so long as I still support my own scripts its not :P

Both bugs fixed! They both had two common problems; 1.) I didn't playtest it when I posted it, 2.) I forgot about the small changes from XP to VX's better coding concepts. If you so happened to copy the still-bugged version of the script from up to 10 minutes ago, then please re-copy it again XD

If any other problems arise, please notify me imediately! However, after a thorough trial and error and several post edits, I've squashed both bugs ;)
thanks for the amazingly fast fix, everything seems in order now :D
Okay. I opened a new project and put this script in there with the SDK. I open the game but the moment I do I get an error saying this:

Content Hidden Spoiler
---------------------------
Chronicles of Illestia
---------------------------
Script 'Enemy Auto Level' line 2: SyntaxError occurred.
---------------------------
OK
---------------------------

I didn't change anything except the default percents.
Is this line 2 in your copy of the script? Spoiler
# ** Battle : Auto-Level Enemies


If not then please post your copy of the script so I can see whats on line 2, or what you did with the setup, because you shouldn't be getting an error on a line which is strictly a comment and doesn't do anything.
hi. i'm looking to use this script for my game(credit will be given.) i want to be able to change this through a call script event. say if i want to increase the troop
s maxhp by 15? forgive me for being dim. but i think i might've missed that.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=63673