Guard Skill Command

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

guardSkillCommand

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>
Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

You may also like...

5 Responses

  1. TSED says:

    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:

    [Friend]: yeah, my only thought there is that maybe the notetag parser
    is picking up false positives

    [Friend]: as in, the notetag for something else is registering as a guard notetag but doesn’t have the
    right data so it just goes to the defaults

  2. Anonymous says:

    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?

    • Anonymous says:

      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

Leave a Reply

Your email address will not be published.

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax