03-27-2006, 01:00 PM
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
I decided to heavily modify two similar scripts by SephirothSpawn.
The original Enemies Level UP can be found HERE.
The original Difficulty Options can be found HERE.
How my modification changes its workings:
Each stat has an arbitrary number added to it for every level your party averages above 1.
Those numbers are easily customizable.
Furthermore, simple name-tagging (like the BOSS feature that I left in) allows further modification on a creature-by-creature basis. There are four examples of this in the script as-is.
On top of all that, I've included the difficulty options. Unlike Seph's version, this isn't just a set of five tags with specific constants. You can dial it up and down as much as you like with a simple call-script:
Code:
$difficulty_options.increase(n)
$difficulty_options.decrease(n)
$difficulty_options.set(n)
$difficulty_options.normal #Sets the constant to 0.
But wait, there's more!
Seph's Enemies Level UP script broke the battle test. This doesn't. Boo-yah!
You can, however, only test at normal difficulty.
And so, without further ado... the script!
Code:
#==============================================================================
# Enemies That Level UP DS Mod
#--------------------------------------------------------------------------
# Created By SephirothSpawn (11.25.05)
# Last Updated: 11.25.05
# Modified by DrakoShade (03.27.06)
# Last updated 03.27.06
#--------------------------------------------------------------------------
# To change the difficulty:
# $difficulty_options.increase(n) #Adds n to the difficulty.
# $difficulty_options.decrease(n) #Subtracts n from the difficulty.
# $difficulty_options.set(n) #Sets the difficulty at n.
# $difficulty_options.normal #Returns the difficulty to 0.
#
# Other modifications are explained where you can actually make them.
#==============================================================================
#==============================================================================
# Module RPG
#==============================================================================
module RPG
#=========================================================================
# Class Enemy
#=========================================================================
class Enemy
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
# Base Statistics
attr_accessor :b_maxhp, :b_maxsp, :b_str, :b_dex, :b_agi, :b_int
attr_accessor :b_atk, :b_pdef, :b_mdef, :b_eva, :b_exp, :b_gold
# Boss Check
attr_accessor :boss
#--------------------------------------------------------------------------
# * Set Bases
#--------------------------------------------------------------------------
def set_bases
@b_maxhp, @b_maxsp = @maxhp, @maxsp
@b_str, @b_dex, @b_agi, @b_int = @str, @dex, @agi, @int
@b_atk, @b_pdef, @b_mdef, @b_eva = @atk, @pdef, @mdef, @eva
@b_exp, @b_gold = @exp, @gold
#--------------------------------------------------------------------------
# Define stat boost per level.
# These boosts are kept in an array for easy mass-modification.
# They are stored as follows:
# Max HP = @boost[0]
# Max SP = @boost[1]
# Str = @boost[2]
# Dex = @boost[3]
# Agi = @boost[4]
# Int = @boost[5]
# Atk = @boost[6]
# PDef = @boost[7]
# MDef = @boost[8]
# Eva = @boost[9]
# Exp = @boost[10]
# Gold = @boost[11]
# It's a good idea to set the stat-boosts to closely match the average
# stat progression of your characters. As this stands, it matches
# the default progression pretty well.
#--------------------------------------------------------------------------
@boost = [50, 50, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]
#---------------------------------------------
# Modify stat boosts by name-tagging. Use
# these examples as templates for making your
# own tags.
#---------------------------------------------
if @name.include?("(strong)")
@boost += [1]
@name.slice!("(strong)")
end
if @name.include?("(weak)")
@boost -= [1]
@name.slice!("(weak)")
end
if @name.include?("(phys)")
@boost[0] += 10
@boost[1] -= 10
@boost[2] += 1
@boost[5] -= 1
@boost[6] += 1
@boost[7] += 1
@boost[8] -= 1
@name.slice!("(phys)")
end
if @name.include?("(ment)")
@boost[0] -= 10
@boost[1] += 10
@boost[2] -= 1
@boost[5] += 1
@boost[6] -= 1
@boost[7] -= 1
@boost[8] += 1
@name.slice!("(ment)")
end
# Checks to See if there's a boss
if @name.include?("(BOSS)")
@boss = true
@name.slice!("(BOSS)")
else
@boss = false
end
end
#--------------------------------------------------------------------------
# * Update Level
#--------------------------------------------------------------------------
def update_level
unless @boss
# Calulates Average Level of Party
average = 0
for actor in $game_party.actors
average += actor.level - 1
end
average /= $game_party.actors.size
average += $difficulty_options.constant
average = average.to_i
# Update Stats
# Update the Max HP of the enemy.
@maxhp = ([((@b_maxhp + (average * @boost[0])) * (rand(30)+85) / 100), 1].max).to_i
# Update the Max SP of the enemy.
@maxsp = ([((@b_maxsp + (average * @boost[1])) * (rand(30)+85) / 100), 1].max).to_i
# Update the Strength of the enemy.
@str = ([((@b_str + (average * @boost[2])) * (rand(30)+85) / 100), 1].max).to_i
# Update the Dexterity of the enemy.
@dex = ([((@b_dex + (average * @boost[3])) * (rand(30)+85) / 100), 1].max).to_i
# Update the Agility of the enemy.
@agi = ([((@b_agi + (average * @boost[4])) * (rand(30)+85) / 100), 1].max).to_i
# Update the Intelligence of the enemy.
@int = ([((@b_int + (average * @boost[5])) * (rand(30)+85) / 100), 1].max).to_i
# Update the Attack of the enemy.
@atk = ([((@b_atk + (average * @boost[6])) * (rand(30)+85) / 100), 1].max).to_i
# Update the Physical Defence of the enemy.
@pdef = ([((@b_pdef + (average * @boost[7])) * (rand(30)+85) / 100), 1].max).to_i
# Update the Magical Defence of the enemy.
@mdef = ([((@b_mdef + (average * @boost[8])) * (rand(30)+85) / 100), 1].max).to_i
# Update the Evasion of the enemy.
@eva = ([((@b_eva + (average * @boost[9])) * (rand(30)+85) / 100), 1].max).to_i
# Update the Experience given by the enemy.
@exp = ([((@b_exp + ((average - $difficulty_options.constant) *
@boost[10].to_i)) * (rand(30)+85) / 100), 1].max).to_i
# Update the Gold given by the enemy.
@gold = ([((@b_gold + ((average - $difficulty_options.constant) *
@boost[11].to_i)) * (rand(30)+85) / 100), 1].max).to_i
end
end
end
end
#==============================================================================
# Class Scene Title
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# * Alias' New Game Method
#--------------------------------------------------------------------------
alias new_game command_new_game
alias continue command_continue
#--------------------------------------------------------------------------
# * Adds Base Stats For Enemies
#--------------------------------------------------------------------------
def command_new_game
for i in 1...$data_enemies.size
$data_enemies[i].set_bases
$difficulty_options = Difficulty_Options.new
end
new_game
end
def command_continue
for i in 1...$data_enemies.size
$data_enemies[i].set_bases
end
continue
end
end
#==============================================================================
# Class Scene Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
if $difficulty_options == nil
$difficulty_options = Difficulty_Options.new
for i in 1...$data_enemies.size
$data_enemies[i].set_bases
end
end
for i in 1...$data_enemies.size
$data_enemies[i].update_level
end
end
end
#==============================================================================
# Class Difficulty Options
#==============================================================================
class Difficulty_Options
attr_reader :constant
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
normal
end
#--------------------------------------------------------------------------
# * Normal Difficulty
#--------------------------------------------------------------------------
def normal
@constant = 0
end
#--------------------------------------------------------------------------
# * Increase Difficulty (Or decrease)
# n = number to increase difficulty by.
#--------------------------------------------------------------------------
def increase(n)
@constant += n
end
#--------------------------------------------------------------------------
# * Decrease Difficulty
# Invert n and call it in increase difficulty.
#--------------------------------------------------------------------------
def decrease(n)
increase(-n)
end
#--------------------------------------------------------------------------
# * Set Difficulty
# n = number to set difficulty at.
#--------------------------------------------------------------------------
def set(n)
@constant = n
end
end
#==============================================================================
# Scene_Save
#==============================================================================
class Scene_Save < Scene_File
#--------------------------------------------------------------------------
# * Alias Save Data
#--------------------------------------------------------------------------
alias new_save write_save_data
#--------------------------------------------------------------------------
# * Write Save Data
#--------------------------------------------------------------------------
def write_save_data(file)
new_save(file)
Marshal.dump($difficulty_options, file)
end
end
#==============================================================================
# Scene_Load
#==============================================================================
class Scene_Load < Scene_File
#--------------------------------------------------------------------------
# * Alias Read Save Data
#--------------------------------------------------------------------------
alias new_load read_save_data
#--------------------------------------------------------------------------
# * Read Save Data
#--------------------------------------------------------------------------
def read_save_data(file)
new_load(file)
$difficulty_options = Marshal.load(file)
end
end