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

Newquaza 96

Veteran
Veteran
Joined
Sep 5, 2014
Messages
35
Reaction score
6
First Language
Italian
Primarily Uses
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.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
32,942
Reaction score
8,260
First Language
German
Primarily Uses
RMMV
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)
 

Newquaza 96

Veteran
Veteran
Joined
Sep 5, 2014
Messages
35
Reaction score
6
First Language
Italian
Primarily Uses
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.
 

Latest Threads

Latest Posts

Latest Profile Posts

When there's a will, there's a lifehack. :ninja:

Before i mess with battle UI further, does it look decent enough? :hswt:
Free MZ? That's good. I should go try it out then.
Let's see if I can make it in time xD
Knipsel.PNG

Forum statistics

Threads
112,522
Messages
1,068,894
Members
146,202
Latest member
fmovieswebsite
Top