Trying to reset the state of a target.

Essentially, I have a skill that removes ALL states from the target, with the exception of Death (State 1). As it stands, I could just make it so the skill Remove State's all of the states I have in the game and to just try and keep this list updated as I add new states. However, due to the nature and size of my project, I'm currently sitting at over 300 states and there's going to be more added in the future.

Is there a way I can kind of just script up something that just removes states 2-300 in one fell swoop instead of doing it one-by-one-by-one-by-etc... via Remove State?

I'm using pretty much all of Yanfly's scripts, if that will help ease the process somehow.
You could use the script call equivalent of remove state (which you can find in the game interpreter part of the default js files or from a list somewhere here) within a loop to remove all states from 2-300 or whatever end number you have
You can try Yanfly's State Categories (requires YEP Buffs & States Core). This plugin allows you to assign states to one or more categories and allows items or skills to remove all states of a specific on category.

http://yanfly.moe/2016/04/03/yep-89-state-categories/
Like @Engr. Adiktuzmiko said, you can do this with a simple loop. Best to just check to see how many states are in the database using a script though than have to change it later after adding a bajillion new states (not that you would, but just in case). If you're looking for something to put in your damage formula I would recommend this:

Code:
var i; for (i = 2; i< $dataStates.length; i++) {b.removeState(i)};

You can still make the skill deal, or even heal damage (depending on the damage type in the database) by adding your damage formula at the end eg.

Code:
var i; for (i = 2; i< $dataStates.length; i++) {b.removeState(i)}; a.atk*4 - b.def*2;
Thanks for the feedback. It looks like all of these are viable solutions. I hadn't considered to even look at Yanfly's State Categories.

Original thread: https://forums.rpgmakerweb.com/threads/trying-to-reset-the-state-of-a-target.105953/