Get party member n°x's actor ID and store it in a variable

In my RPG Maker MV game, certain events require the player to choose one party member to interact with something.
For that reason, i have managed to make a multiple choice system that checks for the number of alive party members and gives a number of choices based on that. (if all 4 party members are alive, the game will display 4 choices, if 3 party members are alive, the game will display 3 choices, and so on)
For that purpose, i have made it so one variable is used to store the position in the party of the selected party member. However, i now find myself in need to translate the number of the position in the party of an actor to that actor's actual ID.
Basically, if i chose the actor who is in spot n°2 in the party, i need to make it so a variable is set to the actor ID of the actor who is in spot n°2.
With my limited knowledge of Javascript, i tried many different things and i also tried googling the answer, but i didn't get exactly what i was looking for.
This is what i was trying to work with up until now
$gameVariables.setValue(15, $gameParty.members($gameVariables.value(18)));
I thought this would make it so Variable 15 would be set to become the ID of the actor in the position relative to Variable 18, but it obviously doesn't work.
I tried using
$gameParty.members()[$gameVariables.value(18)].Id()
and other variations of that, since i have an extremely limited knowledge of Javascript and i can't find a list of all the terminology/syntax for RPG Maker MV anywhere. The thing is that i really don't know what to write in order to get the ID of the actor in spot n°x of the party (where x is the value of a variable).
Thank you very much in advance, and sorry if i was confusing. I hope i'm posting in the right section.
there is absolutely no need for scripts here - that is one of the most basic functions of the control variable command.

Just use the control variable command and switch the game data section from "map ID" to "Party member x's ID" (where you select which party members ID you want)
Oh my lord. I didn't even notice.
Thank you SO much. This helps out a ton.
I suppose this thread can be closed, then? Sorry for the super silly question.

Original thread: https://forums.rpgmakerweb.com/threads/get-party-member-n-xs-actor-id-and-store-it-in-a-variable.80123/