MV Script line to remove all buffs and debuffs

Is there a way to remove all buffs and debuffs at once
a) for a given characters
b) for a range of characters (eg from actor id 2 to 9)
Thanks in advance!
  1. For a single target use battler.clearBuffs(), e.g.
    JavaScript:
    $gameParty.members()[0].clearBuffs();

  2. For multiple targets you can use a for loop, e.g.
    JavaScript:
    for (var id = 2; id <= 9; ++id) {
      $gameActors.actor(id).clearBuffs();
    }
    Or, if the IDs don't form a simple range:
    JavaScript:
    for (var id of [2, 3, 4, 8, 9, 15]) {
      $gameActors.actor(id).clearBuffs();
    }
Thank you. For debuffs it'll be "clearDebuffs"?
Buffs and debuffs adjust the buff level up or down respectively. clearBuffs resets all buff levels to 0, so it should work for both buffs & debuffs. 👋
For debuffs it'll be "clearDebuffs"?
nope. its clearBuffs for both. buffs and debuffs are basically the same thing for the engine and are handled the same way, but debuffs have negative values rather than positive ones.

if you wanted to remove specifically buffs, youd could to run a loop on the battler's buff array and remove the buffs wherever their values are positive
Most likely inconsequential addition, but unlike most other functions that alter the battlers stats or traits, clearBuffs() does not automatically update the battlers HP (if it now exceeds the MHP) or other dependencies (depending on which plugins you use), but you could add the refresh yourself:
Code:
$gameActors.actor(id).clearBuffs();
$gameActors.actor(id).refresh();

Original thread: https://forums.rpgmakerweb.com/threads/script-line-to-remove-all-buffs-and-debuffs.167158/