MV Update whenever enemy state rate changes?

I need a function/code where an enemy state rate changes. I need to update something whenever the state rate changes. Where is it? Thanks in advance.
It isn't anyplace specific. State Rate is one of the Traits on a battler, and every time it's referenced the engine iterates through the Traits on that battler to see if it has one.

So it can have an initial setting on the Enemy if you specified it in the database, and otherwise it would only (in the default code) change if a skill applied a state to them.
Then what should I do? Maybe I should check if it has been changed in the battle's update() function?
Then what should I do?
With what? I'm sorry, I thought I answered your question.

If you need to run code every time the State Rate changes, and it can only normally change when a state is applied or removed...then, logically, you'd tie your code into addState() and removeState(), right?

If you're asking something different than that, please clarify.
Hey,

Battlers have a "refresh" function that is called whenever their traits or stats change (you can find the original definition in rpg_objects.js, line 2610ff.).
For a general solution if you don't have additional information when the state rate might change, you could maybe tap into that function and add your checks there.
Oh I forgot to ask: I need it whenever both state and elemental rates change via any traits like the changes in classes, weapons, states, etc. during battle.
That is drastically different from your original question, where you asked about State Rates on Enemies - an Enemy doesn't have classes or weapons. Do even your Actors have the ability to change Class during battle? O__o

Regardless, just take Fen's suggestion and tie into the refresh() method.
Oh sorry! I have actually meant enemies only actually, and both state and elemental rates.

EDIT: Oh I've tried doing something using that refresh function and it seems it has worked! It shows a different elemental rate which I think is something that I need.
@A_Higher_Plane
I think you're still missing what the posters above have tried to tell you.

The state rates are STATIC - they CANNOT change on their own.

the only way to change them is when a state that changes state rates is applied to the enemy, there is no other way.

So instead of trying to listen to something that cannot happen on its own, you can have the skill that applies such a state trigger additional changes, that way you never have to check for changes at all.
@Andar I don't think you know what I am trying to do. But it's all cool now as I have succeeded in doing it now with the above individuals' help.

Original thread: https://forums.rpgmakerweb.com/threads/update-whenever-enemy-state-rate-changes.149475/