Help with script to set variable equal to variable actor's exp

So I want to have all characters in my game join the party with the same experience as the existing party members. I've been struggling because there is no single actor that will be in the party. At game start you will answer questions and end up with 1 of 8 actors as your first character. So setting exp equal to a specific actor through the normal events won't work.

What I think I can do is use variables. My thought was to:
1. Set Variable 1 to the actor ID of the character you pick during the intro. (Exp is set to share with reserve members so everyone should gain levels equally even if you take that actor out of the party.) I can do this with the basic event editor.
2. Then I want to create a common event which uses a script to set variable 2 equal to the exp of the actor with ID equal to Variable 1. (this is what I need help with...)
3. Finally, when the player recruits a new character, I will run the common event and add an event that adjusts his/her experience to equal Variable 2.

I'm guessing this probably isn't hard, but I'm completely new to this. Just got RPG Maker MV a week ago.
you're making that needlessly complex. You don't need scripts for this.

Please take your time to really check the available event commands, in this case the "game data" section of the control variable command. It allows you access to most game values without scripts.

There is one step where you need to use a longer sequence of event commands and where a script could shorten it a bit, but I'm giving the description this way to show you how it could be done as well.

1) control variable hero = party member #1 actor ID
Yes, that is directly accessable through control variable at any time, no need to do this during intro

2) sequence of eight conditional branches for eight possible actors
if hero=1 then control variable exp = exp of actor 1
if hero=2 then control variable exp = exp of actor 2
...
This is where a script command might be used to reduce this to a single control variable, but you'll need to know it can be done this way for a lot of other possible eventing structures

3) change member command followed by change exp command for the actor to be added to the party


I strongly suggest you follow the link to the "starting point" in my signature, I once wrote that tutorial exactly to help new users learn the engine as fast as possible - showing them through the sections that were often overlooked by new people like the game data of control variable and so on.

Original thread: https://forums.rpgmakerweb.com/threads/help-with-script-to-set-variable-equal-to-variable-actors-exp.117291/