RPG Maker Forums

Yanfly made a lot of useful Tips n Tricks videos, including how to make the Leech Seed skill from the Pokemon games. I'd like to make a skill in the same way, but have it leech MP instead of HP.

Yanfly's setup is this. First there's a skill, this skill is very simple and all it does is applying a state to the target. The state on the other hand has some special code snippet in it's note box to make it work (it also requires some of Yanfly's plugin).

Code:
<Custom Regenerate Effect>

// Check if the original caster isn't the target and that the original target is alive.
if (origin !== target && origin.isAlive()) {
  // Determine the damage dealt.
  var damage = target.hp / 8;
  // Round up the damage.
  damage = Math.ceil(damage);
  // Cap the damage to 500.
  damage = Math.min(500, damage);
  // Play the healing animation on the original caster.
  origin.startAnimation(46);
  // Original caster gains HP.
  origin.gainHp(damage);
  // Show the HP gained.
  origin.startDamagePopup();
  // Clears the original caster's HP popup.
  origin.clearResult();
  // Play the poison animation on the target.
  target.startAnimation(59);
  // Damage the target's HP.
  target.gainHp(-damage);
  // Check if the target is dead.
  if (target.isDead()) {
  // If the target is dead, make it collapse.
    target.performCollapse();
  }
}
</Custom Regenerate Effect>

Now, I don't really know JavaScript myself so even while everything is nicely commented (which helps a lot with understanding) I can't really say I'd know how to do what I'd like to do.

But I suspect this is could be super simple for someone who knows just a wee bit of JavaScript, so hopefully someone can help me out here.

I'd be very grateful.
Thanks for taking your time and reading all the way down here. :kaohi:

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,050
Messages
1,018,548
Members
137,835
Latest member
yetisteven
Top