I need help scripting equipment giving out states.

Was having a problem with an MP restoring accessory restoring outside of battle and making the game too easy.
So instead, I want to use a script that plays at the start of fights to give a MP regen state to the character wearing the equipment at the start of battles that gets removed after the fight is over.

...But I don't know how to script, which is why I'm asking for help over here. Thanks in advance.
john-egbert-homestuck.gif
your profile's engine in MV but the thread is in the MV section and doesnt have an engine tag. Just want to be sure, youre using MZ for this, right?

without a plugin, you could put a troop event in each fight at turn 0 to check if an actor has the equipment on and give them the state if they do. it could get tedious if you have many troops though. With visustella's battle core, you could use the base troop function to essentially copy that automatically into every troop by placing it in a single troop.

alternatively, I think its either VS battle core or the skills and states plugin that lets you make passive states. So you could make the regen state be a passive on the equipment and have the condition being that the party is in battle.
Oh, sorry I'm on mv. I found a yanfly plugin I already had does this same thing, so problem solved I guess. I was just overcomplicating it.

Original thread: https://forums.rpgmakerweb.com/threads/i-need-help-scripting-equipment-giving-out-states.182237/