# A skill that removes a random state?

#### OpalWysty

##### Mainly scared and confused
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?

#### ATT_Turan

##### Forewarner of the Black Wind
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.

#### pawsplay

##### Veteran
If you already know the states you want to remove, you can just a random number.

#### ATT_Turan

##### Forewarner of the Black Wind
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.

### Latest Profile Posts

Well, I'm quickly recovering from Covid, but I'm still broke and injured lol. I miss working on my game! I think I've figured out a lore-friendly way to do a tutorial section separate from the main gameplay, but it'll take some scripting know-how. Which I don't have. And can't afford.
Made these sprites by editing Tonbi's materials.

I think Kipling said it best.

If you can make one heap of all your winnings
And risk it on one turn of pitch-and-toss,
And lose, and start again at your beginnings
(...)
Yours is the Earth and everything that's in it,
⁠And—which is more—you'll be a Man, my son!

Do you feel like your modern cities are too clean? I made some dumpsters and trash variations. Visit my MZ resource thread (link in signature).