Cover Conditions

This script allows you to specify custom cover conditions.

The cover condition determines whether a battler is eligible to be covered. By default, this means that the battler must have under 25% of its max HP and the current action being performed by an attacker is not a “certain hit” item.

You can change the “global cover condition”, which is the condition that is checked for all battlers if no other cover conditions exist.

You can also specify custom conditions for actors, classes, or enemies.

Download

Script: download here

Installation

In the script editor, place this script below Materials and above Main

Usage

In the configuration, you can set the global cover condition if you don’t want the default.

To specify specific cover conditions for each database object, note-tag them with

<cover condition>
FORMULA
</cover condition>

Where the FORMULA determines whether a battler is eligible for substitution.
The following formula variables are available

a - the battler that is currently executing its action
b - the target of the action. This is who you are trying to cover
i - the skill or item being used in the action
p - game party
t - game troop
v - game variables
s - game switches

This condition only determines whether a target can be covered or not.
Note that a is NOT the battler that will be covering you.

You may also like...

54 Responses

  1. Rinku says:

    Hi, has this script been converted over to MV?

  2. Joey Desud says:

    Alright, I’ve been racking my brains on this but for some reason i can’t get it to work.

    I want to have two separate cover states, one that only protects other party members under 25% HP (default) and the other that will always protect the other allies from physical onslaughts.

    It seems that no matter what, only the default settings are ever used…

    • Hime says:

      How have you set up the state’s cover condition?

      • Joey Desud says:

        I’ve tried both “(!i || !i.certain?)” and just “true” for my “Cover All” state.

        What’s strange is that if I changed the default in the script to this, it works fine, but then my “Cover the weak” state “b.hp < b.mhp / 4 && (!i || !i.certain?)” ends up being overwritten.

        I’ve tried moving the script around but it still works the same.

        • Hime says:

          Is it possible that the cover condition note-tag isn’t written correctly and therefore isn’t being read?

          • Joey Desud says:

            It was written correctly. For some reason the notetag isn’t being read. It’s fine though, I think my game will survive not having this feature. Thanks for your help though.

  3. LuxMajii says:

    Is it possible to create a counter that intercepts all single-targeting attacks, but no multi-targeting ones?

  4. FreezeKirby says:

    Question of the day:

    Using a skill is all fine and dandy-but what if I actually want to set up a passive ability for one Actor to specifically cover another actor, without having to use a skill? I should explain better by being less vague, and so here is my situation:

    I am using one of Galv’s terrific scripts-the Magic Shards script, and I want one of the shards to provide this passive state to the Actor who has it equipped, which should allow them to constantly jump in and cover a specific Actor-and none other, whenever they are attacked. The big question is, how would I exactly set that up without using a skill?

    Thank you in advance for reading, it means a lot. ( ^ w ^ )

    • Hime says:

      This script allows you to specify whether someone “can be covered”. So if you want to specify that your actor “Can cover someone”, this script wouldn’t work.

      What you can potentially do is to have the other actor always coverable. Then, have your passive state add the “substitute flag” feature to the actor that will perform covering.

      • FreezeKirby says:

        Hnnnnngh, Galv’s script is hard to work with. Thank you for the reply, even though I cannot get it to work. X’D…

        I think their script does not take notetags into account, which is quite the significant bummer. I.E. The equipped shards’s notetags are being completely ignored, and apparently, the passive states are not being added as I was expecting them to.

        I’ll try to find a workaround, or else I’m going to have to rethink about quite a lot of things… u_u”

  5. Ctelin Ajira says:

    I seem to be having problems. I can’t get the script to let someone block magical attacks

    I’ve tried the following tag setups. None of them seem to work

    < cover condition >
    b.hp <= b.mhp / 1 && (!i || i.magical?)
    < /cover condition >

    < cover condition >
    b.hp <= b.mhp / 1 && (!i || (!i.certain? || !i.physical?))
    < /cover condition >

    < cover condition >
    b.hp <= b.mhp / 1 && (!i || !(i.certain? || i.physical?))
    < /cover condition >

    • Hime says:

      Does your actor have the "substitute" flag? (add feature, “Other” tab, Special Flag). That needs to be active in order for them to perform covering.

      • Ctelin Ajira says:

        No I haven’t been using the substitute flag for this. I’ve been using your Cover Targets script, and I have the < cover target > state tagged correctly.

        • Hime says:

          Try this: create a new state called “covered” and add your cover condition. Then when you use a skill that adds the “cover target” state, you would also add the covered state. This would give the covered target a new cover condition.

          Cover conditions only determine whether “a target can be covered”, and not whether “the user can cover a target”, so the cover conditions must be added to the person that should be covered, and not the person doing the covering.

      • Ctelin Ajira says:

        Additionally, I’ve tried the following since the parent comment

        < cover condition >
        b.hp <= b.mhp / 1 && (!i || (!i.certain? && !i.physical?))
        < /cover condition >

  6. Dale says:

    Hi there,
    is there a way to make a cover where the user only covers X% of allies damage (ally still takes Y%) but in return the user counters with a lifesteal for z% of damage received? (or z% of total damage from enemy skill that as used)
    Cheers.

    • Hime says:

      This script only provides functionality for specifying when an ally should be covered or not, so it would not support covering specific amounts of damage.

  7. Ctelin Ajira says:

    Could this script be used in conjunction with http://himeworks.com/2013/11/cover-targets/ to create a skill, similar to Runic in Final Fantasy 6, that intercepts and nulls all magic thrown at the party?

    • Hime says:

      Yes, they are meant to be used together. “Cover Targets” sets up which battler you want to cover, and cover conditions sets up conditions for when the actual cover will occur.

      • Ctelin Ajira says:

        What would happen if there were two sets of state conditions on one target? I ask because I have plans for a regular physical-intercepting Cover, and FF6 Runic in my game.

        • Hime says:

          Takes whichever state was added first.

          • Ctelin Ajira says:

            Would it be at all possible to make it so both conditions take effect?

          • Hime says:

            Do you mean both must be met, or any of them can be met in order for the target to be eligible for covering?

          • Ctelin Ajira says:

            I meant any of them can be met, and the target is still eligible for covering.

          • Hime says:

            I will look at writing an add-on for it. I don’t want to change how the original script functions without finding a way to support different ways of checking whether a condition is met.

  8. jface says:

    How can I write a condition to mimic the “Sentinel” skill on Final Fantasy X? This guards one ally from any physical attack or skill, regardless of the target’s HP. The condition is removed after guarding one attack.

  9. Scoates says:

    I’m having a little trouble processing this. Is it possible to have one actor cover the party against all magical attacks, and another actor to cover the party against all physical attacks?

  10. Arsist says:

    Okay, so ‘a’ is the user of the move, and ‘b’ is the original target. But how would you reference the battler who is doing the covering? It doesn’t appear to be ‘self’ or ‘subject’.

    • Hime says:

      You can’t. These cover conditions only apply to the person that is being covered. I would imagine in the default engine, if your actor only had 1 HP left, it would still try to cover someone even if doing so would be suicide.

      This is one of the flaws in the engine.

      • Anonymous says:

        Well if you could condition it, then you could just condition it based on the hp of the person covering. Like you could say that only if the cover-er has more health and defense than the target will the cover occur.
        Hm, that’s weird. Even with a mixture of State Caster and Cover Targets scripts?
        For example, you could find the battler origin of the state that is applied to the target when they are covered, then make custom conditions based on that battler, I would assume.

      • Arsist says:

        Actually, couldn’t you use a mix of State Caster and Cover Targets for this one?
        (b.state_caster(x).hp/b.hp) >= 1.333 && (b.state_caster(x).hp/b.param_base(1)) >= 0.25
        Like say in this example, the battler will only cover the target when they have 25% or more of their base HP remaining and their remaining HP is at least 1/3rd higher than the target’s.

        • Hime says:

          Yes, that would be possible. It is an indirect way of grabbing the person that’s currently covering you, but only works if someone’s actually been assigned to cover you.

          I looked at whether it would be possible to simply create a formula to determine whether you would actually go and cover someone else, but I would have to basically change the way it’s written since it only provides two pieces of information: the person that’s covering, and the target that shall be covered. It doesn’t provide any information about who is attacking.

  11. Krystal says:

    Okay, I'm sick and tired of banging my head against the wall here, I've guessed and guessed and guessed and you know what? I'M TIRED OF GUESSING!

    "a – the battler that is currently executing its action
    b – the target of the action. This is who you are trying to cover
    i – the skill or item being used in the action
    p – game party
    t – game troop
    v – game variables
    s – game switches"

    WHAT THE FUCK IS THIS SUPPOSED TO MEAN?! I put in the letter b and NOTHING happens, I type in a name and NOTHING happens, As far as I can tell this script is nothing more than a heap of useless code, so for the love of god PROVE ME WRONG AND TELL ME HOW THIS THING WORKS!!!!

    • Hime says:

      What are you trying to do?

    • rubydragon44 says:

      this is basically a quicker version of various objects.
      For example,
      !a.state?(50) && a.param_base(1) / a.hp < 2
      would mean the condition is if the user does not have state 50 applied and their current hp is greater than half of the the "base", unmodified version of their Maximum HP.
      Cussing won't help.

    • rubydragon44 says:

      this is basically a quicker version of various objects.
      For example,
      !a.state?(50) && a.param_base(0) / a.hp < 2
      would mean the condition is if the user does not have state 50 applied and their current hp is greater than half of the the "base", unmodified version of their Maximum HP.
      Cussing won't help.

  12. rubydragon44 says:

    How would I make it so that the skill can't be skill 297 or be skill 90?
    like
    cover condition
    "(i != 297 && !item) && (i != 90 && !item) "
    /cover condition
    (sorry for my ignorance)

    • rubydragon44 says:

      And once I've found that out, I could use "(if skill id is 150 and not item) or (if skill id is 152 and not item)" and whatnot, I could make a Lightningrod state, where the user will cover or "draw in" all Thunder moves 😀

    • Hime says:

      If my documentation is correct you should be able to say

      i.is_a?(RPG::Skill) &amp;&amp; (i.id != 297 || i.id != 90)
      
  13. aegixdrakan says:

    It’s a pity this doesn’t work if you put the condition into a State… 🙁

    Ah well. It’s still wonderful, especially with your other cover script. 🙂

Leave a Reply to Hime Cancel reply

Your email address will not be published. Required fields are marked *