Battle System - CTB (YEP)

From Yanfly.moe Wiki
Jump to navigation Jump to search
Welcome to the wiki! This is where you can find resources from Yanfly.moe, Ækashics.moe,
Visustella, Caz Wolf, Fallen Angel Olivia, Atelier Irina, and other affiliated content creators.



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.

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.


Introduction

The Battle System - Charge 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 CTB system, go to the Battle Engine Core plugin and change the
'Default System' setting in the parameters to 'ctb'.

The Charge Turn Battle system functions by calculating every battlers' speed
and balancing them relative to one another. When it's a battler's turn, the
battler will either choose an action to perform immediately or charge it for
later depending if the skill requires charging.

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 Charge Turn Battle if it isn't the default
battle system, you can use the following Plugin Command:

Plugin Command:
  setBattleSys CTB      Sets battle system to Charge 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 Charge 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 CTB system.

Actor and Enemy Notetags:
  <CTB Icon: x>
  This sets the icon used for the actor/enemy to be x.

  <CTB Border Color: x>
  This sets the border color used for the actor/enemy to text color x.

  <CTB Background Color: x>
  This sets the background color used for the actor/enemy to text color x.

Actor only Notetags:
  <Class x CTB Icon: y>
  This sets it so that if the actor is a specific class, the actor will get
  a specific icon used for the CTB Turn Order. If the actor is class x, it
  will receive icon y.

  <Hero CTB Icon: x>
  <Warrior CTB Icon: x>
  <Mage CTB Icon: x>
  <Priest CTB Icon: x>
  If you prefer to use names instead of class ID's, you can use the above
  notetag format. If the actor is the named class, it will receive icon x.
  If you have multiple classes with the same name, priority will be given to
  the class with the highest ID.

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

  <CTB Speed: x>
  Usable only during CTB. This sets the target's current speed to x.

  <CTB Speed: x%>
  Usable only during CTB. This sets the target's current speed to x% of
  the CTB turn completion target.

  <CTB Speed: +x>
  <CTB Speed: -x>
  Usable only during CTB. This increases or decreases the target's current
  speed by x.

  <CTB Speed: +x%>
  <CTB Speed: -x%>
  Usable only during CTB. This increases or decreases the target's current
  speed or charge by x% of the CTB turn completion target.

  <CTB Order: +x>
  <CTB Order: -x>
  Moves target's position in the turn order by +x or -x. +x will make the
  target having to wait more before getting their turn while -x will make
  the target having to wait less. The effect is minimal and will only last
  for the current turn cycle.
  * Note: If you use this for multiple targets, each target will shift turns
  individually at a time.

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

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

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

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 CTB Speed and Conditional CTB Charge
For those who have a bit of JavaScript experience and would like to have
more unique ways of performing CTB speed and charge changes, you can use the
following notetags:

Skill and Item Notetags:
  <Target CTB Speed Eval>
  speed = x;
  charge = x;
  </Target CTB Speed Eval>
  You can omit speed and/or charge. Whatever you set 'speed' to will change
  the CTB 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 CTB Speed Eval>
  speed = target.hp / target.mhp * max;
  charge = target.hp / target.mhp * max;
  </Target CTB Speed Eval>
  The above code will set the user's current CTB gauge to position equal to
  the target's HP ratio. If the target has 25% HP, the CTB gauge will go to
  25% full for the target.

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

  <Target CTB Order Eval>
  order = x;
  </Target CTB Order Eval>
  Set the 'order' variable to how much you want to alter the target's
  current turn order by. If 'order' is positive, the order will need to wait
  that many more turns before its turn comes up. If 'order' is negative, it
  will will that amount of turns less before the order comes up.

  Here is an example:

  <Target CTB Order Eval>
  if (target.hp > 1000) {
    order = 3;
  } else {
    order = -1;
  }
  </Target CTB Order Eval>
  If the target when attacked has over 1000 HP left, the target will have to
  wait 3 more turns before its turn arrives. If the target has 1000 or less,
  the target actually waits 1 less turn.

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

  <After CTB Eval>
  speed = x;
  </After CTB Eval>
  This is the CTB set after the user has used the skill/item and the custom
  CTB 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 CTB speed value
  will change to that much:

  Here is an example:

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

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 CTB related action sequences.

=============================================================================
CTB ORDER: target, +X
CTB ORDER: target, -X
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Usable only for CTB. Moves target's position in the turn order by +x or -x.
+x will make the target having to wait more before getting their turn while
-x will make the target having to wait less. The effect is minimal and will
only last for the current turn cycle.
* Note: If you use this for multiple targets, each target will shift turns
individually at a time.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Usage Example: ctb order: target, -2
               ctb order: target, +3
=============================================================================

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

Changelog

Version 1.17:
- 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.16:
- Updated for RPG Maker MV version 1.5.0.

Version 1.15:
- Lunatic Mode fail safes added.

Version 1.14a:
- Updated check for CTB Charging. Units in the turn order will not be
considered 'ready' unless they are in the front of the CTB Turn Order.

Version 1.13:
- 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.12:
- Updated for RPG Maker MV version 1.1.0.

Version 1.11:
- Counterattacks no longer cause turn order inconsistencies.

Version 1.10a:
- Updated plugin to update the AI more accordingly with Battle AI Core.
- Optimized CTB Turn Order further to reduce lag when there are larger
quantities of battle members.

Version 1.09:
- 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.08a:
- Fixed a bug where changing back and forth between the Fight/Escape window
would prompt on turn start effects.
- Made an update where if using Battle Engine Core's "Lower Windows" to
false, the icons no longer show above the windows.

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

Version 1.06:
- Fixed a bug that would cause a crash when a party member leaves the party.

Version 1.05c:
- 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.
- Fixed a graphical issue where enemies appearing midway don't have letters
attached to their icons.
- Added a fail safe for loaded saves that did not have CTB installed before.

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

Version 1.03:
- 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.02:
- Added failsafe for battlers without actions.
- Added speed rebalance formulas for tick-based systems (innate).
- Added <Class x CTB Icon: y> and <classname CTB Icon: x> notetags.

Version 1.01:
- Provided loop breaks to prevent lock-ups with non-Yanfly plugins.
- Added 'Icon Size' parameter to allow customization of icon sizes.

Version 1.00:
- It's doooooooooone!