MV Passive State Applied Through HP Loss?

I'm having a bit of difficulty making a state work.
I'm trying to make a skill that applies a state after you take damage during a certain duration. (Like a defense skill that grants a buff if you're attacked.), but I can't figure out how to do this without clogging up my Common Events.
Any ideas?
Check out Yanfly's Auto Passive States, and Buffs & States Core.

You'd make learning the skill apply a passive state, which is invisible to the player.

Then the Buffs & States Core has notetags where you say after receiving damage, apply this other state (which is your defense buff, has an icon and duration like normal).

All the notetags for achieving this are in the instructions for those two plugins.
Check out Yanfly's Auto Passive States, and Buffs & States Core.

You'd make learning the skill apply a passive state, which is invisible to the player.

Then the Buffs & States Core has notetags where you say after receiving damage, apply this other state (which is your defense buff, has an icon and duration like normal).

All the notetags for achieving this are in the instructions for those two plugins.
Thanks!
But just in case, is there another way to do this? One of the plugins I'm using does not work with that plugin, but if there's none, I can just turn it off.
Not that I can think of. There's not normally anything that an actor can do to themself after being the recipient of an attack. You could use a troop event, but I'm not sure how you'd know who was just hit because I believe all relevant information from the BattleManager is wiped by then.

Unless you have every enemy skill apply an invisible state and that gets quite complex. Suffice it to say that any other solution is more complicated than not using a plugin.

Which plugin isn't compatible with those, anyway?
If it's Yanfly's Auto Passive States that's causing the incompatibility, you could try Victor Engine's Passive States instead.
Not that I can think of. There's not normally anything that an actor can do to themself after being the recipient of an attack. You could use a troop event, but I'm not sure how you'd know who was just hit because I believe all relevant information from the BattleManager is wiped by then.

Unless you have every enemy skill apply an invisible state and that gets quite complex. Suffice it to say that any other solution is more complicated than not using a plugin.

Which plugin isn't compatible with those, anyway?
The Plugin I'm using changes the game quite a lot. It's the ALPHA ABS plugin. It doesn't mesh well with some of Yanfly's plugins for some reason.
Well...it should be possible to do this through eventing, but it would be pretty complex and involve modifications to every enemy attack skill.

I'd suggest you try this solution to see if it does actually conflict - those two plugins I mentioned don't have any other prerequisites, so you wouldn't need the Core or Battle Engine that would have the greatest chances of conflicting with your battle system.

And if you do have conflicts, you could try the Victor plugin suggested above, but you'd still need Yanfly's Buffs. And if that still doesn't work right...I suppose it's a choice between the complex eventing method, changing your idea, or changing which ABS you're using.
Moved to: Plugin Support
Well...it should be possible to do this through eventing, but it would be pretty complex and involve modifications to every enemy attack skill.

I'd suggest you try this solution to see if it does actually conflict - those two plugins I mentioned don't have any other prerequisites, so you wouldn't need the Core or Battle Engine that would have the greatest chances of conflicting with your battle system.

And if you do have conflicts, you could try the Victor plugin suggested above, but you'd still need Yanfly's Buffs. And if that still doesn't work right...I suppose it's a choice between the complex eventing method, changing your idea, or changing which ABS you're using.
I've done a little tinkering and I've made it so that those plugins are finally compatible with the ABS I'm using. Now, all that left is to test out whether it will actually work.

Also, It seems that to be able to apply the state while damaged, I'd have to use JavaScript. Do you have any idea of how I'd go about that? (I'm 100% illiterate when it comes to JavaScript).
Unless I'm missing something?
Also, It seems that to be able to apply the state while damaged, I'd have to use JavaScript. Do you have any idea of how I'd go about that?
Well, from your original post, I'm not sure what "after you take damage during a certain duration" means. So this will give you the state when you take damage, so long as you don't already have it (meaning that taking additional damage will not refresh the duration).

Put this in the notetag of your passive state:
Code:
<Custom Respond Effect>
if (!user.isStateAffected(X))
    user.addState(X);
</Custom Respond Effect>
where X is the ID of your buff state.

Original thread: https://forums.rpgmakerweb.com/threads/passive-state-applied-through-hp-loss.140995/