MV Miss effect in a statut

Hello !
I'm trying to create a statut for all battlers and ennemies that gives a malus after a miss or an evaded.

I'm using something similar for a bonus on Critical hits. It works perfectly :

<Custom Establish Effect>

if (this.isPhysical() && target.result().hpDamage > 0 && target.result().critical) {

var param = 2;

var turns = 2;

user.addBuff(param, turns);

var param = 6;

var turns = 2;

user.addBuff(param, turns);

}

</Custom Establish Effect>


BUT, with the following code, nothing happens for the missing attacks or spells... I'm obviously making something wrong, isn't it ?

<Custom Establish Effect>

if (target.result().missed || target.result().evaded) {

var param = 2;

var turns = 2;

user.addDeBuff(param, turns);

var param = 6;

var turns = 2;

user.addDeBuff(param, turns);

}

</Custom Establish Effect>


I'll be glad for some help !! Thanks 😀
From the documentation's description of that notetag:
1714673878141.png


By definition, if the attack missed or was evaded the hit did not connect and damage execution did not occur.

You need to use Custom Conclude Effect.

As a side tip, it doesn't hurt anything, but it makes your code several times larger than it needs to be with those single-use variables...you could just do user.addBuff(2, 2);

It's also considered incorrect practice to redeclare variables. So you wouldn't say var param and var turns the second time, you'd just set the existing param and turns to their new values (which, again, you really don't need in the first place).

Finally, you've mistyped the function in your second notetag. It's not addDeBuff, it's addDebuff
Thanks you !! My actors getting weaker and weaker !! :LZSevil:

Maybe I should create another thread but .... :LZSoops:

Next step for me is adding an animation on user that failed. I was wondering to use something like :

$gameParty.members()[0].startAnimation(41, true, 10);

But I want it to automaticaly target the one who failed and not a specific Party.member.

What should I write instead of "Party.members()[0]" ??

thanks in advance :LZSgrin:

Original thread: https://forums.rpgmakerweb.com/threads/miss-effect-in-a-statut.168265/