Guard Skill Command
This script changes your guard command depending on a variety of conditions. The guard command can be based on what states are applied, what your actor
has currently equipped, or what their class is.
By default, the guard command uses the guard skill, which is the second skill. However, by adding a few simple tags and some priorities, you can customize what the guard command is.
The guard skill can be specified as a number or a formula, allowing you to create dynamic guard skills.
Place this script below Command Manager and above Main
Note-tag actors, classes, weapons, armors, or states with
<guard skill: ID PRIORITY>
For some skill ID.
The priority is used if you have multiple states or equips with a
guard skill ID. the highest priority is taken in this case, and if multiple
guard skill ID’s have equal priority, then whichever appears first is taken.
If you would like to use a formula for the ID, you will need to use the
<guard skill> id: FORMULA priority: x </guard skill>
You can use any valid formula that returns a number. Note that the formula only supports one-liners. The following formula variables are available:
a - the current battler you are inputting commands for t - game troop p - game party v - game variables s - game switches
If your actor does not have a custom guard skill ID, then it defaults to
the actor’s guard skill. If the actor does not have a custom guard skill, then
it defaults to the class guard skill. Finally, it will default to skill 2 if
no custom guard skills are defined.
Suppose you’ve tagged a weapon with
<guard skill: 20 5>
And a state with
<guard skill: 23, 10>
When the weapon is equipped, skill 20 becomes the guard command. However, if you then add the state, then skill 23 suddenly becomes the guard command because its priority is higher. Once the state wears off, the guard skill will return to being skill 20.
For dynamic guard skills, you can use the extended note-tag to use a guard skill formula. For example, you can have different guard skills depending on your HP: if HP is less than 20%, then it will use skill 5. Otherwise, it will use skill 2.
<guard skill> id: a.hp < a.mhp * 0.2 ? 5 : 2 </guard skill>