Set EXP to a specific value

Hi there,

I'm trying to set EXP to a specific value, but I can't find the exact name of the variable. I managed to do it with gold, but how to do it with EXP ?

Thanks in advance for your help !

Seb.
To change the experience for the actor's current class, use the changeExp method, e.g.
Code:
$gameActors.actor(1).changeExp(1000, true);
Swap 1 for the actor ID and 1000 for the experience value. Swap true for false if you don't want it to show level-up messages. 🙂

Alternatively, by the actor's position in the party:
Code:
$gameParty.members()[0].changeExp(1000, true);
This is for the party leader, swap 0 for a different number as needed (1 = first follower = party member 2, etc).

Code snippet for reference~
Spoiler: Game_Actor.prototype.changeExp
Code:
Game_Actor.prototype.changeExp = function(exp, show) {
    this._exp[this._classId] = Math.max(exp, 0);
    var lastLevel = this._level;
    var lastSkills = this.skills();
    while (!this.isMaxLevel() && this.currentExp() >= this.nextLevelExp()) {
        this.levelUp();
    }
    while (this.currentExp() < this.currentLevelExp()) {
        this.levelDown();
    }
    if (show && this._level > lastLevel) {
        this.displayLevelUp(this.findNewSkills(lastSkills));
    }
    this.refresh();
};
Thanks so much !

Original thread: https://forums.rpgmakerweb.com/threads/set-exp-to-a-specific-value.113696/