MV Yanfly Plugins - Critical Hits restore Mana / Passives that activate when Mana is above a certain level.

Im tinkering with a tactical battle game (Lecode' TBS) and have made mp into Morale. The units have a max of 100 morale(mana) and they start the battle with 50.

I'd like these additional mechanics.

- Taking critical hits makes you lose 5 morale (mana).
- Scoring a critical hit grants you 5 morale (mana).
- Passives that activate when you have 80 or above morale (mana).

Have looked at the yanfly plugins to make this happen but im really bad at figuring out the lunatic stuff :/

And yes, for those of you who are people of fine taste, I am ripping off Dynasty Tactics 😛
Assuming you have the Buffs+States and Passives plugins:
For losing MP upon taking a critical, put this in your state notetag:
JavaScript:
<Custom Respond Effect>
if(target.result().critical) {
target.gainMp(-5);
}
</Custom Respond Effect>
For gaining MP upon landing a critical:
JavaScript:
<Custom Establish Effect>
if(target.result().critical) {
user.gainMp(5);
}
</Custom Establish Effect>
Annnd for having a passive only be active when at or above 80 MP, there's actually a notetag for that in the passive documentation!
<Passive Condition: MP Above 79>

These are super basic versions of what you listed; you can add some animations to these effects, vary the MP gained/lost based on stats, whatever you like. Keep in mind, the MP lose will still happen if the hit is 'fatal', as in, the target dies from the hit. If you don't want that to happen...
JavaScript:
<Custom Respond Effect>
if(target.result().critical && target.hp >0) {
target.gainMp(-5);
}
</Custom Respond Effect>

Let me know if that helps!
It certainly does! Its also a lot easier (for me at least) to learn from looking at specific examples like this 🙂 thanks!

Its amazing how versatile those plugins are, need to learn about how it works.


Edit: Tested it and it seems to work yay!
Assuming you have the Buffs+States and Passives plugins:
For losing MP upon taking a critical, put this in your state notetag:
JavaScript:
<Custom Respond Effect>
if(target.result().critical) {
target.gainMp(-5);
}
</Custom Respond Effect>
For gaining MP upon landing a critical:
JavaScript:
<Custom Establish Effect>
if(target.result().critical) {
user.gainMp(5);
}
</Custom Establish Effect>
Annnd for having a passive only be active when at or above 80 MP, there's actually a notetag for that in the passive documentation!
<Passive Condition: MP Above 79>

These are super basic versions of what you listed; you can add some animations to these effects, vary the MP gained/lost based on stats, whatever you like. Keep in mind, the MP lose will still happen if the hit is 'fatal', as in, the target dies from the hit. If you don't want that to happen...
JavaScript:
<Custom Respond Effect>
if(target.result().critical && target.hp >0) {
target.gainMp(-5);
}
</Custom Respond Effect>

Let me know if that helps!

Found a potential problem 😛

Both work by themselves when I tested them individually but cant seem to get them to work at the same time. I either only gain the Morale for myself or the enemy loses the morale, depending on which state is higher on the list.
Alrighty, I just put them in the same state and had no problems with either side procing; maybe try that and see if it helps? 🙂 You can assign global passives in Yanfly's Passive plugin to save yourself putting the note tag in every enemy and actor.
If not, I'll take a closer look.
Alrighty, I just put them in the same state and had no problems with either side procing; maybe try that and see if it helps? 🙂 You can assign global passives in Yanfly's Passive plugin to save yourself putting the note tag in every enemy and actor.
If not, I'll take a closer look.

Huh....It worked... Which is strange because that's the first thing i tried to solve it 😛 I suppose i could have messed up the copy paste and had the same formula twice or something...

Very helpful nonetheless as i prolly wouldnt attempt the same solution twice xD
Stranger things have happened! As long as it's working now, that's the important part haha. Good luck with your game 🙂

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-plugins-critical-hits-restore-mana-passives-that-activate-when-mana-is-above-a-certain-level.138726/