Any way to toggle auto-state from armor ON/OFF?

I want certain armor to permanently give you a state, which auto-state does. But the thing is, even when the player keeps that armor equipped at all times, I would like the state to go away at certain times, then come back. This would be for sequences where combat is not involved. I wouldn't want those sequences to have the player looping through the state's animation, or having slower movement speed (an example of one of the states). I could just force unequip armor at the start of those sequences, but then having the player wonder why he has no armor on after is a bad design.


Is there a way to modify one of the default scripts, so that even when you have armor equipped with auto state, you can choose when that auto state happens, and when it closes, without forcing the player to unequip and equip the armor again?
if ($gameParty.inBattle()) {


INSERT REST OF THE STATE HERE

}

That's all i know, really.
You could also use Troop Events to check whether a character is wearing the armor and apply the state if so, rather than using Auto-State.
Im using an ABS script, so the battle functions are not applied here. Is there a way to link auto state functionality to a switch? So whether that switch is on or off, will determine when auto state activates?
Ok I found out how to activate/deactivate auto states depending on a switch. In Game_Actor line #368:

Spoiler
def update_auto_state(old_armor, new_armor)
    # Forcefully remove unequipped armor's auto state
    if old_armor != nil and old_armor.auto_state_id != 0
      remove_state(old_armor.auto_state_id, true)
    end
    # Forcefully add unequipped armor's auto state
    if new_armor != nil and new_armor.auto_state_id != 0
      add_state(new_armor.auto_state_id, true)
    end
  end



I tried:

Spoiler
def update_auto_state(old_armor, new_armor)
    # Forcefully remove unequipped armor's auto state
    if old_armor != nil and old_armor.auto_state_id != 0 and $game_switches[5] == false
      remove_state(old_armor.auto_state_id, true)
    end
    # Forcefully add unequipped armor's auto state
    if new_armor != nil and new_armor.auto_state_id != 0 and $game_switches[5] == false
      add_state(new_armor.auto_state_id, true)
    end
  end



and that seemed to work, but it doesn't auto update when I toggle the switch. When the switch toggles to on or off, I have to re-equip the armor for the auto state status to update. Is there a way for the game to automatically do this without having to re-equip the armor?
Never mind, I found a perfect alternate solution using common events.

Original thread: https://forums.rpgmakerweb.com/threads/any-way-to-toggle-auto-state-from-armor-on-off.67193/