Battle System - ATB (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

Support Discontinued

Support for this plugin has been discontinued by Yanfly. The plugin will still run and work properly, but it may or may not necessarily work with everything else found in the Yanfly Engine Plugins library.

For information on why it's been discontinued, read here.

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.

Required Plugins

The following plugins are required in order to use this plugin.

Place the following plugins above this plugin located in the Plugin Manager.

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

The Battle System - Active Turn Battle plugin is an extension plugin for
Yanfly Engine Plugins' Battle Engine Core. This extension plugin will not
work without the main plugin.

To use the ATB system, go to the Battle Engine Core plugin and change the
'Default System' setting in the parameters to 'atb'.

The Active Turn Battle system functions in such where battlers will have a
new gauge in battle functioning as their turn gauge. As time goes by without
anything happening such as actions, menu selection, etc, the gauge fills up.
Once it is full, the battler can commit to an action.

After committing to an action, the battler charges the skill before using it
in battle to either attack an enemy, heal an ally, etc. Upon finishing the
action, the gauge drains to empty and the battler must charge it up again.

This is a battle system where agility plays an important factor in the
progress of battle where higher agility values give battlers more advantage
and lower agility values give battlers less advantage.

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:

To change your battle system to Active Turn Battle if it isn't the default
battle system, you can use the following Plugin Command:

Plugin Command:
  setBattleSys ATB      Sets battle system to Active Turn Battle.
  setBattleSys DTB      Sets battle system to Default Turn Battle.

Using the above Plugin Commands, you can toggle between the Default Battle
System and Active Turn Battle!

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.

The following are notetags that pertain to and affect the ATB system.

Skill and Item Notetags:
  <ATB Help>
  text
  text
  </ATB Help>
  For those planning on using multiple battle systems, sometimes you may
  have your skills perform differently while using ATB. If so, using this
  notetag will allow skills and items to display different help text while
  ATB is enabled.

  <ATB Speed: x>
  <ATB Charge: x>
  <ATB Gauge: x>
  Usable only during ATB. This sets the target's current speed or charge to
  x. If 'speed' or 'charge' is used, it will only affect those gauges while
  in the respective phase. If 'gauge' is used, it will affect either.

  <ATB Speed: x%>
  <ATB Charge: x%>
  <ATB Gauge: x%>
  Usable only during ATB. This sets the target's current speed or charge to
  x% of the whole gauge. If 'speed' or 'charge' is used, it will only affect
  those gauges while in the respective phase. If 'gauge' is used, it will
  affect either.

  <ATB Speed: +x>   or   <ATB Speed: -x>
  <ATB Charge: +x>  or   <ATB Charge: -x>
  <ATB Gauge: +x>   or   <ATB Gauge: -x>
  Usable only during ATB. This increases or decreases the target's current
  speed or charge by x. If 'speed' or 'charge' is used, it will only affect
  those gauges while in the respective phase. If 'gauge' is used, it will
  affect either.

  <ATB Speed: +x%>   or   <ATB Speed: -x%>
  <ATB Charge: +x%>  or   <ATB Charge: -x%>
  <ATB Gauge: +x%>   or   <ATB Gauge: -x%>
  Usable only during ATB. This increases or decreases the target's current
  speed or charge by x% of the whole gauge. If 'speed' or 'charge' is used,
  it will only affect those gauges while in the respective phase. If 'gauge'
  is used, it will affect either.

  <After ATB: x>
  <After ATB: x%>
  This will set the skill/item user's ATB speed value to x or x%. If 'x' is
  used, this will be the exact ATB value. If x% is used, this will be the
  percentage of the ATB gauge that it will be at.

  <ATB Interrupt>
  <ATB Interrupt: x%>
  This will give the skill the ability to interrupt and cancel out the
  target's current action while it is in the charging phase. If the 'x%'
  notetag version is used, it will have a x% chance of success.

  <Cannot ATB Interrupt>
  This causes the skill to be unable to be interrupted and prevent the
  battler's ATB to reset.

Actor, Class, Enemy, Weapon, Armor, and State Notetags:
  <ATB Start: +x>
  <ATB Start: +x%>
  Usable only during ATB. This will give the actor, class, enemy, weapon,
  armor, or state the property of starting battle with X ATB Speed or X% of
  the ATB gauge filled up.

  <ATB Turn: +x>
  <ATB Turn: +x%>
  Usable only during ATB. This will give the actor, class, enemy, weapon,
  armor, or state the property of starting a turn with X ATB Speed or X% of
  the ATB gauge filled up.

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.

Conditional ATB Speed and Conditional ATB Charge
For those who have a bit of JavaScript experience and would like to have
more unique ways of performing ATB speed and charge changes, you can use the
following notetags:

Skill and Item Notetags:
  <Target ATB Eval>
  speed = x;
  charge = x;
  </Target ATB Eval>
  You can omit speed and/or charge. Whatever you set 'speed' to will change
  the ATB speed of the target. If the target is charging, 'charge' will
  cause the target's charge to change to that value. To make things more
  simple, 'max' will be the full gauge value.

  Here is an example:

  <Target ATB Eval>
  speed = target.hp / target.mhp * max;
  charge = target.hp / target.mhp * max;
  </Target ATB Eval>
  The above code will set the user's current ATB gauge to position equal to
  the target's HP ratio. If the target has 25% HP, the ATB gauge will go to
  25% full for the target.

  --- --- --- --- ---

  <After ATB Eval>
  speed = x;
  </After ATB Eval>
  This is the ATB set after the user has used the skill/item and the custom
  ATB amount you want the user to be at after. 'max' be the value of the
  full gauge value. Whatever you set 'speed', the user's ATB speed value
  will change to that much:

  Here is an example:

  <After ATB Eval>
  speed = user.mp / user.mmp * max;
  </After ATB Eval>
  The above code will set the user's ATB gauge after using the skill/item to
  equal the user's MP ratio. If the user has 25% MP, the ATB gauge will go
  to 25% full for the user.

  --- --- --- --- ---

  <ATB Interrupt Eval>
  interrupt = true;
  </ATB Interrupt Eval>
  This will allow you to set custom conditions for interrupting a target.
  Keep in mind that even though it is a custom condition, it still requires
  the target to be in the charging phase for the interrupt to work. By
  setting 'interrupt = true', the target will be interrupted.

  Here is an example:

  <ATB Interrupt Eval>
  if (user.hp > target.hp) {
     interrupt = true;
  }
  </ATB Interrupt Eval>
  The above code will state that if the user has more HP than the target,
  the target will be interrupted.

Action Sequences

These are action sequences that you can use with this plugin. Action Sequences will require Yanfly's Battle Engine Core to work.

Action Sequences - ala Melody

Battle Engine Core includes Yanfly Engine Melody's Battle Engine system, where each individual aspect of the skill and item effects can be controlled to a degree. These are called Action Sequences, where each command in the action sequence causes the game to perform a distinct individual action.

Each skill and item consists of five different action sequences. They are as follows:

1. Setup Actions
They prepare the active battler before carrying out the bulk of the action

and its individual effects. Usually what you see here are things such as the active battler moving forward a bit, unsheathing their weapon, etc. This step will occur before the active battler expends their skill or item costs.

2. Whole Actions
These actions will affect all of the targets simultaneously. Although this

section does not need to be used, most actions will use this for displaying animations upon all enemies. This step occurs after skill and item costs.

3. Target Actions
This section will affect all of the targets individually. Used primarily

for physical attacks that will deliver more personal forms of damage. Actions that occur here will not affect other targets unless specifically ordered to do so otherwise.

4. Follow Actions
This section will dedicate towards cleanup work after the individual

targeting actions. Here, it'll do things such as removing immortal flags, start up common events, and more.

5. Finish Actions
This section will have the active battler close up the action sequence.

Usually stuff like running waits and holds at the last minute for skills and items, moving back to place, and others.

Now that you know each of the five steps each action sequence goes through, here's the tags you can insert inside of skills and items. Pay attention to each tag name.

1. <setup action>
    action list
    action list
   </setup action>

2. <whole action>
    action list  
    action list  
   </whole action>

3. <target action>
    action list
    action list
   </target action>

4. <follow action>
    action list
    action list
   </follow action>

5. <finish action>
    action list
    action list
   </finish action>

They will do their own respective action sets. The methods to insert for the action list can be found below in the core of the Help Manual.

Furthermore, to prevent overflooding every single one of your database item's noteboxes with action sequence lists, there's a shortcut you can take to copy all of the setup actions, whole actions, target actions, follow actions, and finish actions with just one line.

<action copy: x:y>

Replace x with "item" or "skill" to set the type for the action list code to directly copy. The integer y is then the ID assigned for that particular object type. For example, to copy 45th skill's action sequences, the code would be <action copy: skill:45> for anything that will accept these action codes. If you do use this notetag, it will take priority over any custom that you've placed in the notebox.

Target Typing

You may notice that in some of the actions below will say "refer to target typing" which is this section right here. Here's a quick run down on the various targets you may select.

user This will select the active battler.
target, targets These will select the active targets in question.
actors, existing actors These will select all living actors.
all actors This will select all actors including dead ones.
dead actors This will select only dead actors.
actors not user This will select all living actors except for the user.
actor x This will select the actor in slot x.
character x This will select the specific character with actor ID x.
enemies, existing enemies This will select all living enemies.
all enemies This will select all enemies, even dead.
dead enemies This will select only dead enemies.
enemies not user This will select all enemies except for the user.
enemy x This will select the enemy in slot x.
friends This will select the battler's alive allies.
all friends This will select the all of battler's allies, even dead.
dead friends This will select the battler's dead allies.
friends not user This will select the battler's allies except itself.
friend x This will select the battler's ally in slot x.
opponents This will select the battler's alive opponents.
all opponents This will select the all of the battler's opponents.
dead opponents This will select the battler's dead opponents.
opponent x This will select the battler's opponent in slot x.
all alive Selects all living actors and enemies.
all members Selects all living and dead actors and enemies.
all dead Selects all dead actors and enemies.
all not user This will select all living battlers except user.
focus Selects the active battler and its targets.
not focus Selects everything but the active battler and its targets.
prev target Requires Action Sequence Impact.

During <Target Actions>, this will get the previous target in the targets list.

next target Requires Action Sequence Impact.

During <Target Actions>, this will get the next target in the targets list.

$UnisonMemberX Requires Unison Attack.

Replace X with the Unison Attack participant where X is slot used based on the <Unison Skill: x, y, z> notetag.

$UnisonMembers Requires Unison Attack.

Returns all of the participating Unison Skill members.

Action Sequence List

The following is a list of Action Sequences provided by this plugin.

You can make use of these extra ATB related action sequences.

=============================================================================
ATB CHARGE: target, X
ATB CHARGE: target, X%
ATB CHARGE: targets, +X
ATB CHARGE: targets, +X%
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Usable only for ATB. Sets the target's ATB charge to X or X%. This only
applies when the target is in the ATB charge phase. This will not affect
the user to prevent mechanical issues.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Usage Example: atb charge: targets, +5000
               atb charge: target, -50%
=============================================================================

=============================================================================
ATB GAUGE: target, X
ATB GAUGE: target, X%
ATB GAUGE: targets, +X
ATB GAUGE: targets, +X%
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Usable only for ATB. Sets the target's ATB speed or charge (whichever the
user is currently filling up) to X or X%. This only. This will not affect
the user to prevent mechanical issues.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Usage Example: atb gauge: targets, +5000
               atb gauge: target, -50%
=============================================================================

=============================================================================
ATB INTERRUPT: target
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Usable only for ATB. If the target is in the charging phase, interrupt it.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Usage Example: atb interrupt: targets
=============================================================================

=============================================================================
ATB SPEED: target, X
ATB SPEED: target, X%
ATB SPEED: targets, +X
ATB SPEED: targets, +X%
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Usable only for ATB. Sets the target's ATB speed to X or X%. This only
applies when the target is filling up its ATB gauge. This will not affect
the user to prevent mechanical issues.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Usage Example: atb speed: targets, +5000
               atb speed: target, -50%
=============================================================================

Options Core Settings - Adding the New Options

If you are using YEP_OptionsCore.js, you can add a new Option using this
plugin. Here's the following code/parameter settings you can use with it.

---------
Settings:
---------

Name:
\i[87]ATB Speed

Help Description:
Determines how fast the ATB Gauge fills up during battle.

Symbol:
atbSpeed

Show/Hide:
if (Imported.YEP_X_BattleSysATB) {
  show = $gameSystem.getBattleSystem() === 'atb';
} else {
  show = false;
}

Enable:
enabled = true;

Ext:
ext = 0;

----------
Functions:
----------

Make Option Code:
this.addCommand(name, symbol, enabled, ext);

Draw Option Code:
var rect = this.itemRectForText(index);
var statusWidth = this.statusWidth();
var titleWidth = rect.width - statusWidth;
this.resetTextColor();
this.changePaintOpacity(this.isCommandEnabled(index));
this.drawOptionsName(index);
var value = this.getConfigValue(symbol);
var rate = value / 10;
var gaugeColor1 = this.textColor(13);
var gaugeColor2 = this.textColor(5);
this.drawOptionsGauge(index, rate, gaugeColor1, gaugeColor2);
this.drawText(this.statusText(index), titleWidth, rect.y, statusWidth, 'center');

Process OK Code:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
value += 1;
if (value > 10) value = 1;
this.changeValue(symbol, value);

Cursor Right Code:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
value += 1;
if (value > 10) value = 1;
this.changeValue(symbol, value);

Cursor Left Code:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
value -= 1;
if (value < 1) value = 10;
this.changeValue(symbol, value);

Default Config Code:
// Empty. Provided by this plugin.

Save Config Code:
// Empty. Provided by this plugin.

Load Config Code:
// Empty. Provided by this plugin.

Changelog

Version 1.28:
- 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.27:
- Compatibility update with YEP_OptionsCore.js.

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

Version 1.25:
- Lunatic Mode fail safes added.

Version 1.24:
- During action end, a single tick will be forced to occur to prevent clash
amongst actors with similar AGI values and make tick values more unique.

Version 1.23:
- Timing has been changed for states that update turns at Turn Start. Now,
the states will update prior to the actor's command box opening or the enemy
make a decision on which action it will use.

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

Version 1.21:
- Counterattacks no longer cause interrupts if attack actions have interrupt
functionality.

Version 1.20:
- Updated plugin to update the AI more accordingly with Battle AI Core.

Version 1.19:
- Fixed a bug where forced actions clear out an action's effects before the
turn is over, making post-turn effects to not occur.

Version 1.18:
- Fixed a bug where changing back and forth between the Fight/Escape window
would prompt on turn start effects.

Version 1.17:
- Made a mechanic change so that turn 0 ends immediately upon battle start
rather than requiring a full turn to end.

Version 1.16:
- Added a fail safe setting up ATB Charges when the Cannot Move restriction
is imposed upon an actor.

Verison 1.15:
- Implemented a Forced Action queue list. This means if a Forced Action
takes place in the middle of an action, the action will resume after the
forced action finishes rather than cancels it out like MV does.

Version 1.14:
- Added a speed position check for Instant Casts to maintain order position.

Version 1.13:
- Fixed a bug that doesn't update state turns properly.
- Removed 'Turn Structure parameter' as it goes against the nature of a
Tick-Based battle system.

Version 1.12:
- Added speed rebalance formulas for tick-based systems (innate).

Version 1.11:
- Fixed a bug that would still allow battlers to perform actions even if the
actions got sealed midway through charging the action.

Version 1.10:
- Fixed a bug that would cause AutoBattlers to stall if they got added into
the party mid-battle.

Version 1.09:
- Mechanic change for states that update on Action End to end at the end of
a battler's turn instead of at the start.

Version 1.08a:
- Fixed a bug that crashed the game when enemies were confused.
- Preparation for Enemy ATB Gauges.

Version 1.07:
- Added 'Flash Enemy' to plugin parameters to flash the enemy once when it
starts charging a skill.

Version 1.06:
- Added pre-emptive and surprise attack mechanic plugin parameters!

Version 1.05:
- Fixed a bug with Forced Actions locking out the battle.

Version 1.04:
- Added the 'Per Tick' parameter for you to adjust the formula that governs
the speed rate at which the ATB gauge fills up.

Version 1.03:
- Fixed a bug that caused the ATB Gauge appear slow with maxed AGI.

Version 1.02c:
- Fixed a bug with the ATB GAUGE and ATB CHARGE action sequences.
- Fixed a bug with battlers still getting a turn after the battle is over.
- Fixed a bug that prevented escaping.
- Added math fail safes for calculating ATB charging.

Version 1.01:
- Fixed a bug with escaping causing battlers to go into infinite lock.
- Fixed a bug with multiple victory messages.
- Added fail safe to prevent infinite charging.
- Added <Cannot ATB Interrupt Notetag>.

Version 1.00:
- It's doooooooone!