Event valid for whoever is in first position

Hello there. I would like an event to use the exp of the first character in a formation as a variable, like this:

Control Variables: #0006 Experience = first character exp
if switch A is ON:
Control Variables: #0006 Experience +=1
Control Variables: #0007 Moreexp = first character exp
Control Variables: #0007 Moreexp = Experience
end​
Control Variables: #0006 Experience = first character exp
So, in the end, i would end with +1 exp for the character in position 1, whoever they are. Now, how do i target such a character? As you may notice i have no idea about what to write in place of the parts written in bold.

I tried using $gameParty.members()[1].exp but it returns a error, so I dont really know how to go on
​
$gameActors.actor(actorIdinserthere).exp <-- not sure if this is the correct syntax for the command.
exchange actorIdinserthere with gameParty.members()[1] which returns the actor id on that member slot, so it should look like:
$gameActors.actor(gameParty.members()[1]).exp

Edit:
and here maybe a mistake i spoted in your code that had nothing to do with this:
Control Variables: #0006 Experience = first character exp
if switch A is ON:
Control Variables: #0006 Experience +=1
Control Variables: #0007 Moreexp = first character exp #<This line seems useless, it gets overwritten in the next line. Or the next line needs a + instead of a =, cant tell, input missing.
Control Variables: #0007 Moreexp = Experience
end
Control Variables: #0006 Experience = first character exp
I keep getting error...

Reference error: gameParty is not defined
you can do it with eventing alone, but that is more tedious.

control variable game data ID of actor in position 1
then a branch checking which actor this is, with a branch for every possible actor.

that is the disadvantage of the event version: it has no indirect referencing and you'll need a fixed sequence for each actor.

or you can mix, getting the ID by the control variable event and then use that for the direct script command.
i was doing it with events but.. it seems dull, since the branches should be identical for each actor... 🙁
I get the same error, i asked the oracle and found something.
@caethyril posted an answer to this.
https://steamcommunity.com/app/363890/discussions/4/1470841715981798031/

$gameParty.members()[p]._actorId <---Thisone works in set variable, also party slot 1 is 0, it starts counting with 0,
or
$gameParty.members()[p].actor()._actorId <---thisone seems not to work in set variable
What exactly are you trying to do here? You've got 5 Control Variable commands, and none of them do what you say you're trying to do - give the party leader more EXP.

What is switch A? A self switch? A regular switch? You only want to do it if that switch is on?

If all you want to do is give the leader +1 EXP if a particular switch is on, do this:
Code:
Condition: Switch (or Self Switch) Whatever is ON
  Script: $gameParty.leader().changeExp($gameParty.leader().currentExp() + 1);
End
So.. it works 🙂 thanks everyone for the help:

◆Control Variables:#0008 First = Actor ID of the party member #1
◆Control Variables:#0006 Insight = $gameParty.members()[1]._actorId.exp
◆Common Event:Roll insight
◆If:Insight Dice > Insight
◆Text:None, Window, Bottom
: :You experienced an Insight!
◆Change EXP:{First}, + 1
◆Control Variables:#0006 Insight = $gameParty.members()[1]._actorId.exp
◆
:End
Ok, just keep all the persons who helped me updated, now it looks like this:

◆Common Event:Roll insight
◆Control Variables:#0006 Insight = $gameParty.leader().currentExp()
◆If:Insight Dice > Insight
◆Text:None, Window, Bottom
: :You experienced an Insight!
◆Script:$gameParty.leader().changeExp($gameParty.leader().currentExp() + 1)
◆
:End

and it works perfectly. A big thank to @Shaz ans @Bex

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/event-valid-for-whoever-is-in-first-position.113583/