How to make attacking skill have a chance of debuffing?

1642778673468.png

Here we have Nuzzle. It's meant to be a physical Thunder attack that lowers Agility.
I've found that it's a little overpowered with its 100% chance of lowering Agility if it hits. It's the primary attack of one of the characters in the party, so it's likely to be used a lot, and so any enemy with high AGI is turned into a joke with near-constant AGI -2 when that character is being used, and basically makes the character who specializes in debuffs obsolete.

Are there any ways to change it to a *chance* of lowering AGI instead of making it 100%? Are there any plugins that enable this?
If nothing else, you could try making a state that lowers agility. That would stack with normal debuffs (but not itself, unless you use a plug-in for that) though, which may or may not be a good thing depending on how you look at it. It would also give you more control over how it applies the debuff (the chance of it happening, how much it reduces, and so on).
It should be possible. If it were built into a weapon, you could use Yanfly's Weapon Unleash. I'm not sure if you could use that with a state or something, or if you would have to adapt the code.
You can add this to the beginning of the Skill's Damage Formula:

JavaScript:
((Math.randomInt(10) + 1) > 9) ? b.addDebuff(6, 4) : 0;

"(Math.randomInt(10) + 1)" rolls a random number between 1-10. You can change the "9" to adjust the ratio. 9 = 10% chance, 5 would be 50% etc. The "6" is AGI, and the "4" is Turn Duration. Be sure to place your actual Damage Formula AFTER this code.
Does that not run the risk of triggering even when the skill is not used?
Does that not run the risk of triggering even when the skill is not used?
Do you mean when the Skill misses? I tested that and as far as I can tell, the Damage Formula only applies if the Skill connects. Unless you were referring to something else.
You can read here, why putting extra code inside the damage formula can cause problems:

That said, @catchneko could just slap the code you provided into a <Post-Damage Eval> (or something like that) from Yanfly's free plugin Skill Core:
You can read here, why putting extra code inside the damage formula can cause problems:

That said, @catchneko could just slap the code you provided into a <Post-Damage Eval> (or something like that) from Yanfly's free plugin Skill Core:
Ah, interesting :oops:. I was toying around with this, but couldn't seem to find any problems personally.
You can add this to the beginning of the Skill's Damage Formula:

JavaScript:
((Math.randomInt(10) + 1) > 9) ? b.addDebuff(6, 4) : 0;

"(Math.randomInt(10) + 1)" rolls a random number between 1-10. You can change the "9" to adjust the ratio. 9 = 10% chance, 5 would be 50% etc. The "6" is AGI, and the "4" is Turn Duration. Be sure to place your actual Damage Formula AFTER this code.
You can read here, why putting extra code inside the damage formula can cause problems:

That said, @catchneko could just slap the code you provided into a <Post-Damage Eval> (or something like that) from Yanfly's free plugin Skill Core:
Thank you! It seems to work now.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-attacking-skill-have-a-chance-of-debuffing.144178/