Long story short, I don't know much about Javascript so I'm kinda struggling with some customized skill and state effects. I have all of Yanfly plugins and am currently using RPG Maker MV.
I'm creating a Necromancer, so I have a lot of skills that deal damage to enemies and heal the user/allies right after. I can simply use "Drain HP" with some of them, but with others I need plugins, either to target allies and not only the user, either to have different effects when targeting allies or enemies etc. So far I've been using some of Yanfly's Tips & Tricks as a guide, tweaking here and there until I get my desired effect, but there are a few things that I'm failing to understand. For example, I can see that in the Healing Fate effect, the received damage is get from the "target.result().hpDamage" call, whereas in the Holy Prism effect, it's simply through a "value" variable. So, I was wondering if maybe someone could help me understand why this happens? It's so confusing 😐
Each skill notetag's code:
I could also use some help tweaking the Leech Seed skill (I'd like the user to give 10% of his HP to an ally and/or be able to drain his ally's HP, same skill or not) and the Void Shift skill (I'd like to transfer values rather than HP rates). Maybe I should create a new topic for this? 😐 Thanks in advance for anyone who read through it all
I'm creating a Necromancer, so I have a lot of skills that deal damage to enemies and heal the user/allies right after. I can simply use "Drain HP" with some of them, but with others I need plugins, either to target allies and not only the user, either to have different effects when targeting allies or enemies etc. So far I've been using some of Yanfly's Tips & Tricks as a guide, tweaking here and there until I get my desired effect, but there are a few things that I'm failing to understand. For example, I can see that in the Healing Fate effect, the received damage is get from the "target.result().hpDamage" call, whereas in the Holy Prism effect, it's simply through a "value" variable. So, I was wondering if maybe someone could help me understand why this happens? It's so confusing 😐
Each skill notetag's code:
Code:
<Custom Apply Effect>
// Set the Healing Fate HP damage to 0.
target._healingFateDmg = 0;
</Custom Apply Effect>
<Custom Remove Effect>
// Set the Healing Fate HP damage to 0.
target._healingFateDmg = 0;
</Custom Remove Effect>
<Custom Respond Effect>
// Check if the effect is an HP effect and if the target received HP damage.
if (this.isHpEffect() && target.result().hpDamage > 0) {
// Increase the target's Healing Fate HP damage by damage received.
target._healingFateDmg += target.result().hpDamage;
// Check if the amount of total HP Healing Fate damage exceeds more than 20% of the target's MaxHP.
if (target._healingFateDmg >= target.mhp * 0.20) {
// If it does, remove this state.
target.removeState(stateId);
// Get all the original caster's allies.
var members = origin.friendsUnit().aliveMembers();
// Calculate the amount of HP healed.
var hpHealed = origin.mdf * 2;
// Loop through each one of them.
for (var i = 0; i < members.length; ++i) {
// Get the currently looped member.
member = members[i];
// If the member exists...
if (member) {
// Then the member gains the calculated HP.
member.gainHp(hpHealed);
// Play an animation on the member.
member.startAnimation(46);
// Start the damage popup.
member.startDamagePopup();
// Clear the results.
member.clearResult();
}
}
}
}
</Custom Respond Effect>
Code:
// Allows the player to pick an enemy or an ally.
<Enemy or Actor Select>
<Damage Formula>
// Check if the user and target are enemies.
if (a.isActor() !== b.isActor()) {
// If they are, this is the amount of damage dealt.
value = a.mat * 4;
// If they are allies...
} else {
// This is the amount of HP healed.
value = a.mat * 6;
}
</Damage Formula>
<Pre-Damage Eval>
// If the user and the target are enemies...
if (a.isActor() !== b.isActor()) {
// Get half of the damage dealt.
var hp = Math.floor(value / 2);
// Get the alive members of the user's party.
var members = user.friendsUnit().aliveMembers();
// Loop through each member.
for (var i = 0; i < members.length; ++i) {
// Get the current member.
var member = members[i];
// If the member exists...
if (member) {
// ...then the member recovers HP.
member.gainHp(hp);
// Start the damage popup.
member.startDamagePopup();
// Clear the results.
member.clearResult();
// Start an animation.
member.startAnimation(41);
}
}
// If the user and the target are allies...
} else {
// Then get half of the value healed.
var hp = Math.floor(value / 2);
// Turn it into damage.
value *= -1;
// Get the user's opponent party's living members.
var members = user.opponentsUnit().aliveMembers();
// Loop through those members.
for (var i = 0; i < members.length; ++i) {
// Get the current member.
var member = members[i];
// If the member exists...
if (member) {
// Modify the damage received relative to the Holy element.
var dmg = -hp * member.elementRate(13);
// Make the member take damage.
member.gainHp(dmg);
// Start the damage popup.
member.startDamagePopup();
// Clear the results.
member.clearResult();
// Start an animation.
member.startAnimation(97);
// Check if the member is dead.
if (member.isDead()) {
// If it is, make it collapse.
member.performCollapse();
}
}
}
}
</Pre-Damage Eval>
I could also use some help tweaking the Leech Seed skill (I'd like the user to give 10% of his HP to an ally and/or be able to drain his ally's HP, same skill or not) and the Void Shift skill (I'd like to transfer values rather than HP rates). Maybe I should create a new topic for this? 😐 Thanks in advance for anyone who read through it all