How to Create The Following Skills in MZ?

Hey everyone,

I'm in the process of developing skills for a Warrior class type character and am having trouble implementing some of the things required in order to make the skills work. The following is a list of the skills I want to implement, followed by their description, after which I will explain what I have tried and what I need help with:

Undying Unyielding Unrelenting(Memento Mori) *passive* - When user is hit damage 4 times from any source of damage he/she will unleash a counterattack to a single target, the damage is based off his/her max HP and ATK stats. The user then heals for 30% of their HP when doing so. Every time the user deals this attack, they gets a 3% defence down debuff (stacks up to 5 times)
Skill: Desolation- User swings his/her axe with tremendous strength at an opponent. Strong single target magic damage based attack. Damages enemies next to the target, dealing 1/2 of the original damage to the first target, to subsequent targets. (cleave damage)
Skill: Liver Burst- User can choose a target to deal damage to. The lower HP the user has, the more damage that is dealt. The target is stunned for 2 turns. (How to make a damage formula that checks user's current HP, and deals damage based on how much is missing?)


So here's what I need help with if someone is willing:

Undying Unyielding Unrelenting(Memento Mori) *passive* - How do I go about checking if a user/target has been hit 4 times? I would assume you make a common event, make some script within a conditional branch, then apply a state on the 4th hit that adds the effect of a counter attack, right? But I'm not sure how to go about it, and what I would need to do. I have tried using Visustella's Batle Core Plugin Commands, (see attached), but they don't seem to do anything and I'm not sure why. (Also the act of applying a state, removing it, etc. on a single target seems to do nothing as well. Does anyone know what the issue is and how to fix it?)
Skill: Desolation- How would I go about dealing damage to a single target, then surrounding targets based on the damage dealt to the original, (think of like a cleave hit, as the description states)?
Skill: Liver Burst- How do I go about checking the user's HP, and dealing damage based on how much of their HP is missing?

And that's about it for now. Does anyone know any working solutions to the aforementioned skills? Thanks again!
The third skill should be easy, test out this damage formula:

5 * (a.mhp/a.hp)

The part in brackets divides the maximum HP of the user by the current HP of the user. The skill does more damage the lower the HP of the user, while it does only 5 damage if it's full. Now, the damage gets truly ludicrous at the lower HP values, so you'd probably want to adjust the formula to prevent it from scaling too much.

For the other ones, assuming the default battle system, that would probably be way too difficult to bother with. I don't think the default battle system actually has a concept of enemy positioning and who's next to each other (those systems would need to be added) and also no real passive skills (it's technically possible to make them with common events, but too much of a hassle really).

I think you should either scale down your vision (perhaps turning the second skill into a standard AoE skill that target all enemies) or look for some plugins that expand/replace the combat system.
It's possible to do the Warrior's passive, but 1st I need to know four things.

1. When you said that it triggers when the warrior is hit 4 times, do you mean when the warrior is hit 4 times or when the warrior is hit by 4 skills?

To clarify, suppose you have an enemy that's a Dual Swordsman that can attack twice as their normal attack. Will the passive active when the warrior is stuck by the Dual Swordsman twice (4 damage outputs), or when the Dual Swordsman strikes the warrior 4 times (they used their skill 4 times which results in 8 damage output).

2. Is the HP recovery based on their MaxHP or their current HP?

3. For the Defense down debuff, are you using States or the Debuff system. And if you're using the Debuff system, what do you mean "stacks up to 5 times?" Is it that the target can only have a max of 5 turns of the Defense Debuff or is it something else?

4. Finally, do you want "Undying Unyielding Unrelenting(Memento Mori)" to hit the last attacking enemy or just a random enemy?
-------------------------------------

As for the "Desolation" skill, I won't say that it's impossible, but considering there's no Enemy Row Formation (that I'm aware of) for MZ. Which begs the question, what do you qualify as enemies standing next to the target? Like Beregon said, you might have to scale the skill down a bit.

I would do it by making the Desolation skill still only target one enemy (so the player can choose which foe would take the full damage. Then in the skill's Action Sequence I would do something like this:
Screenshot 2024-01-27 123157.png
As you appear to be designing quite complicated skills, you should also check out this thread that contains more information on how you can use the damage formula to archieve some of the things you want. It's for MV, but it should be the same in MZ too: https://forums.rpgmakerweb.com/index.php?threads/damage-formulas-101.81905/
It's possible to do the Warrior's passive, but 1st I need to know four things.

1. When you said that it triggers when the warrior is hit 4 times, do you mean when the warrior is hit 4 times or when the warrior is hit by 4 skills?

To clarify, suppose you have an enemy that's a Dual Swordsman that can attack twice as their normal attack. Will the passive active when the warrior is stuck by the Dual Swordsman twice (4 damage outputs), or when the Dual Swordsman strikes the warrior 4 times (they used their skill 4 times which results in 8 damage output).

2. Is the HP recovery based on their MaxHP or their current HP?

3. For the Defense down debuff, are you using States or the Debuff system. And if you're using the Debuff system, what do you mean "stacks up to 5 times?" Is it that the target can only have a max of 5 turns of the Defense Debuff or is it something else?

4. Finally, do you want "Undying Unyielding Unrelenting(Memento Mori)" to hit the last attacking enemy or just a random enemy?
-------------------------------------

As for the "Desolation" skill, I won't say that it's impossible, but considering there's no Enemy Row Formation (that I'm aware of) for MZ. Which begs the question, what do you qualify as enemies standing next to the target? Like Beregon said, you might have to scale the skill down a bit.

I would do it by making the Desolation skill still only target one enemy (so the player can choose which foe would take the full damage. Then in the skill's Action Sequence I would do something like this:
View attachment 293270
1.) Any 4 attacks, doesn't matter if they're physical or magical. This passive is akin to the character "Blade" from the popular mobile game Honkai: Star Rail.
2.) It is based on their MaxHP
3.) The debuff is an incrementally added debuff that is applied per use of the passive, where each stack applies the 3% debuff per stack, (essentially 1 stack = 3% defence down, 2 = 6%, etc.) and is removed at the end of battle.
4.)Counter attack a random enemy.

I hope this answers your questions, thanks for the help you've provided thus far.
So, okay. For the Warrior passive, add this code to the Warrior class' Notes:
Code:
//Undying Unyielding Unrelenting(Memento Mori) code
//Begin the counter.
<JS Pre-Start Battle>
 user._unYielding = 0;
</JS Pre-Start Battle>

//Count the number of times the user has been hit.
<JS Post-Damage as Target>
if (value > 0) {
   target._unYielding += 1;
}
</JS Post-Damage as Target>

//Use the counter skill "Memento Mori."
<JS Post-Apply as Target>
if (target._unYielding >= 4) {
   target.forceAction(5, -1);   //Change the 5 to the id of the Memento Mori skill.
   BattleManager.forceAction(target);
   target._unYielding = 0;  //Resets counter
}
</JS Post-Apply as Target>
Fun fact: if you want an enemy to have this, just copy the code and paste it in the Enemy's Notes.

Next is the "Memento Mori" skill the Warrior will use. The warrior doesn't have to learn or be taught this skill, since we're using the forceAction code.

To heal the user after they use the skill, put this in the skill's Notes:
Code:
<JS Post-Apply>
$gameTemp.requestAnimation([user], 940);  //Replace 940 with the id of your own healing animation.
user.requestMotion('Skill');
user.gainHp(Math.round(user.mhp * 0.30)); //Heals 30% of user's Max HP.
user.startDamagePopup(); //Make sure that the healing will popup.
</JS Post-Apply>

Coming up with the Defense Down debuff stacking was... tricky. With Visustella plugins, stacking is with Passive states, so I have to come up with a work around by creating 6 states.
Screenshot 2024-01-29 150816.png


So the first state I call the Helper state, because from behind the scenes it will "upgrade" the debuff if it has to. It is also the state that's apply to target when you use the Memento Mori skill.
Screenshot 2024-01-29 151146.png


For the Helper state, make sure you check the Removal at Battle End, and the Auto-Removal Timing will be 1 Turn. Also put this in the State's Notes:
Code:
//Hides this state.
<Hide State Popup>
<Bypass Combat Log>

//Make sure to replace the numbers 341 -345 with the numbers your states' ids.
<JS On Add State>
if (target.isStateAffected(345)) {
   target.removeState(state.id); //If target's DEF is 15% down remove this state & do nothing.
} else if (target.isStateAffected(344)) {
   target.addState(345); //If target's DEF is 12% down upgrade to 15%.
   target.removeState(state.id);
} else if (target.isStateAffected(343)) {
   target.addState(344); //If target's DEF is 9% down upgrade to 12%.
   target.removeState(state.id);
} else if (target.isStateAffected(342)) {
   target.addState(343); //If target's DEF is 6% down upgrade to 9%.
   target.removeState(state.id);
} else if (target.isStateAffected(341)) {
   target.addState(342); //If target's DEF is 3% down upgrade to 6%.
   target.removeState(state.id);
} else {
   target.addState(341); //Add 3% DEF down to the target.
   target.removeState(state.id);
}
</JS On Add State>

And finally for all of your Defense Down states (that's not the Helper state), put this in their Notes:
Code:
<Category: DefDebuff>
<Remove Other DefDebuff States>

Make sure you check the Removal at Battle End for these states, and change the Defense Parameter for each state (97% for 3%, 94% for 6%, 91% for 9%, 88% for 12%, and 85% for 15%).

And that's the long and short of it.
So, okay. For the Warrior passive, add this code to the Warrior class' Notes:
Code:
//Undying Unyielding Unrelenting(Memento Mori) code
//Begin the counter.
<JS Pre-Start Battle>
 user._unYielding = 0;
</JS Pre-Start Battle>

//Count the number of times the user has been hit.
<JS Post-Damage as Target>
if (value > 0) {
   target._unYielding += 1;
}
</JS Post-Damage as Target>

//Use the counter skill "Memento Mori."
<JS Post-Apply as Target>
if (target._unYielding >= 4) {
   target.forceAction(5, -1);   //Change the 5 to the id of the Memento Mori skill.
   BattleManager.forceAction(target);
   target._unYielding = 0;  //Resets counter
}
</JS Post-Apply as Target>
Fun fact: if you want an enemy to have this, just copy the code and paste it in the Enemy's Notes.

Next is the "Memento Mori" skill the Warrior will use. The warrior doesn't have to learn or be taught this skill, since we're using the forceAction code.

To heal the user after they use the skill, put this in the skill's Notes:
Code:
<JS Post-Apply>
$gameTemp.requestAnimation([user], 940);  //Replace 940 with the id of your own healing animation.
user.requestMotion('Skill');
user.gainHp(Math.round(user.mhp * 0.30)); //Heals 30% of user's Max HP.
user.startDamagePopup(); //Make sure that the healing will popup.
</JS Post-Apply>

Coming up with the Defense Down debuff stacking was... tricky. With Visustella plugins, stacking is with Passive states, so I have to come up with a work around by creating 6 states.
View attachment 293478

So the first state I call the Helper state, because from behind the scenes it will "upgrade" the debuff if it has to. It is also the state that's apply to target when you use the Memento Mori skill.
View attachment 293479

For the Helper state, make sure you check the Removal at Battle End, and the Auto-Removal Timing will be 1 Turn. Also put this in the State's Notes:
Code:
//Hides this state.
<Hide State Popup>
<Bypass Combat Log>

//Make sure to replace the numbers 341 -345 with the numbers your states' ids.
<JS On Add State>
if (target.isStateAffected(345)) {
   target.removeState(state.id); //If target's DEF is 15% down remove this state & do nothing.
} else if (target.isStateAffected(344)) {
   target.addState(345); //If target's DEF is 12% down upgrade to 15%.
   target.removeState(state.id);
} else if (target.isStateAffected(343)) {
   target.addState(344); //If target's DEF is 9% down upgrade to 12%.
   target.removeState(state.id);
} else if (target.isStateAffected(342)) {
   target.addState(343); //If target's DEF is 6% down upgrade to 9%.
   target.removeState(state.id);
} else if (target.isStateAffected(341)) {
   target.addState(342); //If target's DEF is 3% down upgrade to 6%.
   target.removeState(state.id);
} else {
   target.addState(341); //Add 3% DEF down to the target.
   target.removeState(state.id);
}
</JS On Add State>

And finally for all of your Defense Down states (that's not the Helper state), put this in their Notes:
Code:
<Category: DefDebuff>
<Remove Other DefDebuff States>

Make sure you check the Removal at Battle End for these states, and change the Defense Parameter for each state (97% for 3%, 94% for 6%, 91% for 9%, 88% for 12%, and 85% for 15%).

And that's the long and short of it.
Wow, this is absolutely incredible! I appreciate the effort you went through to put this together for me! It works as intended although my final question is: In the skill's settings, what scope do I put it under: User, Enemy, None, or something else? Could you just screenshot your whole skill settings? Also, do I have to fill out the damage formula as you have it in your first screenshot?
For the skill's scope I just used: 1 Random Enemy.

In terms of the damage formula it could be anything you want. But I looked up that Honkai: Star Rail game or whatever to see if I can come up with a suitable formula and I used:
Code:
Math.round(a.atk * 0.22) + Math.round(a.mhp * 0.55) - b.def * 2
It's a quick and dirty damage formula, but hey, it works.

I hope this helps.
For the skill's scope I just used: 1 Random Enemy.

In terms of the damage formula it could be anything you want. But I looked up that Honkai: Star Rail game or whatever to see if I can come up with a suitable formula and I used:
Code:
Math.round(a.atk * 0.22) + Math.round(a.mhp * 0.55) - b.def * 2
It's a quick and dirty damage formula, but hey, it works.

I hope this helps.
I see. So after some testing, everything works as intended except one last part, where the defence down debuff is to be applied to the user/caster itself and not to the target. Is there a way to fix that?
the defence down debuff is to be applied to the user/caster itself and not to the target. Is there a way to fix that?
It shouldn't be applied to the user... Could you send me a screenshot of the skill in the database?
It shouldn't be applied to the user... Could you send me a screenshot of the skill in the database?
I want it to be applied to the user though, as a sort of cost for having a counter attack that heals. That was the whole purpose of adding the debuff, so that the skill wasn't too overpowered. Either way, here's a screenshot of the skill as requested:
1706837978298.png
Oh, the user. I got it.

1st get rid of Add State in the skill's Effects and then modify the Post-Apply code to look like this:
Code:
<JS Post-Apply>
$gameTemp.requestAnimation([user], 940);  //Replace 940 with the id of your own healing animation.
user.requestMotion('Skill');
user.gainHp(Math.round(user.mhp * 0.30)); //Heals 30% of user's Max HP.
user.startDamagePopup(); //Make sure that the healing will popup.
user.addState(340); //Replace 340 with the id of the Defense Down Helper state.
</JS Post-Apply>
Oh, the user. I got it.

1st get rid of Add State in the skill's Effects and then modify the Post-Apply code to look like this:
Code:
<JS Post-Apply>
$gameTemp.requestAnimation([user], 940);  //Replace 940 with the id of your own healing animation.
user.requestMotion('Skill');
user.gainHp(Math.round(user.mhp * 0.30)); //Heals 30% of user's Max HP.
user.startDamagePopup(); //Make sure that the healing will popup.
user.addState(340); //Replace 340 with the id of the Defense Down Helper state.
</JS Post-Apply>
The solution works! Thank you once again for all your help!
No problem.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-create-the-following-skills-in-mz.165174/