Have a skill decrease stats if a state is inflicted.

I have a skill that induces a frozen state. I have a another skill that I want to have lower the defense and speed of its target IF and only IF the target already has the frozen state. Are there any scripts that can let me do this? Thanks in advance.
You can use the damage formula for the skill:
Ruby:
if b.state?(ID); b.add_debuff(3, TURNS); b.add_debuff(6, TURNS); end; damage_formula_here
You'll need to replace ID with the ID of the frozen state and TURNS with how many turns you want the debuffs to go for. damage_formula_here should be whatever the damage formula is (e.g. a.atk * 3).

EDIT: fixed up the formula
You can use the damage formula for the skill:
Ruby:
if b.state?(ID); add_debuff(3, TURNS); add_debuff(6, TURNS); end; damage_formula_here
You'll need to replace ID with the ID of the frozen state and TURNS with how many turns you want the debuffs to go for. damage_formula_here should be whatever the damage formula is (e.g. a.atk * 3).


I gave it a try, and it doesn't work. I double checked to make sure it's all set up properly, yet it fails to both deal damage, and inflict the debuffs. I'll post the formula in case I genuinely am that blind.

Ruby:
if b.state?(35); add_debuff(3, 3); add_debuff(6, 3); end; a.mat * 3 - b.mdf * 2
Sorry, try b.add_debuff(3,3) instead.
Sorry, try b.add_debuff(3,3) instead.


It works perfectly. Thank you so much!

Original thread: https://forums.rpgmakerweb.com/threads/have-a-skill-decrease-stats-if-a-state-is-inflicted.123013/