Formula Effects


All items and skills in RPG Maker come with additional “effects”.

Effects include gaining HP, learning a skill, gaining a buff in a parameter, or running a common event.

However, what if you would like a skill to do something that isn’t provided by default?

You could use the damage formula, but what if you would like to create conditions on those effects? You could include those conditions in the formula as well, but the problem here is you may end up with a very complex damage formula.

Instead of using the damage formula for everything, you can create custom effects that support formulas. If you already knew how to write the formula, then you can just move it from the damage formula into this formula effect.

Because a formula effect is just another effect, it supports other plugins that work with effects, such as Effect Conditions, which allows you to determine whether an effect should be executed based on a condition.


Plugin: download here (right-click, save-as)

This plugin is for RPG Maker MV only. Click here for the Ace version!


Download the plugin and place it in the “plugins” folder in your project’s “js” folder. Then open your Plugin Manager (F10), double-click an empty row, and select the HIME_FormulaEffects plugin.

Once it is in your list of plugins, turn the plugin on.


To create a formula effect, note-tag items or skills with

<formula effect>
</formula effect>

Where the FORMULA will be evaluated during skill execution and the behavior is determined by what you write in the formula.

The following formula variables are available

 a - attacker
 b - target
 i - current item or skill
 v - game variables
 s - game switches
 t - game troop
 p - game party

So for example, if you wanted to reduce the target’s HP by 100, you could use the formula


You can access the result of the action on the target using

var r = b.result()

With this, you can then check how much HP damage or MP damage was dealt


And then use this in your effect calculations.

Anything that is defined in the code can be used as an effect.

You may also like...

20 Responses

  1. Desbrina says:

    Is there a way when using this for something to only apply to an enemy.
    I’m trying to use the following, which works when you defeat an enemy, but when an Elly is defeated it errors due to the b.enemyId() not existing for an actor

    if(b.hp == 0) {
    $gameVariables.setValue(5, b.enemyId());
    $gameSwitches.setValue(3, true);
    </formula effect>

  2. jangee says:

    This is an informative content. I appreciate you allowing me to comment and learn. You will undoubtedly learn more if you sign up for an online course! College of Contract Management is a college institution wherein you can enroll online courses suitable for you and your needs.

  3. Paulo Bender says:

    By checking if b.result’s hpdamage != 0, and then using b.gainstate, I will be able to make skills that only apply their effects if they properly hit, right? Do I need to make a change check (e.g.: for a “poison fang” that deals damage and has a 30% chance of poisoning) or is there any way to use the trait percentage?

    Anyways, incredible work, as always! My most sincere congratulations.

  4. D.Arquien says:

    have link for direct download script ? copy and paste have error

  5. Ano says:

    Can it be used to change Action Times +? Like if the skill is used the attacker gains another turn.

  6. Serpenter says:

    I was wondering if I could use this to make a skill leave an enemy with 1 point of health if it would normally kill it?

  7. Anonymous says:

    Nevermind on calling events, got it to work, great work here!

  8. Anonymous says:

    Is there a way to call a common event?

  9. Sundricat says:

    Using script functions, how would I subtract the value of Variable 42 from the value of Variable 41?

    • Hime says:

      $gameVariables.setValue(42, $gameVariables.value(42) – $gameVariables.value(41));

      Which takes the value of variable 42, subtract value of variable 41, and then put the result into variable 42.

  10. Sundricat says:

    How would I set up the formula effect to make a spell drain 25% of the Users Max MP when cast?

  11. Izmeiah says:

    I have a newbie kind of question. Would it be possible to have this affect a creature(s) such that if their hp is < – x%, that they are affected by a state, such as death?

    • Hime says:

      Yes. You can a condition to check whether the target (b) HP is less than a certain percent, and then add the specified state.
      if (b.hp < b.mhp * 0.10) {

      So you’re checking whether the target’s current HP is less than 10% of their max HP.
      If so, you would add the death state.

      • Izmeiah says:

        Thank you so much for your fast response! I see what I was doing wrong when I was trying to implement this formula.

  12. Sundricat says:

    Is it possible for the formula effect to target the user?

    • Hime says:

      Yes. You can use the variable a in your formulas, similar to the damage formulas.
      It assumes the “attacker” is the user of course.

      • Sundricat says:

        How would I set up the formula effect so that 25% of the total damage dealt is dealt back to the user as recoil?

        • Hime says:

          The total damage can be accessed via b.result().hpDamage.
          Note that you are accessing the action results for the target, not the user.

          So now you just need to use

          a.gainHp(-b.result().hpDamage * 0.25)

          To inflict 25% of damage to the user.

  13. Michael says:

    Thank you so much, this is a really helpful script!

Leave a Reply

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