Event - Get leader's actor id, use to change class, skills, etc.

I'm trying to look through the script editor to figure this out, but I'm just not sure where to look, or what for.

What I need is one of those script pieces, that will get the Actor ID for whoever is currently leading the party (that is, whoever is first in the line, and ideally the one initiating the conversation with an NPC)

In addition, I need another piece that is capable of doing the following:

1) Get/Use the ID of the leader in a Change Class script.

2) Get/Use the ID of the leader with a script to add, or remove, skills.

Can someone help with this? Or point me to a guide or something that shows how this sort of thing is done. The help file doesn't seem to be much help for these.
$game_party.leader gives you the party leader. This is a Game_Actor, so anything you can do to the Game_Actor class, you can also do to $game_party.leader - so you don't need to use the id of the leader to do any of those things you're asking for - you just do it to $game_party.leader


$game_party.leader.actor_id


$game_party.leader.change_class(new_class_id) - EXP starts over


$game_party.leader.change_class(new_class_id, true) - carry EXP over to new class


$game_party.leader.learn_skill(skill_id)
Just for info (you didn't give many details where and how you plan to use the ID, so I don't know if this helps):

You can get the leader ID without scripting by event commands alone.

Control Variables : Game Data : Party : Member #1's Actor ID

To use that ID in eventing requires a few tricks with conditional branches, so for most of the advanced tricks you're better with using the script sequences given by Shaz, but that is not the only way, and sometimes it's easier to use only event commands
@Shaz, thanks for those.

@Andra, sorry I'll try to explain.

My game has a custom character as the lead, but the party members that join aren't so fixed. Changing classes is done via talking to an NPC, and I wanted to limit what classes were available to which npc.

The way I had first planned was to put the script calls for the party leader in, to change the class for the leader, who would be the one talking to the NPC. But I'd like some other script calls as well, in case I need them anywhere else.

---New---

1) Getting the Actor ID for the different party positions. (Just for slots 1-4, the ones you will see on screen on the maps, and the ones who will participate in a battle)

2) Get/Use the Actor ID, or the position in the party, in order to change the class.

3) Get/Use the Actor ID, or the position in the party, in order to add or remove skills. (if Learn_Skill(id) is to learn, would I just use Remove_Skill(id) to remove the skill?

4) If Learn_Skill teaches just a single skill, what would the command be for adding or removing an entire skill group. (Such as if Eric starts out by default with 01: Battle Skills, but I want to take that away and instead give him 02: Magic Skills.)

Edit: Is there anywhere I can go to learn all of these $game_actor, $game_party tricks? It seems like there should be a tutorial or something. =/ It also would have been nice to have in the help files, instead of the Ruby script stuff, which was more confusing than helpful.
The ruby sequences are only partially in the help file (see the part of the RGSS Reference Manual).

A lot of things can be done without them, including some of your wishes (for example, getting a party member's ID and then changing skills for that party member, no matter which actor it is).

The Ruby-sequences are basically used for those things that aren't possible or are rather complex to do by eventing (for example, changing classes if actor isn't known).

The attached picture shows how to do this by eventing...

Especially the second part (changing class) can become tedious if you have a lot of party members and classes - that's why for some cases, the script calls have been used. But those aren't the only ways to do things...

The skill types are added by features - and currently there is no way to add or remove them directly by eventing. But you might be able to change them when changing classes, or make them dependend on equipment.
$game_party.battlers are the first 4 party members who will participate in battle.


$game_party.battlers[0] will give you the same actor as $game_party.leader


So your other three are $game_party.battlers[1], $game_party.battlers[2] and $game_party.battlers[3]


Then you can apply the same commands to them as I gave you for $game_party.leader, as a $game_party.battlers[x] gives you an actor.


Be careful when using this - if you refer to $game_party.battlers[3] and you only HAVE 3 people in your party (array elements 0, 1 and 2), it will cause your game to crash. So you may need to do a condition with $game_party.battlers.size to make sure it's greater than the element you want to use (elements start at 0, so the last one will be 1 less than the array size).
Thanks for the help. Maybe you know what I'm doing wrong in this other thread.

http://forums.rpgmakerweb.com/index.php?/topic/15647-window-base-replacealter-actor-hp-colors/
I have answered you, but please don't make a habit of adding links to completely unrelated questions in your threads. People will see your other thread without you having to draw attention to it.


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-get-leaders-actor-id-use-to-change-class-skills-etc.15626/