Welcome to PGMV! My goal is to make it easy for everyone to find and share great plugins for creating amazing games. As a plugin developer myself, I'm excited to grow this community with all of you.
FTKR AI Skill Evaluate - FTKR_AISkillEvaluate.js
Plugin desc : v1.2.6 Plugin that changes the evaluation value of skills used during auto-battle
License : MIT License
Author : Futokoro
Desc page : https://github.com/munokura/futokoro-MV-plugins
Download Page : https://raw.githubusercontent.com/munokura/futokoro-MV-plugins/refs/heads/master/FTKR_AISkillEvaluate.js
File name : FTKR_AISkillEvaluate.js
Help of plugin :
@plugindesc v1.2.6 Plugin that changes the evaluation value of skills used during auto-battle
@author Futokoro
@url https://github.com/munokura/futokoro-MV-plugins
@license MIT License
@help
English Help Translator: munokura
This is an unofficial English translation of the plugin help,
created to support global RPG Maker users.
Feedback is welcome to improve translation quality
(see: https://github.com/munokura/futokoro-MV-plugins ).
Original plugin by Futokoro.
Please check the URL below for the latest version of the plugin.
URL https://github.com/futokoro/RPGMaker
-----
-----------------------------------------------------------------------------
Overview
-----------------------------------------------------------------------------
You can individually set the evaluation value calculation for selecting skills to use during auto-battle.
You can also create behavior evaluation models (simple strategies).
You can add a command to display a dedicated screen for changing the behavior evaluation model (simple strategies) in-game to the menu commands and battle party commands.
Set this using the plugin parameters Menu Command and Party Command.
For instructions on how to use the plugin, see the online manual page below.
https://github.com/futokoro/RPGMaker/blob/master/FTKR_AISkillEvaluate.ja.md
-----------------------------------------------------------------------------
Setup Instructions
---------------------------------------------------------------------------
1. Add this plugin to the "Plugin Manager."
2. When combining with the following plugins, be sure to pay attention to the order of plugin management.
FTKR_AISkillEvaluate.js
↓Register below this plugin↓
FTKR_ExBattleCommand.js
-----------------------------------------------------------------------------
Setting the Skill Evaluation Formula
-----------------------------------------------------------------------------
By adding the following tag to the skill's Note field, you can individually set the evaluation formula for the skill used during auto-battle.
<ASE_EBARUATE:***>
Enter the formula in ***
The formula can be written in the same way as the damage formula.
a: The User (a.hp = user's current HP)
b: Target (b.hp = target's current HP)
item: Skill to be used (item.mpCost = skill's MP cost)
number: Amount of damage to be dealt by the skill
If you do not specify the evaluation formula above, the MV default evaluation formula (*) will be used.
*See below
-----------------------------------------------------------------------------
Evaluation Value Calculation Formula for Auto Battle
-----------------------------------------------------------------------------
By default, MV calculates the evaluation value of available skills for each selectable target during auto battle according to the following rules. The skill is used against the target with the highest evaluation value.
1. Skills with damage types other than "HP Damage, HP Recover, or HP Drain" have an evaluation value of 0.
2. For HP damage, the evaluation value is the ratio of the damage dealt to the target's remaining HP.
3. For HP recovery, the evaluation value is the ratio of the amount recovered to the target's maximum HP.
4. For skills that target all targets, the evaluation values of all targets are added together.
5. If a consecutive count is set, the calculated evaluation value is multiplied by the count.
6. If the evaluation value is not 0 after rule 5, a random value between 0 and 1 is added to the value.
As you can see from the above rules, skills with MP damage types or skills with only a use effect set without a damage type will never be used in auto battle by MV's default.
By using this plugin and setting the evaluation value formula for those skills using tags,
they can potentially be used in auto-battle.
-----------------------------------------------------------------------------
About the Evaluation Value Formula
-----------------------------------------------------------------------------
Basically, skill evaluation values fall between 0 and 1, except for area-of-effect skills and multiple-attack skills. Area-of-effect skills and multiple-attack skills are several times higher.
Therefore, unless there is a special reason, the results of the evaluation value formula set by this plugin should be set to a similar value.
For example, if you set the evaluation value formula for a skill that reduces attack power as
<ASE_EBARUATE:b.atk>
, you will almost certainly only use that skill.
It is also possible that you may cast it multiple times on the same opponent.
In this case, if you compare it to your own defense, the evaluation value will decrease for opponents with attack power lower than your own, which should effectively distribute the value to other skills.
Example:
<ASE_EBARUATE: b.atk / (a.def * 2)>
Also, if you want to prevent a status, debuff, or buff from being applied again to an opponent,
add a calculation to set the evaluation value to 0 if the opponent is under a status.
Example:
<ASE_EBARUATE: b.aseState(n) * b.atk / (a.def * 2)>
b.aseState(n) is a script that returns 0 if the opponent is under a state with state ID n, and 1 if the opponent is not under a state.
To cast it on yourself, change b.ase** to a.ase***.
Similarly, the script returns 0 if the opponent is under a debuff or buff, and 1 if the opponent is not under a state.
The following scripts return 0 if the opponent is under a debuff or buff, and 1 if the opponent is not under a state.
Note that the values of n are as follows:
0: Max HP, 1: Max MP, 2: Attack Power, 3: Guard Power
4: Magic Attack, 5: Magic Guard, 6: Agility, 7: Luck
1. Debuff applied
b.aseDebuff(n)
2. Two-stage debuff applied
b.aseMaxDebuff(n)
3. Buff applied
b.aseBuff(n)
4. Two-stage buff applied
b.aseMaxBuff(n)
Also, the effect of status effects and debuffs decreases as the battle progresses.
Therefore, you can adjust the rating value based on the number of turns elapsed.
The number of turns elapsed can be obtained using $gameTroop.turnCount()+1.
Example:
<ASE_EBARUATE:1 / ($gameTroop.turnCount() + 1)>
In this case, the rating value will be 1 on the first turn, 0.5 on the second turn, and so on, gradually decreasing with each turn.
*When selecting a skill, the turn has not yet elapsed, so
$gameTroop.turnCount() starts at 0.
If you want to prevent a character from using the same skill twice in the same turn, you need to check whether the previous character
selected the specified skill.
$gamePary.aseSkill(n) is a script that returns 0 if the previous character selected the skill with skill ID n, and 1 if no character selected it.
Example:
<ASE_EBARUATE:$gamePary.aseSkill(10)>
-----------------------------------------------------------------------------
About the Action Evaluation Model (Simple Strategy)
----------------------------------------------------------------------------
In addition to setting the evaluation value formula, you can set a rating for each general action type (*1)
and adjust the overall evaluation value for that type.
(*1) Classification of skills with similar effects, such as HP damage skills, HP recovery skills, and buffing skills.
Set this using the plugin parameter <Evaluate Models>.
You can create multiple models and assign them to actors separately. For example, you can assign different skill evaluations to different actors, such as actors who prioritize attacking and actors who prioritize Recoverying.
1. Configuring the <Evaluate Models> Plugin Parameter
The plugin parameters are in list format, and the list number serves as the evaluation model ID. (This number will be used in the actor Note field, described below.)
Set the model name (name) and action evaluation list (evaluate).
2. Configuring the Action Evaluation List (evaluate)
In this list, you set specific ratings and conditions for each action type.
Basically, this works the same as the actions set for Enemies.
Only skills belonging to the action type set here will be used.
Set the following parameters for each action.
Action Type (actionType)
: Select the action type you set from the select box.
: Note that you can also switch to text input mode and enter a different value directly.
: (See Setting Action Types for Skills below.)
Conditions (conditions)
: Set the conditions for using that action type.
: Enter the judgment formula using the same syntax as the damage calculation formula.
: Leaving this field blank will assume that the skill is always available.
Rating
: Set the frequency with which this action type is selected.
: Set a value from 1 to 9, which will be multiplied by the rating value.
! ! Attention! ********************************************
Please set at least one action type in the list that has a skill that is always available.
"Always available" here means a skill that has a rating value that does not reach 0 and can be used without consuming a cost.
Example: Action Type: Normal Attack
********************************************************
3. Setting the Action Type for a Skill
You can set the action type by setting the following tag in the skill's Note field.
<ASE_ACTION_TYPE:n>
Where n matches the number of the action type selected in the Action Rating List.
Note that for skills with the following settings, the action type will be set by the plugin even if you do not use the above tag. However, the tag setting takes priority.
1: Attack with skill ID 1
2: Guard with skill ID 2
11: Damage type is HP damage
12: Damage type is HP recovery
13: Damage type is HP absorption
21: Damage type is MP damage
22: Damage type is MP recovery
23: Damage type is MP absorption
31: Skill with buff effect
41: Skill with debuff effect
51: Skill with state removal and debuff removal effect
4. Setting the Actor's Evaluation Model
You can set the evaluation model by setting the following tag in the actor's Note field.
<ASE_EVALUATE_MODEL:n>
n: Sets the evaluation model ID.
You can set game variables with ¥v[x].
0 will enable the MV default auto-battle, while -1 will enable manual Battle.
You can also get the evaluation model name for actor ID n using the following script:
$gameActors.actor(n).evalModelname()
-----------------------------------------------------------------------------
About the Strategy Screen
-----------------------------------------------------------------------------
You can add a command to display a dedicated screen for changing the behavior evaluation model (simple strategy) you set in-game
to the menu commands and battle party commands.
Set this using the plugin parameters Menu Command and Party Command.
The list of strategies available to each actor can be set by entering the following tag in the actor's Note field.
<ASE_TACTICS_LIST:n1,n2,...>
n1,n2,... are the strategy list numbers set using the plugin parameter Evaluate Models. They can be any number from 0 (MV default for automatic battle) to any number.
Example)
<ASE_TACTICS_LIST:0,1,2>
Note that the actual strategy screen will also display a "Manual Battle" option in addition to these.
-----------------------------------------------------------------------------
License for this Plugin
-----------------------------------------------------------------------------
This plugin is released under the MIT License.
Copyright (c) 2017,2018 Futokoro
http://opensource.org/licenses/mit-license.php
Plugin Publisher
https://github.com/futokoro/RPGMaker/blob/master/README.md
-----------------------------------------------------------------------------
Change History
-----------------------------------------------------------------------------
v1.2.6 - 2018/12/11: Conflict avoidance and bug fixes.
1. Avoided conflict with FTKR_AlternatingTurnBattle.
2. Fixed a bug that prevented the default auto-battle setting from being changed.
v1.2.5 - 2018/10/20: Conflict avoidance.
1. Fixed the strategy screen layout so that it is not affected by the menu screen display layout.
v1.2.4 - 2018/03/10: Bug Fixes
1. Fixed an issue where changing tactics on the strategy screen would not update correctly if the actor's trait "Auto Battle" was not enabled.
2. Fixed an issue where an error would occur if no skills were available during battle.
v1.2.3 - 2018/02/28: Help Additions
1. Added instructions on how to set tactics to the help section.
v1.2.2 - 2018/02/28: Bug Fixes
1. Fixed an issue where an error would occur if the initial value of the plugin parameter "Evaluate Models" was blank.
v1.2.1 - 2018/02/28: Help Updates and Added Traits
1. Fixed a typo in the help section.
2. Added a script, $gameParty.aseSkill(n), to check whether the previous character selected a specified skill.
v1.2.0 - 2018/01/11: Traits Added
1. Added a screen for changing party member evaluation models (simple tactics) during gameplay. This can be added to menu commands and party commands in battle.
2. Added a function to prevent party commands from being skipped, even when all party members are set to auto-battle.
v1.1.0 - 2018/01/08: Traits Added
1. Added the ability to set evaluation models (simple tactics) for actors.
v1.0.1 - 2018/01/07: Traits Added, Help Added
1. Added code to reference expected damage to the evaluation value formula.
2. Added a function to output evaluation values to the console log.
3. Added a script that returns 0 or 1 depending on whether a state, buff, or debuff is applied.
v1.0.0 - 2018/01/06: First version created
-----------------------------------------------------------------------------
@param Skill Evaluate Log
@desc Output the evaluation value calculation result to the console log
@default false
@type boolean
@on valid
@off invalid
@param Evaluate Models
@desc Create a model of behavioral evaluation (simple strategy). The evaluation model set here can be Reflectioned in the actor.
@default []
@type struct<auto>[]
@param Manual Mode Name
@desc Set the operation name when not using auto-battle.
@default 手動戦闘
@param Default Tactics Name
@desc Set the default operation name for automatic battles in MV.
@default 自動戦闘
@param Skip Party Command
@desc Whether to skip party commands when all party members are in auto-battle mode
@default 0
@type select
@option Skip (MV default)
@value 0
@option Don't skip
@value 1
@option Don't skip the first turn
@value 2
@param Menu Command
@desc Adding Operation Commands to Menu Commands
@type struct<command>
@param Party Command
@desc Will you add strategy commands to party commands during battle?
@type struct<command>
@param Title Texts
@desc Set the string to be displayed in the title window of the strategy screen.
@default {"party":"パーティー","tactics":"作戦リスト"}
@type struct<title>