Check target state in common event and action sequence

Hello,

Goal:

I'm working on creating a skill that deals guaranteed critical hits if the target is stunned. I'd prefer this be done through an action sequence - with Visustella's BattleCore Plugin so I can change animations, and make other adjustments. I've also read that using other mechanics like buffs and states in your damage formula can be problematic.

Background:

I've used an if statement in the damage formula of the skill with and without the action sequence. The result wasn't satisfactory when tested: The skill would deal regular damage on the first use, then all subsequent uses would deal critical damage. I need all hits against a stunned target from this skill to crit.

Here's what I used in the damage formula:

Code:
if (b.isStateAffected(32)) a.addState(12) ; a.atk*10

As of right now I'm testing action sequences and if statements - but I'm having a lot of trouble garnering the data I need.

See my current sequence below - the most important part right now is the if statement.

1677729545700.png


In testing I learned I could store the last target enemy as a variable, but that requires the skill to have effected the enemy prior. This is why Control Variable 12 = Last Target Enemy Index comes after Mech: Action Effect (this action sequence command will apply the effects of the skill to the target of the skill).

For the If: Script I've used $gameTroop.members()[n].isStateAffected(32) and have used the variable that's stored Last Target.

This doesn't work - or at least it doesn't return anything positive. I'm assuming my syntax and perhpas the script call I'm using incorrectly.

Any guidance whether its for the formula or the if statement would be appreciated - though for the long term I'd very much like to learn how to:

- Check if target is affected by state using common event commands, specifically if statements with Script calls
- do the same for the caster

To anyone with the knowledge or willingness to help, please let me know if you have any questions.

Love you guys.
*ahem* :blush:


$target.isStateAffected(x) is the answer - it has solved the entire dilemma.

;_;

Original thread: https://forums.rpgmakerweb.com/threads/check-target-state-in-common-event-and-action-sequence.155438/