MV Making a skill that damages both the enemy and the user using Yanfly's Action Sequence plugins

Hello! I'm trying to make a skill that does damage to the enemy, and then does the same amount of damage to the user. I know this can be accomplished with Yanfly's Action Sequence plugins, but I'm not exactly sure how to...If anyone could assist me I'd appreciate it!

Edit: SOLVED as per this reply: https://forums.rpgmakerweb.com/inde...s-action-sequence-plugins.177059/post-1509929
Assuming Yanfly's Action Sequencing is extremely similar or the same as VisuStella's for MZ (since that's the one I'm familiar with), you have a few options.

It would depend on the formula you're using, if it was a flat amount of damage you can just use another skill and use "Mech: Emulate Skill Effect" for another skill that deals the same amount to the user, or "Mech: HP, MP, TP", but I'm assuming you're using a formula based off of stats.

You will probably need some Javascript to set the damage dealt into a variable, and then make a second skill to use through Mech: Emulate Skill Effect to apply the damage equal to that variable to the user.

You can try using this in the damage formula for your skill:

For the first skill as an example:
JavaScript:
let dmg = a.atk * 4 - b.def; $gameVariables.setValue(10, dmg); dmg

"10" is an example of the location of the ingame variable. Set it to whichever variable index you want to use, and you can just change the damage formula to whatever you need.

For the second skill:

JavaScript:
$gameVariables.value(10)

This will make the 2nd skill, which is set to damage the user, deal damage equal to the variable's value which is now set to be the same amount of damage dealt as the first skill, and again, with 10 here referring to the variable index.

Other than that, I don't think Action Sequencing has a way of really knowing how much damage a skill dealt, and then applying that amount to the user. Who knows, I could be wrong.

You could also try to use Mech: Action Effect twice, but one targeting the attack target, and the next targeting the user, but you will end up with different values since the one targeting the user will go off of the user's defense value.
Do you use other Yanfly's plugins, especially the Skill Core? If yes, things will be much easier.
Assuming Yanfly's Action Sequencing is extremely similar or the same as VisuStella's for MZ (since that's the one I'm familiar with), you have a few options.

It would depend on the formula you're using, if it was a flat amount of damage you can just use another skill and use "Mech: Emulate Skill Effect" for another skill that deals the same amount to the user, or "Mech: HP, MP, TP", but I'm assuming you're using a formula based off of stats.

You will probably need some Javascript to set the damage dealt into a variable, and then make a second skill to use through Mech: Emulate Skill Effect to apply the damage equal to that variable to the user.

You can try using this in the damage formula for your skill:

For the first skill as an example:
JavaScript:
let dmg = a.atk * 4 - b.def; $gameVariables.setValue(10, dmg); dmg

"10" is an example of the location of the ingame variable. Set it to whichever variable index you want to use, and you can just change the damage formula to whatever you need.

For the second skill:

JavaScript:
$gameVariables.value(10)

This will make the 2nd skill, which is set to damage the user, deal damage equal to the variable's value which is now set to be the same amount of damage dealt as the first skill, and again, with 10 here referring to the variable index.

Other than that, I don't think Action Sequencing has a way of really knowing how much damage a skill dealt, and then applying that amount to the user. Who knows, I could be wrong.

You could also try to use Mech: Action Effect twice, but one targeting the attack target, and the next targeting the user, but you will end up with different values since the one targeting the user will go off of the user's defense value.
thanks for your reply! i'm heading to bed but i'll test this out later and let ya know how it goes 😀

Do you use other Yanfly's plugins, especially the Skill Core? If yes, things will be much easier.
i do! i use a lot of their plugins
Oh. Sorry! The one I mention should be Damage Core. But I guess you are using it too. So we can alter the damage formula for the skills using this note tag:

Code:
<damage formula>
value = user.atk - target.def; //Your damage dealt here. You can freely edit
user.gainHp(-value); //deal the same damage to the user
</damage formula>
Oh. Sorry! The one I mention should be Damage Core. But I guess you are using it too. So we can alter the damage formula for the skills using this note tag:

Code:
<damage formula>
value = user.atk - target.def; //Your damage dealt here. You can freely edit
user.gainHp(-value); //deal the same damage to the user
</damage formula>
ah, i forgot to mention - i already have exactly this but i noticed action sequences kind of overwrite everything so i thought it'd overwrite this formula too. i may be incorrect though
ah, i forgot to mention - i already have exactly this but i noticed action sequences kind of overwrite everything so i thought it'd overwrite this formula too. i may be incorrect though
Don't worry about that. When you want the damage to be dealt in a step during an action sequence, just use "ACTION EFFECT".
Don't worry about that. When you want the damage to be dealt in a step during an action sequence, just use "ACTION EFFECT".
oh, i see! thanks a bunch for your help 🙂
Oh. Sorry! The one I mention should be Damage Core. But I guess you are using it too. So we can alter the damage formula for the skills using this note tag:
fwiw, id recommend using <Post-Damage Eval> from the skill core for that. the <Damage formula> tag is an eval to replace the damage formula's initial evaluation. The damage the user takes there wont take any variance, element rate, damage type rate, or buffs and state core effects into consideration.
Code:
<Post-Damage Eval>
user.gainHp(-value)
</Post-Damage Eval>

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/making-a-skill-that-damages-both-the-enemy-and-the-user-using-yanflys-action-sequence-plugins.177059/