Enemy Class

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English



This script allows you to set up enemies the same way actors are set up using classes. 


An enemy's parameters are determined by their level, which is determined by the class parameter curves. You can set up your enemies strengths and weaknesses using its assigned class.





An enemy's available actions are also determined by their class. In order to be able to use an action, they must have met the learning requirements for the class.





Get it at Hime Works!
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Does this mean enemies have levels? How do you specify that?
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Using the enemy level script linked in the download.


I have not tested whether it is compatible with other enemy level scripts.
 
Last edited by a moderator:

kerbonklin

Hiatus King
Veteran
Joined
Jan 6, 2013
Messages
1,726
Reaction score
275
First Language
English
Primarily Uses
RMMV
This is definitely very interesting for those making TBS games.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
The enemy parameter and class parameter should merged each other

For example, I have an Giant Spider and Mutated Ant. Their class are Insect. Has same features and same weakness.

Mutated Ant has 10 HP more than Giant Spider.

Well, that's just my humbe opinion.
 

ShinGamix

DS Style 4Ever!
Veteran
Joined
Mar 18, 2012
Messages
3,905
Reaction score
451
First Language
April Fools
Primarily Uses
N/A
Tsukihime the way you are going you might as well make a whole enemy database system. LOL! 

(Which I would love!)

I am definitely using your enemy scripts.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
I tried getting yanfly's enemy levels script to be compatible but yanfly's doing more than just determining an enemy level. Not only does it determine the enemy's level, it's also determining all of the parameters based on the level, which does not appear to be compatible with a class implementation of parameter growth.


If anyone can think of a way to make it compatible (either by taking out a bunch of stuff or figuring out a configuration to do it) I would be open for suggestions, but for the most part I don't see it doing anything that a class can't do.

The enemy parameter and class parameter should merged each other


For example, I have an Giant Spider and Mutated Ant. Their class are Insect. Has same features and same weakness.


Mutated Ant has 10 HP more than Giant Spider.


Well, that's just my humbe opinion.
I've added that as an option


 
Last edited by a moderator:

ShinGamix

DS Style 4Ever!
Veteran
Joined
Mar 18, 2012
Messages
3,905
Reaction score
451
First Language
April Fools
Primarily Uses
N/A
Does this mean enemies can level up?

What if I wanted the same group of slimes to be fought throughout the whole game and level up during those times?
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Does this mean enemies can level up?


What if I wanted the same group of slimes to be fought throughout the whole game and level up during those times?
If you are using my enemy level script to provide the level, the level is determined by a formula so you can just use a variable as the level.
 
Last edited by a moderator:

Sidbot

Villager
Member
Joined
Oct 16, 2012
Messages
21
Reaction score
4
Primarily Uses
Personally, this looks like it can save a LOT of time if making variations on one type of enemy. Thanks!
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
This script is compatible with yanfly's enemy levels script now.
 

Fernyfer775

Veteran
Veteran
Joined
Oct 6, 2013
Messages
1,317
Reaction score
818
First Language
English
Hello! So, I was using a previous version of your script and it was working perfectly, but after updating to your most recent one, now get this error:

Error.png

If I don't give an enemy a class, this occurs, whereas it didn't before.

I would just go with it and add classes to each of my enemies, but then it maxes out my stats to the default database stats (9999 hp for bosses, etc). Please help! 

Here are both the Scripts

Yanfly Enemy Levels

#==============================================================================#
# ▼ Yanfly Engine Ace - Enemy Levels v1.02
# -- Last Updated: 2012.01.26
# -- Level: Normal, Hard
# -- Requires: n/a
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YEA-EnemyLevels"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.01.26 - Bug Fixed: Duplication of stat growth rates per enemy.
# 2012.01.24 - Added notetag for enemies.
# - Option to change Party Level function in Action Conditions to
# enemy level requirements.
# 2011.12.30 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# RPG's with enemies that level up with the party enforces the player to stay
# on their toes the whole time. This is both a good and bad thing as it can
# cause the player to stay alert, but can also cause the player to meet some
# roadblocks. This script will not only provide enemies the ability to level up
# but also allow the script's user to go around these roadblocks using various
# tags to limit or slow down the rate of growth across all enemies.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Skill Notetags - These notetags go in the skill notebox in the database.
# -----------------------------------------------------------------------------
#
#
# This causes the enemy to raise or drop x levels depending on the tag used.
# The new level will readjust the enemy's stats (including HP and MP).
#
#
# This resets the enemy's level back to the typical range it should be plus or
# minus any level fluctuations it was given. This occurs before enemy level +
# and enemy level - tags.
#
# -----------------------------------------------------------------------------
# Enemy Notetags - These notetags go in the enemies notebox in the database.
# -----------------------------------------------------------------------------
#
# This notetag will hide the level of the enemy. If YEA - Enemy Target Info is
# installed, the level will be revealed upon a parameter scan.
#
#
#
# This will adjust the minimum and maximum levels for the enemy. By default,
# the minimum level is 1 and the maximum level is whatever is set in the module
# as MAX_LEVEL.
#
#
# This will set the enemy's level to exactly x. It a sense, this is just the
# usage of both the min and max level tags together as the same value.
#
#
# Choosing a value from 0 to 4, you can adjust the different leveling rulesets
# for the enemy. See the list below.
# Type 0 - Lowest level of all actors that have joined.
# Type 1 - Lowest level in the battle party.
# Type 2 - Average level of the battle party.
# Type 3 - Highest level of the battle party.
# Type 4 - Highest level of all actors that have joined.
#
#
# This will give the level a random flunctuation in either direction. Set this
# value to 0 if you don't wish to use it. Adjust RANDOM_FLUCTUATION inside the
# module to change the default fluctuation value.
#
#
#
#
#
# This will raise or lower the stat by x or x% per level (depending on the tag
# used). This will override the default growth settings found inside the module
# hash called DEFAULT_GROWTH. You may replace stat with:
# MAXHP, MAXMP, ATK, DEF, MAT, MDF, AGI, LUK, GOLD, EXP
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================

module YEA
module ENEMY_LEVEL

#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - General Level Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These settings adjust the general level setup for your enemies from the
# way levels appear in the game to the default maximum level for enemies,
# to the way their levels are calculated by default, and the random level
# fluctuation they have. If you want enemies to have different settings,
# use notetags to change the respective setting.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# This is how the level text will appear whenever enemy levels are shown.
LEVEL_TEXT = "LV%s %s"

# This is the maximum level your enemies can achieve. They cannot go higher
# no exceptions. Adjust this accordingly to fit your game.
MAX_LEVEL = 75

# Default level calculations for your enemies will be adjusted as such.
# Type 0 - Lowest level of all actors that have joined.
# Type 1 - Lowest level in the battle party.
# Type 2 - Average level of the battle party.
# Type 3 - Highest level of the battle party.
# Type 4 - Highest level of all actors that have joined.
DEFAULT_LEVEL_TYPE = 2

# If you want your enemies to have random +/- levels of some degree, change
# this number to something other than 0. This is the default value.
RANDOM_FLUCTUATION = 3

#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Parameter Growth Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Here, you adjust how much stats grow for enemies by default, including
# the formula used to calculate those stats. If you wish for enemies to
# have different growth settings, use notetags to change them.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These settings adjust the default growth rates (not the base stat formula)
# for each stat. These are the values that will exist for each enemy unless
# defined otherwise by the tags inside their noteboxes.
DEFAULT_GROWTH ={
# ParamID => [:param, per%, +set],
0 => [:maxhp, 0.045, 30],
1 => [:maxmp, 0.05, 30],
2 => [ :atk, 0.028, 2],
3 => [ :def, 0.018, 1],
4 => [ :mat, 0.028, 2],
5 => [ :mdf, 0.018, 1],
6 => [ :agi, 0.025, 2],
7 => [ :luk, 0.025, 2],
8 => [ :gold, 0.05, 6],
9 => [ :exp, 0.04, 16],
} # Do not remove this.

# The following hash will adjust each of the formulas for each base stat.
# Adjust them as you see fit but only if you know what you're doing.
# base - The base stat from the enemy database.
# per - Growth rate which has not been yet converted to a percent.
# set - Set growth rate. Modified
# Default: "base * (1.00 + (level-1) * per) + (set * (level-1))"
STAT_FORMULA = "base * (1.00 + (level-1) * per) + (set * (level-1))"

#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Party Level to Enemy Level Action Conditions -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Setting the below to true will cause the Party Level requirement under
# Action Conditions in the Action Patterns list to become an Enemy Level
# requirement. The enemy must be at least the level or else it cannot use
# the listed action.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
PARTY_LEVEL_TO_ENEMY_LEVEL = true

end # ENEMY_LEVEL
end # YEA

#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================

module YEA
module REGEXP
module USABLEITEM

LEVEL_CHANGE = /<(?:ENEMY LEVEL|enemy level):[ ]([\+\-]\d+)>/i
LEVEL_RESET = /<(?:ENEMY LEVEL RESET|enemy level reset)>/i

end # USABLEITEM
module ENEMY

LEVEL_TYPE = /<(?:LEVEL_TYPE|level type):[ ](\d+)>/i
LEVEL_MIN = /<(?:MIN_LEVEL|min level|minimum level):[ ](\d+)>/i
LEVEL_MAX = /<(?:MAX_LEVEL|max level|maximum level):[ ](\d+)>/i
LEVEL_SET = /<(?:SET_LEVEL|set level|permanent level):[ ](\d+)>/i

LEVEL_RAND = /<(?:LEVEL_RANDOM|level random):[ ](\d+)>/i
GROWTH_PER = /<(.*):[ ]([\+\-]\d+)([%%])[ ](?:pER_LEVEL|per level)>/i
GROWTH_SET = /<(.*):[ ]([\+\-]\d+)[ ](?:pER_LEVEL|per level)>/i

HIDE_LEVEL = /<(?:HIDE_LEVEL|hide level)>/i

end # ENEMY
end # REGEXP
end # YEA

#==============================================================================
# ■ Numeric
#==============================================================================

class Numeric

#--------------------------------------------------------------------------
# new method: group_digits
#--------------------------------------------------------------------------
unless $imported["YEA-CoreEngine"]
def group; return self.to_s; end
end # $imported["YEA-CoreEngine"]

end # Numeric

#==============================================================================
# ■ DataManager
#==============================================================================

module DataManager

#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class < def self.load_database
load_database_elv
load_notetags_elv
end

#--------------------------------------------------------------------------
# new method: load_notetags_elv
#--------------------------------------------------------------------------
def self.load_notetags_elv
groups = [$data_enemies, $data_skills, $data_items]
for group in groups
for obj in group
next if obj.nil?
obj.load_notetags_elv
end
end
end

end # DataManager

#==============================================================================
# ■ RPG::UsableItem
#==============================================================================

class RPG::UsableItem < RPG::BaseItem

#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :level_change
attr_accessor :level_reset

#--------------------------------------------------------------------------
# common cache: load_notetags_elv
#--------------------------------------------------------------------------
def load_notetags_elv
@level_change = 0
@level_reset = false
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::USABLEITEM::LEVEL_CHANGE
@level_change = $1.to_i
when YEA::REGEXP::USABLEITEM::LEVEL_RESET
@level_reset = true
end
} # self.note.split
#---
end

end # RPG::UsableItem

#==============================================================================
# ■ RPG::Enemy
#==============================================================================

class RPG::Enemy < RPG::BaseItem

#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :hide_level
attr_accessor :level_type
attr_accessor :level_min
attr_accessor :level_max
attr_accessor :level_rand
attr_accessor :level_growth

#--------------------------------------------------------------------------
# common cache: load_notetags_elv
#--------------------------------------------------------------------------
def load_notetags_elv
@hide_level = true
@level_type = YEA::ENEMY_LEVEL::DEFAULT_LEVEL_TYPE
@level_min = 1
@level_max = YEA::ENEMY_LEVEL::MAX_LEVEL
@level_rand = YEA::ENEMY_LEVEL::RANDOM_FLUCTUATION
@level_growth = Marshal.load(Marshal.dump(YEA::ENEMY_LEVEL::DEFAULT_GROWTH))
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::ENEMY::HIDE_LEVEL
@hide_level = true
when YEA::REGEXP::ENEMY::LEVEL_TYPE
@level_type = $1.to_i
when YEA::REGEXP::ENEMY::LEVEL_MIN
@level_min = [$1.to_i, 1].max
when YEA::REGEXP::ENEMY::LEVEL_MAX
@level_max = [$1.to_i, YEA::ENEMY_LEVEL::MAX_LEVEL].min
when YEA::REGEXP::ENEMY::LEVEL_SET
@level_min = [[$1.to_i, 1].max, YEA::ENEMY_LEVEL::MAX_LEVEL].min
@level_max = [[$1.to_i, 1].max, YEA::ENEMY_LEVEL::MAX_LEVEL].min
when YEA::REGEXP::ENEMY::LEVEL_RAND
@level_rand = $1.to_i
#---
when YEA::REGEXP::ENEMY::GROWTH_PER
case $1.upcase
when "MAXHP", "MHP", "HP"
type = 0
when "MAXMP", "MMP", "MP", "MAXSP", "MSP", "SP"
type = 1
when "ATK", "ATTACK"
type = 2
when "DEF", "DEFENSE"
type = 3
when "MAT", "MAGIC ATTACK", "INT", "INTELLIGENCE", "SPI", "SPIRIT"
type = 4
when "MDF", "MAGIC DEFENSE", "RES", "RESISTANCE"
type = 5
when "AGI", "AGILITY"
type = 6
when "LUK", "LUCK"
type = 7
when "GOLD", "MONEY"
type = 8
when "EXP", "EXPERIENCE", "XP"
type = 9
else; next
end
@level_growth[type][1] = $2.to_i * 0.01
when YEA::REGEXP::ENEMY::GROWTH_SET
case $1.upcase
when "MAXHP", "MHP", "HP"
type = 0
when "MAXMP", "MMP", "MP", "MAXSP", "MSP", "SP"
type = 1
when "ATK", "ATTACK"
type = 2
when "DEF", "DEFENSE"
type = 3
when "MAT", "MAGIC ATTACK", "INT", "INTELLIGENCE", "SPI", "SPIRIT"
type = 4
when "MDF", "MAGIC DEFENSE", "RES", "RESISTANCE"
type = 5
when "AGI", "AGILITY"
type = 6
when "LUK", "LUCK"
type = 7
when "GOLD", "MONEY"
type = 8
when "EXP", "EXPERIENCE", "XP"
type = 9
else; next
end
@level_growth[type][2] = $2.to_i
end
} # self.note.split
#---
end

end # RPG::Enemy

#==============================================================================
# ■ Game_Battler
#==============================================================================

class Game_Battler < Game_BattlerBase

#--------------------------------------------------------------------------
# alias method: item_user_effect
#--------------------------------------------------------------------------
alias game_battler_item_user_effect_elv item_user_effect
def item_user_effect(user, item)
game_battler_item_user_effect_elv(user, item)
apply_level_changes(item) if self.is_a?(Game_Enemy)
end

end # Game_Battler

#==============================================================================
# ■ Game_Enemy
#==============================================================================

class Game_Enemy < Game_Battler

#--------------------------------------------------------------------------
# alias method: initialize
#--------------------------------------------------------------------------
alias game_enemy_initialize_elv initialize
def initialize(index, enemy_id)
game_enemy_initialize_elv(index, enemy_id)
create_init_level
end

#--------------------------------------------------------------------------
# new method: level
#--------------------------------------------------------------------------
def level
create_init_level if @level.nil?
return @level
end

#--------------------------------------------------------------------------
# new method: level=
#--------------------------------------------------------------------------
def level=(value)
create_init_level if @level.nil?
return if @level == value
hp_rate = self.hp.to_f / self.mhp.to_f
mp_rate = self.mp.to_f / [self.mmp, 1].max.to_f
@level = [[value, 1].max, YEA::ENEMY_LEVEL::MAX_LEVEL].min
self.hp = (self.mhp * hp_rate).to_i
self.mp = (self.mmp * mp_rate).to_i
end

#--------------------------------------------------------------------------
# new method: create_init_level
#--------------------------------------------------------------------------
def create_init_level
set_level_type
@hp = mhp
@mp = mmp
end

#--------------------------------------------------------------------------
# new method: set_level_type
#--------------------------------------------------------------------------
def set_level_type
@level = $game_party.match_party_level(enemy.level_type)
@level += rand(enemy.level_rand+1)
@level -= rand(enemy.level_rand+1)
@level = [[@level, enemy.level_max].min, enemy.level_min].max
end

#--------------------------------------------------------------------------
# alias method: transform
#--------------------------------------------------------------------------
alias game_enemy_transform_elv transform
def transform(enemy_id)
game_enemy_transform_elv(enemy_id)
create_init_level
end

#--------------------------------------------------------------------------
# new method: apply_level_changes
#--------------------------------------------------------------------------
def apply_level_changes(item)
create_init_level if item.level_reset
self.level += item.level_change
end

#--------------------------------------------------------------------------
# alias method: param_base
#--------------------------------------------------------------------------
alias game_enemy_param_base_elv param_base
def param_base(param_id)
base = game_enemy_param_base_elv(param_id)
per = enemy.level_growth[param_id][1]
set = enemy.level_growth[param_id][2]
total = eval(YEA::ENEMY_LEVEL::STAT_FORMULA)
return total.to_i
end

#--------------------------------------------------------------------------
# alias method: exp
#--------------------------------------------------------------------------
alias game_enemy_exp_elv exp
def exp
base = game_enemy_exp_elv
per = enemy.level_growth[8][1]
set = enemy.level_growth[8][2]
total = eval(YEA::ENEMY_LEVEL::STAT_FORMULA)
return total.to_i
end

#--------------------------------------------------------------------------
# alias method: gold
#--------------------------------------------------------------------------
alias game_enemy_gold_elv gold
def gold
base = game_enemy_gold_elv
per = enemy.level_growth[9][1]
set = enemy.level_growth[9][2]
total = eval(YEA::ENEMY_LEVEL::STAT_FORMULA)
return total.to_i
end

#--------------------------------------------------------------------------
# alias method: name
#--------------------------------------------------------------------------
alias game_enemy_name_elv name
def name
text = game_enemy_name_elv
if add_level_name?
fmt = YEA::ENEMY_LEVEL::LEVEL_TEXT
text = sprintf(fmt, @level.group, text)
end
return text
end

#--------------------------------------------------------------------------
# new method: add_level_name?
#--------------------------------------------------------------------------
def add_level_name?
if $imported["YEA-EnemyTargetInfo"] && show_info_param?
return true
end
return false if enemy.hide_level
return true
end

#--------------------------------------------------------------------------
# overwrite method: conditions_met_party_level?
#--------------------------------------------------------------------------
if YEA::ENEMY_LEVEL::pARTY_LEVEL_TO_ENEMY_LEVEL
def conditions_met_party_level?(param1, param2)
return @level >= param1
end
end

end # Game_Enemy

#==============================================================================
# ■ Game_Party
#==============================================================================

class Game_Party < Game_Unit

#--------------------------------------------------------------------------
# new method: match_party_level
#--------------------------------------------------------------------------
def match_party_level(level_type)
case level_type
when 0; return all_lowest_level
when 1; return lowest_level
when 2; return average_level
when 3; return highest_level
else; return all_highest_level
end
end

#--------------------------------------------------------------------------
# new method: all_lowest_level
#--------------------------------------------------------------------------
def all_lowest_level
lv = all_members.collect {|actor| actor.level }.min
return lv
end

#--------------------------------------------------------------------------
# new method: lowest_level
#--------------------------------------------------------------------------
def lowest_level
lv = members.collect {|actor| actor.level }.min
return lv
end

#--------------------------------------------------------------------------
# new method: average_level
#--------------------------------------------------------------------------
def average_level
lv = 0
for member in all_members; lv += member.level; end
lv /= all_members.size
return lv
end

#--------------------------------------------------------------------------
# overwrite method: highest_level
#--------------------------------------------------------------------------
def highest_level
lv = members.collect {|actor| actor.level }.max
return lv
end

#--------------------------------------------------------------------------
# all method: all_highest_level
#--------------------------------------------------------------------------
def all_highest_level
lv = all_members.collect {|actor| actor.level }.max
return lv
end

end # Game_Party

#==============================================================================
#
# ▼ End of File
#
#==============================================================================
 
Your Enemy Class Script I just pasted. (Your previous version worked fine and I totally wouldn't mind going back to it if you still had it laying around somewhere!)

=begin
#===============================================================================
Title: Enemy Class
Author: Hime
Date: Mar 17, 2014
--------------------------------------------------------------------------------
** Change log
Mar 17, 2014
- added class features to the list of feature objects
Nov 24, 2013
- compatible with Yanfly's enemy levels
Nov 16, 2013
- fixed missing argument to original param_base
- initial release
--------------------------------------------------------------------------------
** Terms of Use
* Free to use in non-commercial projects
* Contact me for commercial use
* No real support. The script is provided as-is
* Will do bug fixes, but no compatibility patches
* Features may be requested but no guarantees, especially if it is non-trivial
* Credits to Hime Works in your project
* Preserve this header
--------------------------------------------------------------------------------
** Description

This script allows you to set up enemies the same way actors are set up using
classes.

An enemy's parameters are determined by their level, which is determined by
the class parameter curves. You can set up your enemies strengths and
weaknesses using its assigned class.

An enemy's available actions are also determined by their class. In order to
be able to use an action, they must have met the learning requirements for
the class.

--------------------------------------------------------------------------------
** Required

An enemy level script, such as

Core - Enemy Levels
(http://himeworks.wordpress.com/2013/11/16/enemy-levels/)

Yanfly Enemy Levels
(http://yanflychannel.wordpress.com/rmvxa/gameplay-scripts/enemy-levels/)

Or any other script that provides enemy levels.

--------------------------------------------------------------------------------
** Installation

Place this script below Core - Enemy Levels and above Main

--------------------------------------------------------------------------------
** Usage

To assign a class to an enemy, note-tag the enemy with



Where x is the ID of the class.

If no class is assigned, then the enemy will simply use its own parameters
and actions: none of the class-related functionality will be applied.

-- Changing classes --

You can change an enemy's class using script calls.

change_enemy_class(index, class_id)

Where the index is the index of the enemy in the current troop, and the
class_id is the ID of the class you want to change it to.

#===============================================================================
=end
$imported = {} if $imported.nil?
$imported["TH_EnemyClass"] = true
#==============================================================================
# ** Configuration
#==============================================================================
module TH
module Enemy_Class

Regex = //i
end
end
#==============================================================================
# ** Rest of Script
#==============================================================================
module RPG
class Enemy < BaseItem

def class_id
load_notetag_enemy_class unless @class_id
return @class_id
end

def load_notetag_enemy_class
@class_id = 0
if self.note =~ TH::Enemy_Class::Regex
@class_id = $1.to_i
end
end
end
end

class Game_Enemy < Game_Battler

alias :th_enemy_class_initialize :initialize
def initialize(index, enemy_id)
@enemy_id = enemy_id
setup_class(enemy_id)
th_enemy_class_initialize(index, enemy_id)
@hp = mhp
@mp = mmp
end

#-----------------------------------------------------------------------------
# Add the class to the list of feature objects
#-----------------------------------------------------------------------------
alias :th_enemy_class_features_objects :feature_objects
def feature_objects
th_enemy_class_features_objects + [self.class]
end

#-----------------------------------------------------------------------------
# New.
#-----------------------------------------------------------------------------
def setup_class(enemy_id)
@class_id = enemy.class_id
end

#-----------------------------------------------------------------------------
# New.
#-----------------------------------------------------------------------------
def class
$data_classes[@class_id]
end

#-----------------------------------------------------------------------------
# New.
#-----------------------------------------------------------------------------
def change_class(class_id)
@class_id = class_id
end

alias :th_enemy_class_param_base :param_base
def param_base(param_id)
cls = self.class
if cls
self.class.params[param_id, self.level]
else
th_enemy_class_param_base(param_id)
end
end

alias :th_enemy_class_action_valid? :action_valid?
def action_valid?(action)
class_condition_met?(action) && th_enemy_class_action_valid?(action)
end

#-----------------------------------------------------------------------------
# New. If an enemy has a class assigned, then we check if there is a learning
# requirement for the specified action. If no class or learning is available,
# then assume it is valid.
#-----------------------------------------------------------------------------
def class_condition_met?(action)
cls = self.class
return true unless cls
learning = cls.learnings.detect {|learning| learning.skill_id == action.skill_id }
return true unless learning
return false if self.level < learning.level
return true
end
end

class Game_Interpreter

def get_enemy(index)
$game_troop.members[index-1]
end

def change_enemy_class(index, class_id)
enemy = get_enemy(index)
enemy.change_class(class_id)
end
end
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,081
Members
137,582
Latest member
Spartacraft
Top