Formula Effects

formulaEffects1

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.

Download

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

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

Installation

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.

Usage

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

<formula effect>
  FORMULA
</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

b.gainHp(-100);

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

r.hpDamage
 r.mpDamage

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...

43 Responses

  1. Csimqu says:

    buy clozapine no prescription – order clozaril online purchase pepcid generic

  2. Ejusxj says:

    buy generic zidovudine 300 mg – glycomet 500mg tablet buy zyloprim 300mg sale

  3. Your faith in us is our top priority. Therefore, we conduct our services with full integrity and commitment to your satisfaction.

    Rest easy of recovering your QIWI wallet balance with our specialized assistance.

  4. Xqlyov says:

    cheap glucophage 1000mg – buy septra for sale lincocin 500 mg us

  5. Hyaznh says:

    lasix brand – how to buy prograf buy captopril 25 mg pill

  6. Worried about your QIWI wallet transactions?

    Let us handle the stress in getting back what isrightfully yours.
    Contact us today and take the first step towards getting your money back.

  7. Utmsjp says:

    cheap metronidazole – buy azithromycin without prescription azithromycin 500mg oral

  8. Tucuty says:

    order ampicillin online buy generic amoxil how to get amoxicillin without a prescription

  9. Zefqbf says:

    purchase valtrex – nemasole ca buy acyclovir paypal

  10. Jpxewc says:

    ivermectin 6mg stromectol – ciprofloxacin pill buy sumycin 250mg online cheap

  11. Dsipih says:

    ivermectin 3 mg for humans for sale – co-amoxiclav over the counter sumycin us

  12. Ymaiyw says:

    flagyl medication – buy azithromycin sale azithromycin 500mg cost

  13. Uajlbx says:

    buy ciplox medication – buy ciplox pills for sale erythromycin 250mg drug

  14. IsmaelGop says:

    Pretty portion of content. I simply stumbled upon your website and in accession capital to assert that I acquire in fact loved account your blog posts. Any way I’ll be subscribing on your augment or even I fulfillment you get admission to constantly quickly.

    http://alt1.toolbarqueries.google.com.sv/url?q=https://didvirtualnumbers.com/de/

  15. Whqjlr says:

    buy ciprofloxacin without prescription – augmentin 625mg oral where to buy clavulanate without a prescription

  16. Xwkbvb says:

    cost baycip – order amoxiclav online cheap generic augmentin 625mg

  17. Qpaebm says:

    buy lipitor 10mg sale buy atorvastatin 40mg pills atorvastatin 20mg ca

  18. Earnestjet says:

    3d, 3д панель на стену Алматы — отделочный материал для фасадов. Структура материала фактурная, внешний вид полностью копирует деревянную доску.

  19. Shanesoodo says:

    For latest news you have to visit world wide web and on world-wide-web I found this web site as a most excellent site for most recent updates.
    bcgame apk

  20. IsmaelGop says:

    Hey! Do you use Twitter? I’d like to follow you if that would be ok. I’m absolutely enjoying your blog and look forward to new updates.
    bcasino sister sites

  21. Foberttaf says:

    Hi there it’s me, I am also visiting this website on a regular basis, this website is in fact good and the visitors are really sharing pleasant thoughts.
    safest australian online casino

  22. Lewisthult says:

    What’s up i am kavin, its my first occasion to commenting anyplace, when i read this paragraph i thought i could also create comment due to this sensible article.
    https://tinyurl.com/SquirtCamweb

  23. SDichaelShery says:

    Pastillas Cialis Para QuГ© Sirve
    (Moderator)
    Cialis 5 mg prezzo tadalafil 5 mg prezzo cialis 5 mg prezzo

  24. 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>

  25. 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.

  26. 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.

  27. D.Arquien says:

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

  28. Ano says:

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

  29. 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?

  30. Anonymous says:

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

  31. Anonymous says:

    Is there a way to call a common event?

  32. 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.

  33. Sundricat says:

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

  34. 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) {
      b.addState(1)
      }

      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.

  35. 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.

  36. Michael says:

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

Leave a Reply to Ano Cancel reply

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