Making an "AoE Cover skill"

Hello people,

So the idea is as it follows. This skill shouldn't be a normal "cover" skill where the actor gets all the blows from the enemy, as such effect could be easily recreated with Yanfly's "Taunt" plugin.
The effect of this skill would be to block the incoming damage of an enemy's AoE skill for the "covered" battlers and transfer that negated damage to the battler covering.

I've been searching for a while, and I've found a guy using Yanfly's "Buffs states core". He made a custom effect for the cover skill, writing this costume formula on the state's notebox.


<Custom Respond Effect>
if (this.isHpEffect() && value > 0){
origin.gainHp(-value);
origin.startDamagePopup();
target.gainHp(value);
target.startDamagePopup();
target.clearResult();
}
</Custom Respond Effect>

This formula works pretty close as the idea intended, but instead of blocking damage to the "covered" allies, it heals them. The damage gets redirected to the "tank" just fine, so that far it works.

If you try to change this line:

target.gainHp(value); to -----> target.gainHp(0);

It appears as "0" damage displayed, but actually the battlers lose HP anyways.

So what im asking you guys is if you could think of a way to modify the formula for the intended results, or instead, if you have any other ideas that could work, id also like to hear them.

Thanks.
@kkiittuuss Could you please edit your post to include a link to the particular web page where you got that plugin. That way if anyone needs to check something before offering a suggestion, they won't need to go hunting.

Moved to: Javascript/Plugin Support
@kkiittuuss Could you please edit your post to include a link to the particular web page where you got that plugin. That way if anyone needs to check something before offering a suggestion, they won't need to go hunting.

Moved to: Javascript/Plugin Support

Done, thank you so much.
Sounds like you want to recreate a skill I had in Downfall FES Re:Boot, Devoted Sacrifice (Effect: "The user takes all damage that was intended for all allies this turn. The user will automatically revive if HP hits 0 this turn.")

First, you'll need Yanfly's Passive Aura Effects.

Next you'll need to make three states (two if you do not want the auto-revive)- one being the aura origin:
Spoiler: Aura Origin
upload_2019-8-3_16-17-32.png
Set the origin like this. Replace the 16 with the state ID of the next state, the aura effect state.

Then to make the actual aura effect:
Spoiler: Aura Effect
upload_2019-8-3_16-18-44.png

This is the actual aura effect. The notetag you want to make is:
Code:
<Custom React Effect>

// Check if the action dealt HP damage

if (this.isHpEffect() && value > 0) {

// Get the target's allies

var members = target.friendsUnit().aliveMembers();

// Get the Aura's Origin State ID

var auraOriginId = X;

// Make the origin user undefined

var auraOriginUser = undefined;

// Loop through each member

for (var i = 0; i < members.length; ++i) {

// Get the currently looped member

var member = members[i];

// Check if the member exists, isn't the target, and is the aura holder

if (member && member !== target && member.isStateAffected(auraOriginId)) {

// Set the origin user to that member

auraOriginUser = member;

// Break the loop

break;

}

}

// Check if the origin user exists

if (auraOriginUser) {

// Calculate the amount of reduction

var reduction = Math.ceil(0 * value);

// Set the damage to the target to 0.

value = 0;

// Make the origin user take damage instead.

auraOriginUser.gainHp(-reduction);

// Display an animation on the origin user.

auraOriginUser.startAnimation(53);

// Make the origin user display a damage popup.

auraOriginUser.startDamagePopup();

// Check if the origin user is dead

if (auraOriginUser.isDead()) {

// Collapse the origin user if dead

auraOriginUser.performCollapse();

}

// Clear the origin user's results

auraOriginUser.clearResult();

}

}

</Custom React Effect>
Replace the X in "var auraOriginId = X;" to the state ID of the origin state.

If you want the added auto-revive effect, make a third state like this:
Spoiler: Auto Revive
upload_2019-8-3_16-19-16.png

The notetag:
Code:
<Custom React Effect>

// Check to see if the party is in battle.

if ($gameParty.inBattle()) {

// Sets the flag if the target has more than 1 HP at the time of death.

target._secondChance = target.hp > 0;

}

</Custom React Effect>



<Custom Respond Effect>

// Check to see if the party is in battle, has the Second Chance flag, and if the target is dead with 0 HP.

if ($gameParty.inBattle() && target._secondChance && target.hp <= 0) {

// Play the revival animation.

target.startAnimation(49);

// Set the target's HP to 1.

target.setHp(1);

}

</Custom Respond Effect>

Once you have those states, Make your skill like this:
Spoiler: The Skill
upload_2019-8-3_16-19-57.png

If you don't want the auto-revive, just have the skill Add State the origin state and you are good to go. If you want the auto-revive, also include Add State the resurrection state.

I hope that helped, @kkiittuuss.
Sounds like you want to recreate a skill I had in Downfall FES Re:Boot, Devoted Sacrifice (Effect: "The user takes all damage that was intended for all allies this turn. The user will automatically revive if HP hits 0 this turn.")

First, you'll need Yanfly's Passive Aura Effects.

Next you'll need to make three states (two if you do not want the auto-revive)- one being the aura origin:
Spoiler: Aura Origin
View attachment 120535
Set the origin like this. Replace the 16 with the state ID of the next state, the aura effect state.

Then to make the actual aura effect:
Spoiler: Aura Effect
View attachment 120536
This is the actual aura effect. The notetag you want to make is:
Code:
<Custom React Effect>

// Check if the action dealt HP damage

if (this.isHpEffect() && value > 0) {

// Get the target's allies

var members = target.friendsUnit().aliveMembers();

// Get the Aura's Origin State ID

var auraOriginId = X;

// Make the origin user undefined

var auraOriginUser = undefined;

// Loop through each member

for (var i = 0; i < members.length; ++i) {

// Get the currently looped member

var member = members[i];

// Check if the member exists, isn't the target, and is the aura holder

if (member && member !== target && member.isStateAffected(auraOriginId)) {

// Set the origin user to that member

auraOriginUser = member;

// Break the loop

break;

}

}

// Check if the origin user exists

if (auraOriginUser) {

// Calculate the amount of reduction

var reduction = Math.ceil(0 * value);

// Set the damage to the target to 0.

value = 0;

// Make the origin user take damage instead.

auraOriginUser.gainHp(-reduction);

// Display an animation on the origin user.

auraOriginUser.startAnimation(53);

// Make the origin user display a damage popup.

auraOriginUser.startDamagePopup();

// Check if the origin user is dead

if (auraOriginUser.isDead()) {

// Collapse the origin user if dead

auraOriginUser.performCollapse();

}

// Clear the origin user's results

auraOriginUser.clearResult();

}

}

</Custom React Effect>
Replace the X in "var auraOriginId = X;" to the state ID of the origin state.

If you want the added auto-revive effect, make a third state like this:
Spoiler: Auto Revive
View attachment 120537
The notetag:
Code:
<Custom React Effect>

// Check to see if the party is in battle.

if ($gameParty.inBattle()) {

// Sets the flag if the target has more than 1 HP at the time of death.

target._secondChance = target.hp > 0;

}

</Custom React Effect>



<Custom Respond Effect>

// Check to see if the party is in battle, has the Second Chance flag, and if the target is dead with 0 HP.

if ($gameParty.inBattle() && target._secondChance && target.hp <= 0) {

// Play the revival animation.

target.startAnimation(49);

// Set the target's HP to 1.

target.setHp(1);

}

</Custom Respond Effect>

Once you have those states, Make your skill like this:
Spoiler: The Skill
View attachment 120538
If you don't want the auto-revive, just have the skill Add State the origin state and you are good to go. If you want the auto-revive, also include Add State the resurrection state.

I hope that helped, @kkiittuuss.

Hello, first of all thanks for replying to my question.

I've followed all your steps and it kinda worked but with an "strange" effect. I've read the formula and it looks like once you set the damage for the allies to "0", the damage that they "transfer" to the user of the cover skill is also "0". Did it work fine for you? This is what i am getting.

This when receiving AoE damage.

This when receiving ST damage.

Hope that make sense to you and you can imagine what happens because your code really looks spot on.

Thanks again!


EDIT: Okay solved it! I prayed and it worked (I know like zero coding).

The issue was in this line:

// Calculate the amount of reduction

var reduction = Math.ceil(0 * value);

0 * value is 0, thats why!


Once more, thank you so much for your help, you are a life saver!
@kkiittuuss No problem. The skill actually makes the user take all of the hits that turn, regardless if the damage is AoE, directed, or random. It was actually a replica of the skill it took its name from, Devoted Sacrifice, which was a Rook skill in Unison League.
Sounds like you want to recreate a skill I had in Downfall FES Re:Boot, Devoted Sacrifice (Effect: "The user takes all damage that was intended for all allies this turn. The user will automatically revive if HP hits 0 this turn.")

First, you'll need Yanfly's Passive Aura Effects.

Next you'll need to make three states (two if you do not want the auto-revive)- one being the aura origin:
Spoiler: Aura Origin
View attachment 120535
Set the origin like this. Replace the 16 with the state ID of the next state, the aura effect state.

Then to make the actual aura effect:
Spoiler: Aura Effect
View attachment 120536
This is the actual aura effect. The notetag you want to make is:
Code:
<Custom React Effect>

// Check if the action dealt HP damage

if (this.isHpEffect() && value > 0) {

// Get the target's allies

var members = target.friendsUnit().aliveMembers();

// Get the Aura's Origin State ID

var auraOriginId = X;

// Make the origin user undefined

var auraOriginUser = undefined;

// Loop through each member

for (var i = 0; i < members.length; ++i) {

// Get the currently looped member

var member = members[i];

// Check if the member exists, isn't the target, and is the aura holder

if (member && member !== target && member.isStateAffected(auraOriginId)) {

// Set the origin user to that member

auraOriginUser = member;

// Break the loop

break;

}

}

// Check if the origin user exists

if (auraOriginUser) {

// Calculate the amount of reduction

var reduction = Math.ceil(0 * value);

// Set the damage to the target to 0.

value = 0;

// Make the origin user take damage instead.

auraOriginUser.gainHp(-reduction);

// Display an animation on the origin user.

auraOriginUser.startAnimation(53);

// Make the origin user display a damage popup.

auraOriginUser.startDamagePopup();

// Check if the origin user is dead

if (auraOriginUser.isDead()) {

// Collapse the origin user if dead

auraOriginUser.performCollapse();

}

// Clear the origin user's results

auraOriginUser.clearResult();

}

}

</Custom React Effect>
Replace the X in "var auraOriginId = X;" to the state ID of the origin state.

If you want the added auto-revive effect, make a third state like this:
Spoiler: Auto Revive
View attachment 120537
The notetag:
Code:
<Custom React Effect>

// Check to see if the party is in battle.

if ($gameParty.inBattle()) {

// Sets the flag if the target has more than 1 HP at the time of death.

target._secondChance = target.hp > 0;

}

</Custom React Effect>



<Custom Respond Effect>

// Check to see if the party is in battle, has the Second Chance flag, and if the target is dead with 0 HP.

if ($gameParty.inBattle() && target._secondChance && target.hp <= 0) {

// Play the revival animation.

target.startAnimation(49);

// Set the target's HP to 1.

target.setHp(1);

}

</Custom Respond Effect>

Once you have those states, Make your skill like this:
Spoiler: The Skill
View attachment 120538
If you don't want the auto-revive, just have the skill Add State the origin state and you are good to go. If you want the auto-revive, also include Add State the resurrection state.

I hope that helped, @kkiittuuss.
Is there a way to replicate this by targeting 1 specific ally?
Is there a way to replicate this by targeting 1 specific ally?
You'll get more helpful answers if you start your own thread for your question, rather than commenting in an old thread for a different question.

You'd want to create a skill that targets an ally and gives them a state, as well as placing a state on the actor using the skill. From there, you can use commands from the Buffs and States core to manipulate whatever you like.
UP 2022 ^^
I followed all this tuto and the cover works perfect, the cover take all the damage for all the party

But i want to go more deep inside this concept.

As the Gatcha Game "Final Fantasy Brave Exvius", do we have a way to adapt your Cover for split him into 2 skills :

-One Skill "Magic Cover" who grant to user Aura for cover ONLY Magic damages (but Physical damages still are dealed to party)
-One Skill "Physical Cover" who grant to user Aura for cover ONLY Physical damages (but Magic damages still are dealed to party)

Is this doable ? and if it's, can you help me with that ?
Is this doable ? and if it's, can you help me with that ?
We're not supposed to necro-post - this thread is from a year and a half ago.

In the first conditional that says
Code:
if (this.isHpEffect() && value > 0) {
you simply add a condition to check for it to be physical or magical.

Code:
if (this.isHpEffect() && this.isPhysical() && value > 0) {

or

Code:
if (this.isHpEffect() && this.isMagical() && value > 0) {
Sorry, i dont remember this Necro-post rule T-T
Thanks you, by the way, all is working good now 🙂

Original thread: https://forums.rpgmakerweb.com/threads/making-an-aoe-cover-skill.111776/