Enemy Levels (YEP)

From Yanfly.moe Wiki
Jump to navigation Jump to search


System

This is a plugin created for RPG Maker MV.

For help on how to install plugins, click here.

For help on how to update plugins, click here.

Got errors with your RPG Maker MV plugin? Click here.

Download

Extension Plugins

The following plugins are Extension Plugins that require this plugin as its Parent Plugin.

Place the following plugins below this plugin located in the Plugin Manager if you plan on using them.

Yanfly Engine Plugins

This plugin is a part of the Yanfly Engine Plugins library.

Click here if you want to help support Team Yanfly on Patreon.

Introduction

This plugin allows enemies to function off of a leveling system. An enemy's
level will be increased relative to the player under specific rulings and
will increase its stats based on its level.

Default Level Types

When an enemy is made in battle, it will create its initial level off of a
set of rules. These are the various rules you can change the 'Default Type'
plugin parameter to reflect.

Type:

- Type 0 - Lowest level of all actors that have joined the player party.
- Type 1 - Lowest level of all actors that are in the battling party.
- Type 2 - Average level of all actors that have joined the player party.
- Type 3 - Average level of all actors that are in the battling party.
- Type 4 - Highest level of all actors that have joined the player party.
- Type 5 - Highest level of all actors that are in the battling party.

After the level type has been determined for the enemy, random level
fluctuations are then added.

Notetags

NotetagsMV.png

RPG Maker MV's editor is unable to allow for custom traits/properties that a game dev may wish to associate with a database object, event, map, etc. Notetags are used to work around such limitations by allowing the game dev to tag certain traits/properties using specific Notetags declared by the related plugin.

Here is a list of Notetag(s) that you may use.

You can use these notetags to adjust how enemy levels are handled
individually per enemy.

Enemy Notetags:

  <Show Level>
  <Hide Level>
  This will cause the enemy to show or hide its level upon target selection.

  <Minimum Level: x>
  <Maximum Level: x>
  This sets the enemy's minimum and maximum levels respectively to x. This
  will cause the enemy, upon the start of battle, to adjust levels within
  this particular range. Any skills that alter enemy levels are able to
  bypass these limits unless if it were to bypass the maximum cap.

  <Static Level: x>
  This sets the enemy's starting level to exactly x. This will cause the
  enemy, upon the start of battle, to adjust levels within this particular
  range. Any skills that alter enemy levels are able to bypass these limits
  unless if it were to bypass the maximum cap.

  <Starting Level Type: x>
  This sets the enemy's starting level type to x from 0 to 5. Refer to the
  'Default Level Types' party of the Help File.

  <Positive Level Fluctuation: x>
  <Negative Level Fluctuation: x>
  This sets the positive/negative level fluctuation for the enemy. Any level
  fluctuation is calculated at the start of battle, but after the starting
  level type has been determined.

  <Level Fluctuation: x>
  This sets both the positive and negative level fluctuation for the enemy
  to x. Any level fluctuation is calculated at the start of battle, but
  after the starting level type has been determined.

  <stat Rate: +x% per level>
  <stat Rate: -x% per level>
  <stat Rate: +x.y per level>
  <stat Rate: -x.y per level>
  Replace 'stat' with 'maxhp', 'maxmp', 'atk', 'def', 'mat', 'mdf', 'agi',
  'luk', 'exp', or 'gold'. This will set this enemy to have an increase or
  decrease of x% rate per level. If you use the x.y formula, it will have a
  rate increase of +x.y or -x.y per level.

  <stat Flat: +x per level>
  <stat Flat: -x per level>
  <stat Flat: +x.y per level>
  <stat Flat: -x.y per level>
  Replace 'stat' with 'maxhp', 'maxmp', 'atk', 'def', 'mat', 'mdf', 'agi',
  'luk', 'exp', or 'gold'. This will set this enemy to have an increase or
  decrease of flat x value per level. If you use the x.y formula, it will
  have a flat increase of +x.y or -x.y per level.

  <Resist Level Change>
  This will cause the enemy to be immune to any form of level changing
  through skills and items. However, the enemy is not immune to any level
  changing through script calls.

  <Skill x Require Level: y>
  <Skill name Require Level: y>
  If this enemy is to use skill x (or named skill), it must be at least
  level y to be able to use it. If the enemy is under level y, the skill
  will be sealed and cannot be used.

  <Ignore Level Bonus>
  This will cause the enemy to ignore all the stat changes added by levels
  and use its base stats as its current level stats. Any changes to its
  current level will not alter the enemy's stats.

Skill and Item Notetags:

  <Reset Enemy Level>
  This will reset the target enemy's level back to what it was at the start
  of battle.

  <Change Enemy Level: +x>
  <Change Enemy Level: -x>
  If this action is used against an enemy, it will change the enemy's level
  by +x or -x. If an action contains both a reset and level change, the
  reset will occur first before the level change.

Lunatic Mode

JavaScript.png

For advanced users who have an understanding of JavaScript, you can use the following features added by the plugin to further enhance what you can do with your game project.

Custom Starting Level

For those with JavaScript experience, you can have enemies have conditional
starting levels. Place these Lunatic Mode notetags into the enemy notebox:

Enemy Notetags:

  <Custom Starting Level>
   level = $gameActors.actor(1).level + 5;
  </Custom Starting Level>
  The 'level' variable will become the enemy's starting level. This level is
  still affected by the enemy's minimum and maximum starting level barriers.
  After the starting levels are decided, it will still be affected by the
  random level fluctuation.

Custom Parameter Formulas

For those with JavaScript experience, you can have different formulas for
the ways parameters are calculated in regards to the enemy's level. Use the
notetags below:

Enemy Notetags:

  <Custom Parameter stat Formula>
   base * (1 + (level - 1) * rate) + (flat * (level - 1))
  </Custom Parameter stat Formula>
  Replace 'stat' with 'maxhp', 'maxmp', 'atk', 'def', 'mat', 'mdf', 'agi',
  'luk', 'exp', or 'gold'. Whatever is calculated for the formula on the
  last line will become the parameter value for the stat.

Custom Change Enemy Level

For those with JavaScript experience and would like to have more dynamic
ways of altering enemy levels instead of flat values, you can use these
notetags to do so:

Skill and Item Notetags:

  <Custom Change Enemy Level>
   level += user.atk;
   level -= target.agi;
  </Custom Change Enemy Level>
  The 'level' variable will be the enemy's current level. Any changes made
  to the 'level' variable will be what the enemy's level will become after
  this effect finishes taking place. If the skill has a reset level effect,
  it is applied first. If the skill has a flat level changing effect, that
  effect is applied next. After those two effects are applied, this custom
  enemy level change will take place.

Script Calls

ScriptCallsMV.png

Script Calls are event commands that are used to run JavaScript code during an event to call upon unique functions, usually added by the related plugin.

Here is a list of Script Call(s) that you may use:

Here are some new JavaScript functions that have been added by this plugin.

enemy.level
- This will return the enemy's current level.

enemy.originalLevel()
- This will return the enemy's original level from the start of battle.

enemy.changeLevel(x)
- This will change the enemy's level to x.

enemy.gainLevel(x)
- This will cause the enemy to gain x levels.

enemy.loseLevel(x)
- This will cause the enemy to lose x levels.

enemy.resetLevel()
- Changes the enemy's level back to what it was at the start of battle.

$gameParty.lowestLevelAllMembers()
- This will return the lowest level of all party members.

$gameParty.lowestLevelBattleMembers()
- This will return the lowest level of all battle members.

$gameParty.averageLevelAllMembers()
- This will return the average level of all party members.

$gameParty.averageLevelBattleMembers()
- This will return the average level of all battle members.

$gameParty.highestLevelAllMembers()
- This will return the highest level of all party members.

$gameParty.highestLevelBattleMembers()
- This will return the highest level of all battle members.

$gameTroop.changeLevel(x)
- Changes the levels of all enemies to x.

$gameTroop.gainLevel(x)
- Raises the levels of all enemies by x.

$gameTroop.loseLevel(x)
- Lowers the levels of all enemies by x.

$gameTroop.resetLevel()
- Resets the levels of all enemies to their original levels at battle start.

$gameTroop.lowestLevel()
- This will return the lowest level of the enemy party.

$gameTroop.averageLevel()
- This will return the lowest level of the enemy party.

$gameTroop.highestLevel()
- This will return the lowest level of the enemy party.

Plugin Commands

PluginCommandsMV.png

Plugin Commands are event commands that are used to call upon functions added by a plugin that aren't inherently a part of RPG Maker MV.

Here is a list of Plugin Command(s) that you may use:

If you wish to change enemy levels through plugin commands, you can use the
following plugin commands to alter them. These plugin commands are only used
inside battle.

Plugin Command:

  EnemyLevelChange 2 to 50
  - This will reset the enemy in position 2's level to 50.

  EnemyLevelChangeAll 50
  - This will change the levels of all enemies to 50.

  EnemyGainLevel 3 by 20
  - This will cause the enemy in positon 3 to gain 20 levels.

  EnemyGainLevelAll 20
  - This will cause all enemies to gain 20 levels.

  EnemyLoseLevel 4 by 10
  - This will cause the enemy in positon 4 to lose 10 levels.

  EnemyLoseLevelAll 10
  - This will cause all enemies to lose 10 levels.

  EnemyLevelReset 5
  - This will reset the enemy in position 5's level to the level it had at
  the start of battle.

  EnemyLevelResetAll
  - This will reset all enemy levels to their original levels.

Changelog

Version 1.09:
- Bypass the isDevToolsOpen() error when bad code is inserted into a script
call or custom Lunatic Mode code segment due to updating to MV 1.6.1.

Version 1.08:
- Updated for RPG Maker MV version 1.5.0.

Version 1.07:
- Enemy Transform event now adjusts for stat changes when transforming into
a different enemy.

Version 1.06:
- Lunatic Mode fail safes added.

Version 1.05:
- Updated the custom level formula to have the formulas 'b', 'r', and 'f' to
be able to use the formulas from FlyingDream's calculator.

Version 1.04:
- Updated for RPG Maker MV version 1.1.0.

Version 1.03:
- Fixed a bug with average level calculation types for enemies.

Version 1.02:
- Fixed a bug regarding a line of code that wasn't added properly.

Version 1.01:
- Added <Ignore Level Bonus> notetag. This causes enemies to maintain their
current level but ignore any bonus stats applied by the level difference. If
the enemy's level is altered, its stats remain static and unchanging.

Version 1.00:
- Finished Plugin!