I have a skill that should remove a random negative state from an actor. Like a "cure".
I've been playing around with the program but can't seem to find the answer. Do I have to use a plugin?
Yes, because in the default engine there's no such thing as a "negative" state, there are just states. You can use something like Yanfly's State Categories to add positive and negative labels, and then manipulate those with skills.
If you already know the states you want to remove, you can just a random number.
True, you could create an array of the IDs of your states that you consider to be negative, check if the target has each one and make a new array (presuming you want it to be guaranteed to remove a negative status if possible)...it's getting a bit complicated for a damage formula, and you'd have to manually add to the list every time you make a new state that should be negative.
But, for example...
var negStates=[5, 21, 33, 56]; var targStates=[]; for (var i=0; i<negStates.length; i++) {if (b.isStateAffected(negStates[i]) targStates.push(negStates[i]);}; if (targStates.length>1) b.removeState(targStates[Math.randomInt(targStates.length)]); Your healing formula here
And you replace the numbers listed in the brackets after negStates= with all of the IDs of negative states you want the skill to be able to remove.
If I typed that mess out correctly, that should remove a random negative state that the target has before healing them.