Weapon lowers enemy stat on hit?

Hello, I was wondering how (or if) I could have a weapon lower the targets stats (specifically Def) upon each hit, I looked around for a bit and I didn't see any questions that were similar, I also didn't see how to do it in the maker itself (as the traits tab in the database only effects the one wielding it) What I was wanting to do is have a sword that when equipped each physical attack lowers the enemies' (that were hit with the attack(s)) defense by 5%

As always any and all help is appreciated!
Edit: I gave you a solution that will reduce it by 5% but won't stack, let me think about it a bit and I'll see if I can come up with something that does what you're asking for.
Since the OP wants to have it upon each hit, they need to use Custom Establish Effect, not Custom Respond Effect.
Okay, got it.

You'll need Yanfly's Buffs & States Core (http://yanfly.moe/2015/12/25/yep-50-buffs-states-core/) and Auto Passive States (http://yanfly.moe/2015/10/17/yep-13-auto-passive-states/) for this.

Create a new state with the following tag:

Code:
<custom establish effect>
target.addParam(3, -(target.def * 0.05));
</custom establish effect>

Then on the weapon, add the tag

Code:
<passive state: x>

Where X is the ID of the state you created.

Then when the wielder of that weapon attacks something and successfully hits, its defence will be reduced by 5% of its current def (meaning there will be diminishing returns on it, which I assume is what you were going for). It'll be slightly different if you always want it reduced by 5% of its base.
Ack! I thought I had it set to notify me of replies! 😮

Thank you @Trihan & @Poryg so much for helping me with this, I greatly appreciate it (Now my blade can eat through ANY defense albeit with a diminishing return)
And the diminishing return on the ability should be fine, I don't want the ability TOO good after all (I'll just increase it to something slightly above 5% 😛)

EDIT: Probably a stupid question but what would I change to make it effect magic defense too? :hswt:
EDIT: Probably a stupid question but what would I change to make it effect magic defense too? :hswt:

You can add a second call in the same notetag to change magical defense:

Code:
<custom establish effect>
target.addParam(3, -(target.def * 0.05));
target.addParam(5, -(target.mdf * 0.05));
</custom establish effect>
@sciencewarrior Ah, parameter 5 that's what magic defense is. Thanks!
You're welcome. 🙂 I keep this post bookmarked to look up parameters.
Ah fascinating! Do you start counting parameters at 0? That'd be where I got confused (Probably) I really need to learn more about this stuff.
@TriceratopsX yes.
0-MaxHp
1-MaxMp
2-Atk
3-def
4-mat
5-mdf
6-Agi
7-luk
@Zarsla That's really cool! I'm glad I know this now! 🤣

Original thread: https://forums.rpgmakerweb.com/threads/weapon-lowers-enemy-stat-on-hit.85937/