EVENT / SCRIPT – Class Change


Sometimes in game you want to the character / actor to change their class.  Maybe they switch, maybe its part of a transformation, maybe its a magical effect.  Whatever the reason you need to change their class.  The simple way to do this is to use an Event, and simply use the built in event command Change Class.   However, when you use this it strips the actor of all their experience, resetting it to 0 and so they are level 1 again.  If this is what you want, great that’s all you need.  But in some cases we want to preserve their accumulated experience.  For example, maybe you want the actor to be able to transform into a “powered up” version of themselves, or maybe they’re a werewolf and you need them to go from their normal self to their werewolf form which has different abilities by using a change of class.   In these cases you’ll need to preserve their experience total and to do that we need to we need to store the current experience total for the actor as a variable (this will have to be done separately for each actor you want to affect).

There are two ways to do this.  The first way is to use a Control Variables command to import the actor’s current exp.  First set it to the variable you want to store the actor’s experience in, have it set that variable to the exp total we’re gathering, and then use the Game Data option to import the Actor’s EXP.

The second way is to use a Call Script function and enter this string “$game_variables[V] = $game_actors[N].exp”, where V is the variable number you’re storing the experience in, and N is the actor number.

Both do the same thing and work equally well in this case, so go with what you’re comfortable with.

Now that we’ve stored the actor’s current experience, we can change the actor’s class.  Under the Actor options on page 1, just use the Change Class… command and select your actor and the class you want them to change into.  At this point they will revert back to 1st level, which is not what we want.

In the next line of the event use the Change EXP command, set it to the Actor you’re changing, Increase, and for the last option use the variable you stored their experience total in.  This gives them back their original exp.

Finally, you will probably want to use a Recover All, command to bring them up to full health and MP.  In some cases you may not want to actually max out their MP, but want them to have full health.  No problem, instead of Recover All just use Change HP and set it to some large number like 5000.  Since the character can’t have more HP than their max this effectively gives them back full health (think of it like healing a character that has say a max HP of 1,200 for 5,000 HP… they just go to full health and the rest is lost).  If you want to give them back the same HP they had originally then just use a second variable to store their original HP in like you did their EXP, then add that back in the same way.   Same for MP if you want to restore what they originally had.

That’s it.  Hope that helps.




Comments are closed.