How to know actor´s ID (Reserve Party) in battle.

Ok, here is the deal (which im finding very frustrating).

Lets say I have a total party of 6 and an active party of 4, which means I have a Battle party of 4 (active) and a reserve party of 2 (reserve).

So, If I want to know if a specific actor IS in the party AND is an ACTIVE member I use: $gameParty._battleMembers.contains(X) and it works fine on the map. But if I call that INSIDE a BATTLE, it does not work.

If I want to check if X actor is in the party I use the event command, Conditional branch If X actor is in the party, this will look for that actor in the WHOLE (Active and Reserve) party, but only in the map. If I call it INSIDE a BATTLE, strangely, it will only look for the actor in the ACTIVE party, ignoring the reserve party.

If I want to store my party´s ID´s in variables, I use the Event command Control variables, game data, party member id. Which works fine and it places the 6 Ids of my party on 6 different variables, BUT if call that INSIDE a BATTLE, it will only store the 4 ids´of the active party, again, ignoring the 2 members in reserve, which those variables will return 0.

So, after this explanation, I just need to check for actors ids of the reserve party IN BATTLE. I dont get why some scriptcalls or commands function differently inside and outside battle.

Thanks!!
$gameParty.allMembers().slice(4,5).contains(id) ?

if you would check for battleMembers, battleMembers() is allMembers[from 0 to maxBattleMembers], in this case, 0 to 4.
$gameParty._battleMembers.contains(X) and it works fine on the map. But if I call that INSIDE a BATTLE, it does not work.
You must be mistaken, because $gameParty._battleMembers does not exist.
Perhaps you meant to say:
$gameParty.members() which does work differently inside a battle or out. The Event Command that you refer to does use $gameParty.members() , which explains why your Control Variables isn't working for members #5 and #6.

So instead, in the Control Variables Event Command, use the script option instead, and use:
Code:
$gameParty.allMembers()[4].actorId()
and
Code:
$gameParty.allMembers()[5].actorId()
Now the Actor ID of members #5 and #6 will be saved into the variable you selected.
I forgot that members() returns an array of actors, not of IDs
Code:
$gameParty.allMembers().slice(4,2).map(function (actor) {return actor.actorId();};).contains([your array of IDs here])

....ish.
basically, grab the lot of actor objects, take the two after 4th actor, collect their IDs and compare with array of IDs.
I never used that function in JS it could be mistaken.
Thank you both!! That fixes it.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-know-actor-s-id-reserve-party-in-battle.95160/