How do i apply an state to a battler when an attacking skill hits?

Hello, im new to this programming world and i am trying to figure how to apply an state to one of my party members when an enemy hits them with a specific skill, any help is appreciated
1688172442900.png


By putting an add state into your skill effects.
oh yeah, sorry but i forgot to put that i want that state to apply only when the target have a certain amount of hp or lower
There are multiple ways to achieve what you want, but there are different requirements or side-effects depending on which way you go.

I strongly suggest you check if there are any other restrictions you forgot to mention because that would help us to decide which way has the fewest sideeffects.

That said, it sounds as if the way to go for you is "damage coding" - besically you can use any form of javascript in the damage formula, and that includes conditional branches to check the target hp and code to add states.
The disadvantage of this solution is that you'll need at least basic knowledge of javascript and that some commands can cause problems with autobattle flags and a few other special situation (which would not matter if this is used by enemies only)

If you want to go this way, please check the pinned topics in the two MV sections (support and plugin), there should be a pinned topic about how to use damage formula coding.
That would probably require either yanfly's buffs and states core or action sequencing. Give your actor a state that makes him immune to whatever state the attack is supposed to add that get automatically removed whenever he's low hp.

Or use action sequencing with an eval conditional branch that checks for the target hp and applies the state.
Another way to apply a state to
someone with an attack is to make
it so with a weapon you make it so the
weapon applies the state when you hit an
enemy with it.
okay, thank you all, i managed to do it with damage formula, the thing was causing me trouble was a semicolon i missed, very dumb but thanks for your help.
okay, thank you all, i managed to do it with damage formula
This sounds like it's not a good way to implement your request, especially since it's a skill used by enemies.

At the beginning of every turn, enemies figure out which skill they should use by executing the damage formula and seeing what does the most damage to which target.

If you have code in there that adds a state, you will find at some point that state is getting added to your actors even if they're not actually targeted by the skill, or even if the enemy ends up choosing a different skill entirely.

You're better off using Yanfly's Skill Core with a Post-Damage Eval.

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-apply-an-state-to-a-battler-when-an-attacking-skill-hits.158850/