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.
Download
Script: download here
Required: Command Manager
Installation
Place this script below Command Manager and above Main
Usage
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
extended note-tag:
<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.
Examples
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>
TereseIo fotbollströjor HKZVicki GabrielW fotballdrakter ECHAjaki
HansJewe maglie del calcio AbrahamC BrodieCa fodboldtrøjer JamaalLa
I was using this and noticed it didn’t work on states. I compared; the attack replacer does work.
I hit up my buddy who knows way more about scripting and programming than I do and he basically made a work-around that solved the problem:
# Choose the one with highest priority
data.sort_by {|obj| -obj.priority }
data.each do |obj|
id = obj.guard_skill_id(self) if obj
return id if id > 0
end
He said the following:
Defaults were the problem. Script has been updated. The solution your friend provided works as well.
Nice Script. I have a problem with it though. When I put it in the Armor’s note it doesn’t work when I put
However it works when I put it on the class’s notes. What do?
Funny enough it works on head and body, but doesn’t work on accesory nor shield. Also works on weapons.
I wish I wasn’t this late to the party lol
Hmm, that’s strange. Can you try it in a new project? Maybe there’s a compatibility issue somewhere.