How do I make skill that has a % chance to land a debuff?

I have a skill that will hit with a 100% chance that hits 4 times. I want each hit to have a 30% chance to lower the target's defense, but the [Add Debuff] parameter doesn't have an option to add a rate to add debuffs. I tried lowering the success under invocation, but that lowered how often the skill hits, not how often the debuff lands.
Make it a state instead. Have a 30% chance to add said state.
You can do what @TRIDIUM suggested, but states work in a different way than debuffs do. If you turned it into a state, it wouldn't stack with multiple hits the way a debuff does, and it won't get countered by a buff the way a debuff does.

Instead, put it into a notetag. If you're using VisuStella's Battle Core, you can use a notetag from there; if you don't have that, you can use my Eval Tags plugin in my signature.

With my plugin, you'd put in the notes of the skill:
Code:
<Action Apply Eval>
if (Math.random()<.3)
    target.addDebuff(3, 5);
</Action Apply Eval>

where the 5 is how many rounds the debuff lasts.
You can do what @TRIDIUM suggested, but states work in a different way than debuffs do. If you turned it into a state, it wouldn't stack with multiple hits the way a debuff does, and it won't get countered by a buff the way a debuff does.
When you say stack you mean debuffs can stack? For example if I land decrease defense on the first hit and the third hit, the target would have an amplified decrease defense effect? If so, I'd like for that to not happen, so if the decrease defense effect is applied multiple times, it doesn't amplify the effect at all.
With my plugin, you'd put in the notes of the skill:
Code:
<Action Apply Eval>
if (Math.random()<.3)
target.addDebuff(3, 5);
</Action Apply Eval>
where the 5 is how many rounds the debuff lasts.
Okay, so if I'm understanding this right, my code would look like this (I want the effect to last 2 turns) and I would put this in the note section of a skill rather than the effects section.
Code:
<Action Apply Eval>
if (Math.random()<.3)
target.addDebuff(3, 2);
</Action Apply Eval>
When you say stack you mean debuffs can stack?
Yes - you might want to make sure you've done tutorials and reading instructions so you know how the default engine's functions work before starting on your project with plugins and stuff 😉

Buffs and debuffs stack up to 2 times, and they counter each other. So if a battler gets defense buffed twice then debuffed once, they'll have one buff on there.

If so, I'd like for that to not happen, so if the decrease defense effect is applied multiple times, it doesn't amplify the effect at all.
Then you want to do what @TRIDIUM said and use a state, not a debuff.

Okay, so if I'm understanding this right, my code would look like this
No, because you said you don't want to use a debuff.
Then you want to do what @TRIDIUM said and use a state, not a debuff.
Got it. Since I don't see any state for defense debuff, I assume I have to create one myself.

Yes - you might want to make sure you've done tutorials and reading instructions so you know how the default engine's functions work before starting on your project with plugins and stuff 😉
Would you happen to know where I could be redirected to find some of these resources? A lot of the videos I see on YouTube assume I already know how RMMZ works, and I can't seem to find any official guides on the RM main website.

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-make-skill-that-has-a-chance-to-land-a-debuff.166278/