Enemy Stat Variance
Version: 1.1
Author: modern algebra
Date: September 26, 2008
Version History
- <Version 1.1> 09/26/08 Added the ability to use random percentile
- <Version 1.0> 09/08/08 Original Release
Description
This script allows you to attach a variance to each enemy stat, so that enemy instances aren't all just clones of each other but can have stat differences.
Features
- Enemies of the same type aren't just clones of each other.
- Allows you to set variance for each of the stats of each enemy individually
- Allows you to use percentile increase in addition to definite numbers
- Intuitive configuration
Screenshots
N/A
Instructions
See inside Script Header
Script
#==============================================================================
# Enemy Stat Variance
# Version: 1.1
# Author: modern algebra
# Date: September 26, 2008
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Instructions:
# Just place the code for each of the stat variances you want into the notes
# box of the Enemy. The possible codes are:
#
# \variance_hp[x]
# \variance_mp[x]
# \variance_atk[x]
# \variance_def[x]
# \variance_spi[x]
# \variance_agi[x]
# \variance_hp%[x]
# \variance_mp%[x]
# \variance_atk%[x]
# \variance_def%[x]
# \variance_spi%[x]
# \variance_agi%[x]
#
# Each of the codes will give a variance of x to the stat chosen. A variance
# x means that the enemy will have a random number between 0 and x added to
# its base stat. So, if the base stat set in the database is 120, and x is
# set to 30, then that stat will be between 120 and 150 for any instance of
# that enemy. So, if you are fighting two slimes, then one of them could have
# that stat be 127 while the other has it at 142, for example.
#
# If the codes have a percentage to them, then it will take a random number
# between 0 and x and add that percentage of the stat to the enemy's stat. So,
# if an enemy's max HP is 200 and you set \variance_hp%[10], then the script
# will choose a random number between 0 and 10. In this case, let's say it
# chooses 6, then .06*200 will be added to the enemy's HP, resulting in that
# enemy having 212 HP
#==============================================================================
# ** Game_Enemy
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# aliased method - initialize
#==============================================================================
class Game_Enemy < Game_Battler
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_varystat_enmy_init_9hd4 initialize
def initialize (index, enemy_id)
modalg_varystat_enmy_init_9hd4 (index, enemy_id)
# Add to stats according to variance in notes
text = enemy.note.dup
# Dissect Note
while text[/\\variance_.*\[\d+\]/i]
text.sub!(/\\variance_(.*)\[(\d+)\]/i) { "" }
random_num = rand ($2.to_i)
case $1.to_s
when /HP%/i then @maxhp_plus += ((random_num.to_f / 100.0)*self.maxhp).to_i
when /MP%/i then @maxmp_plus += ((random_num.to_f / 100.0)*self.maxmp).to_i
when /ATK%/i then @atk_plus += ((random_num.to_f / 100.0)*self.atk).to_i
when /DEF%/i then @def_plus += ((random_num.to_f / 100.0)*self.def).to_i
when /SPI%/i then @spi_plus += ((random_num.to_f / 100.0)*self.spi).to_i
when /AGI%/i then @agi_plus += ((random_num.to_f / 100.0)*self.agi).to_i
when /HP/i then @maxhp_plus += random_num
when /MP/i then @maxmp_plus += random_num
when /ATK/i then @atk_plus += random_num
when /DEF/i then @def_plus += random_num
when /SPI/i then @spi_plus += random_num
when /AGI/i then @agi_plus += random_num
end
end
@hp = maxhp
@mp = maxmp
end
end
Credit
Support
Please post in this topic at rmrk.net for any support you may need. Also, if you have any suggestions, then please tell me - I am always looking for ways to improve my scripts.
Known Compatibility Issues
No known compatibility issues.
Demo
Not useful or necessary.
This script by
modern algebra is licensed under a
Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.