Making an "AoE Cover skill"

kkiittuuss

Villager
Member
Joined
Aug 16, 2015
Messages
10
Reaction score
3
First Language
Spanish
Primarily Uses
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.
 
Last edited:

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,713
First Language
English
Primarily Uses
RMVXA
@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.

[move]Javascript/Plugin Support[/move]
 

kkiittuuss

Villager
Member
Joined
Aug 16, 2015
Messages
10
Reaction score
3
First Language
Spanish
Primarily Uses
@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.

[move]Javascript/Plugin Support[/move]
Done, thank you so much.
 

JtheDuelist

Your Friendly Nieghborhood Stygian Zinogre
Veteran
Joined
Dec 9, 2017
Messages
1,185
Reaction score
1,440
First Language
English
Primarily Uses
Other
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:
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:
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:
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:
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.
 

kkiittuuss

Villager
Member
Joined
Aug 16, 2015
Messages
10
Reaction score
3
First Language
Spanish
Primarily Uses
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:
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:
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:
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:
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!
 
Last edited:

JtheDuelist

Your Friendly Nieghborhood Stygian Zinogre
Veteran
Joined
Dec 9, 2017
Messages
1,185
Reaction score
1,440
First Language
English
Primarily Uses
Other
@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.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 2)

Latest Threads

Latest Posts

Latest Profile Posts

Are we allowed to post about non-RPG Maker games?
I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

A bit of a "sparkle" update to the lower portion of the world map. :LZSexcite:

Forum statistics

Threads
105,883
Messages
1,017,234
Members
137,608
Latest member
Arm9
Top