Yanfly Engine Plugins is a plugin library made for RPG Maker MV, a wonderful piece of software to help you make that role playing game of your dreams. You can find out more about RPG Maker MV here
Share Life is a skill from Summoners War that evens out the HP percentage of all allies and throws in an additional 15% heal, too! Here’s how you can make this skill!
Get the copy/paste version of the code here:
Place this inside of your skill notebox. Replace the text in red with settings that fit your game.
<Before Eval>
// Check if the shared life rate has been defined.
if (this._sharedLifeRate === undefined) {
// If it hasn't. Set it to 0.
this._sharedLifeRate = 0;
// Get the alive members of the party.
var members = this.friendsUnit().aliveMembers();
// Loop through each member.
for (var i = 0; i < members.length; ++i) {
// Get the current member.
var member = members[i];
// Add the member's current HP rate.
this._sharedLifeRate += member.hpRate();
}
// Once the loop is done, divide the total by the number of members to get the average.
this._sharedLifeRate /= members.length;
// Add to it 15%.
this._sharedLifeRate += 0.15;
}
</Before Eval>
<After Eval>
// Check if the target is alive.
if (target.isAlive()) {
// If the target is, calculate the target HP to bring the target to.
var targetHp = Math.floor(this._sharedLifeRate * target.mhp);
// Calculate the difference between the target's current HP and target HP.
var difference = targetHp - target.hp;
// If the difference is larger than 0...
if (difference > 0) {
// Play a healing animation.
target.startAnimation(41);
// If the target is less than 0...
} else if (difference < 0) {
// Play a damage animation.
target.startAnimation(54);
}
// Check if the difference is not 0...
if (difference !== 0) {
// Alter the target's HP.
target.gainHp(difference);
// Start the damage popup.
target.startDamagePopup()
// Clear the results.
target.clearResult();
}
}
</After Eval>
Happy sharing!
Please wait while you are redirected...or Click Here if you do not want to wait.