Add a debuff if another debuff is present

I know how to check if a state is present, and if it is, to add another state e.g.

if b.state?(29); then; b.add_state(49); end;

and had thought that the same structure would apply for checking if a debuff is present, and if it is, then adding another one, lasting 6 turns. So I have
if b.debuff?(3); then; b.add_debuff(2, 6); end;

but that doesn't work. Does anyone know what the syntax should be?

Thank you.
Would not a "debuff" be the same as a state? Or do you speak of the weakening of a certain attribute? At least that's how I always did it. For example, this command:

Spoiler
317RMX5.png

I create states with the same functions to allow me greater control. Soon its formula would be simpler: if b.state? (x); then; b.add_state (y); end; Depending on the debuff, you can also check if the character's attribute is less than normal (reduced defense, for example) and then apply the new debuff status. I'm sorry for not testing before commenting, I just formatted the notebook and I'm still downloading the program.
Yes you are right I could do that, and if no other option is available that is what I'll do. But I was hoping to save a lot of time, as I've already used debuffs in several places and didn't want to have to go back and find them all to change them. It's so easy to miss some.
Apparently the problem is just in the condition, right? If you only use add_debuff (param_id, turns), does it work? If I'm not mistaken, the script that handles this data is the Game_Battler. I'm looking for how it recognizes debuffs already applied, but as I do not know how to program I need to go testing command by command to know what it is. As soon as I find I edit the comment here.
Yes, the condition seems to be the issue. I have no problem using the add-debuff on its own, and in fact use it quite extensively.

It might be better to do a new post - edits to existing posts don't show up as notifications, so I might miss your amendment.
I got it. The debuff IDs start with zero, so your formula is correct, but you may be checking for the wrong ID. I used the following:

If b.debuff? (0); b.add_debuff (3, 6); end;

If the "Reduce HP Maximum" debuff is applied, include "Reduce Defense" on the target. See the test. The "Defender" command is applying the ID 0 debuff. The enemy skill uses the above formula and, fulfilling the conditions, applies the ID 3 debuff:

Spoiler: Gif
F8KlFpi.gif
Spoiler: "Defender"
QtrIksM.png

This is the default skill. The "Defending" status that it applies has not been changed.
Spoiler: "Debuff Skill"
NHPOYe0.png
You are a star! I'd forgotten about the debuff IDs starting at zero.
Thank you so much for your time and trouble. I am very grateful.
You are welcome. And, helping you, I learned a little about these commands in the damage calculations. 😂
So, a win-win then, which is nice.

Thread closed IgnoreMe

Original thread: https://forums.rpgmakerweb.com/threads/add-a-debuff-if-another-debuff-is-present.83257/