[Solved] How to check if actor enters battle

The number of battle members is 4. If I have 5 actors in the party and I remove actor 4 during battle through an event, actor 5 automatically replaced actor 4.
With certain plugins I can also change party formation mid battle making actors that previously did not attend the battle now attend the battle.
I need to trigger certain functionality when a new actor enters a battle.

I've currently using:
Sprite_Battler.prototype.setBattler = function(battler) and I am checking if( this._battler !== battler ).
But this is obviously wrong, because this will also trigger if e.g. Marsha switches onto Harolds position while being in the battle.

How can I check this correctly?

Edit:
In the future I should really wait another day before I ask those questions. I was again able to solve this myself by doing additional checks in Game_Party.prototype.addActor, Game_Party.prototype.removeActor and Game_Party.prototype.swapOrder
Thread closed IgnoreMe

Original thread: https://forums.rpgmakerweb.com/threads/solved-how-to-check-if-actor-enters-battle.109575/