How to get an actor's battle index from their ID

Hello, thanks in advance for your attention.

I would like to know if there is a way to know the battle position of an actor given their ID.

For example, let's say John is an actor whose ID is 1. Since the player can modify the formation, John could occupy any position (or not be in the party at all) at any given time. Is there a way to get John's battle index in order to know which position they are in? If I wanted, for example, to force an enemy to use a skill to always targets John.

Thank you for your time, and have a good day.
You can go about it in several ways, but try
Code:
$gameActors.actor(1).index()
just be aware of the effects of when this actor isnt a battle member... and prepare for this contingency.
if you want to go by pure eventing, you would have to go from the other end.
control variable can give you the actor id based on party position, so you'll check the first four positions for which actor is in them until you find the ID you're looking for.
You can go about it in several ways, but try
Code:
$gameActors.actor(1).index()
just be aware of the effects of when this actor isnt a battle member... and prepare for this contingency.
It works! For the check, I'll just nest it inside a conditional branch that checks if the actor is in the party first. Thank you so much! Have a nice day.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-get-an-actors-battle-index-from-their-id.155792/