Kain Nobel
Member
Thanks for helping with script, I've finished the first version of it. You can find it in submitted scripts section, or just copy it from here, they both work !
Code:
#===============================================================================
# ~* Enemy Auto-Leveling Script *~
#-------------------------------------------------------------------------------
# Written by : Kain Nobel
# Version : 1.0
# Last Update : 5/9/2008
# Created : 5/8/2008
#-------------------------------------------------------------------------------
# Special Thanks: Arbiter & khmp
#===============================================================================
################################################################################
#===============================================================================
# * Game_Enemy (Aliased)
#===============================================================================
class Game_Enemy < Game_Battler
# Alias Method for Base Stats
alias_method :kn_game_enemy_base_maxhp, :base_maxhp
alias_method :kn_game_enemy_base_maxsp, :base_maxsp
alias_method :kn_game_enemy_base_str, :base_str
alias_method :kn_game_enemy_base_dex, :base_dex
alias_method :kn_game_enemy_base_agi, :base_agi
alias_method :kn_game_enemy_base_int, :base_int
alias_method :kn_game_enemy_base_atk, :base_atk
alias_method :kn_game_enemy_base_pdef, :base_pdef
alias_method :kn_game_enemy_base_mdef, :base_mdef
alias_method :kn_game_enemy_base_eva, :base_eva
# Alias Method for Gold, Exp and Drops
alias_method :kn_game_enemy_exp, :exp
alias_method :kn_game_enemy_gold, :gold
#NOTE: alias overwrites origional initialize, pops up error
# when alias_method, so this is temporarily commented out.
#------------------------
# * Initialization Method
#------------------------
#def initialize(troop_id, member_index) #<--Included in origional method.
#kn_game_enemy_initialize
#
#end
#--------------------------------------------------------------------------
# * Object Initialization
# troop_id : troop ID
# member_index : troop member index
#--------------------------------------------------------------------------
def initialize(troop_id, member_index)
super()
# Super's variables
@troop_id = troop_id
@member_index = member_index
# Troop Data
troop = $data_troops[@troop_id]
@enemy_id = troop.members[@member_index].enemy_id
enemy = $data_enemies[@enemy_id]
# KN: Added average_level to initialize
@avg_level = average_level
@battler_name = enemy.battler_name
@battler_hue = enemy.battler_hue
@hp = maxhp
@sp = maxsp
@hidden = troop.members[@member_index].hidden
@immortal = troop.members[@member_index].immortal
end
#---------------------------------
# * Get Game_Party's Average Level
#---------------------------------
def average_level
avg = 0
$game_party.actors.each {|actor| avg += actor.level }
return avg / $game_party.actors.size
end
#-----------------------
# * Define Average MaxHP
#-----------------------
def base_maxhp
return kn_game_enemy_base_maxhp + (100 * @avg_level).to_i
end
#-----------------------
# * Define Average MaxSP
#-----------------------
def base_maxsp
return kn_game_enemy_base_maxsp + (10 * @avg_level).to_i
end
#-----------------------
# * Define Average Str
#-----------------------
def base_str
return kn_game_enemy_base_str + (1 * @avg_level).to_i
end
#---------------------
# * Define Average Dex
#---------------------
def base_dex
return kn_game_enemy_base_dex + (1 * @avg_level).to_i
end
#---------------------
# * Define Average Agi
#---------------------
def base_agi
return kn_game_enemy_base_agi + (1 * @avg_level).to_i
end
#---------------------
# * Define Average Int
#---------------------
def base_int
return kn_game_enemy_base_int + (1 * @avg_level).to_i
end
#---------------------
# * Define Average Atk
#---------------------
def base_atk
return kn_game_enemy_base_atk + (1 * @avg_level).to_i
end
#---------------------
# * Define Average PDef
#---------------------
def base_pdef
return kn_game_enemy_base_pdef + (1 * @avg_level).to_i
end
#---------------------
# * Define Average MDef
#---------------------
def base_mdef
return kn_game_enemy_base_mdef + (1 * @avg_level).to_i
end
#---------------------
# * Define Average Eva
#---------------------
def base_eva
return kn_game_enemy_base_eva + (1 * @avg_level).to_i
end
#------------------
# * Def Average Exp
#------------------
def exp
return kn_game_enemy_exp + (1 * @avg_level).to_i
end
#-------------------
# * Def Average Gold
#-------------------
def gold
return kn_game_enemy_gold + (1 * @avg_level).to_i
end
end