MZ Seeking some help creating a skill effect.

Hello,

I'm trying to create a few skill effects that happen when different out comes appear in battle.

For example, I created a JS snippet that gives a target a state if they are hit with an element that they resist or block. See below:

JavaScript:
//Apply State if the skill was resisted or blocked.
if (target.elementRate(skill.damage.elementId) < 1) {
$gameTemp.requestAnimation([target], 2)
target.addState(24);
}

I placed this snippet in the Visustella global "post-damage" settings and it works perfectly.

However, what I'm trying to do is create a similar tag, but for when a skill or item is missed. It's a similar if statement, but I can't get it to work no matter where I place this code (Pre or Post apply, Pre or post damage).

To be honest, I'm not even sure if its doing it right, so I'm seeking help here in getting this to work. In end, I'm just trying to get a state on the target that dodged an attack.

JavaScript:
//Apply state if the skill was missed or evaded.
if (target.result().missed || target.result().evaded) {
$gameTemp.requestAnimation([target], 2)
target.addState(24);
}
That looks like it should work correctly in a Post-Apply or Pre-End Action.

Have you tried throwing a console.log() in there to see that the notetag itself is being executed? You could include the relevant result values to double check what's going on.
That looks like it should work correctly in a Post-Apply or Pre-End Action.

Have you tried throwing a console.log() in there to see that the notetag itself is being executed? You could include the relevant result values to double check what's going on.

Putting it in the Post-Apply worked. I'm not sure why it didn't before (i tried this, but there must have been a syntax error.)

Thanks!
This thread is being closed due to being solved. If you would like to reopened, report it to let us know. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/seeking-some-help-creating-a-skill-effect.157573/