Tutorial – Mana Conversion State

The Mana Conversion state is a state that gives battlers a special effect as long as the state is active.

When the battler performs an attack and successfully damages a target, a proportion of the damage will be converted to MP that the attacker will receive.

So for example, if you attacked a slime for 100 damage, and 20% of the damage is converted to MP, then you will receive 20 MP from that attack!

To create your own mana conversion state, simply install the State Damage Modifiers plugin and then note-tag your states with

  var mpGain = Math.floor(d * 0.2);
  a.gainMp(mpGain);
  return d;

This note-tag tells the game that the state’s effect should only be applied when the battler performs an attack.
Let’s look at what the formula is doing:

   var mpGain = Math.floor(d * 0.2);

Here, we take `d`, which represents the “damage value”, and multiply it by 0.2. This is basically taking 20% of the damage.
We take the “floor” of it because otherwise it will be a decimal value. You should always round your values if your game only works with whole numbers.

   a.gainMp(mpGain);

This means the “attacker” will gain the specified amount of MP. It is recommended to use this method for gaining MP because the game will automatically display the MP gain popup as well.

   return d;

Finally, we return the original damage value since we haven’t changed it and the plugin requires you to return a damage value.

If successful, you should be able to damage the target AND restore MP at the same time.

You may also like...

8 Responses

  1. maree says:

    It is a very interesting article to follow. It’s amazing and very useful.
    บาคาร่าออนไลน์

  2. manoma says:

    can you do a MV version of Attack Element Modifiers? I really wanted that plugin (would made my life much easier). Sorry if it is the wrong place to ask.

    • manoma says:

      oh, i found out that victor did one, sry for that.

    • Anonymous says:

      but still would apreciate if you did, your look more easy to use

      • Hime says:

        I will look at how it might be implemented.

        • manoma says:

          thanks, i managed managed to use yanfly battle manager to do it in a rather complicated way, i used the normal skill and changed its formula and its element, then i applied its damage again, but if you manage to make that more easy i would be grateful. I’ll post the commands i did to see if it helps you somehow (this have a for loop because i did a text file for the notetags, so it will check where the skill 60 is in the actor skills to change its values) :

          if $gameVariables.value(6)
          eval: UID = user.actorId(); count = $gameActors.actor(UID).skills().length; for (i = 0;i<count;i++) { if ($gameActors.actor(UID).skills()[i].id === 60){us = i; element = $gameActors.actor(UID).skills()[i].damage.elementId; $gameActors.actor(UID).skills()[i].damage.elementId = 9; formula = $gameActors.actor(UID).skills()[i].damage.formula; $gameActors.actor(UID).skills()[i].damage.formula = “(a.mat * 4 – b.mdf * 2)”;}}
          action effect: target
          death break
          eval: $gameActors.actor(UID).skills()[us].damage.elementId = element; $gameActors.actor(UID).skills()[us].damage.formula = formula;

  3. Solis says:

    Is this compatible with Yanfly?

Leave a Reply to Solis Cancel reply

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