MZ How do I add exp for specific party member and not actor, by script code?

Please help me!
JavaScript:
$gameParty.members()[index].gainExp(value)
index = the position of the actor in the party/array. 0-3
JavaScript:
$gameParty.members()[index].gainExp(value)
index = the position of the actor in the party/array. 0-3
Thank u so omuch man worked! Do you know how to disable lv up notification?
That would require a plugin, and how it was written would depend on what exactly you want - do you never want to see the level up screen after battle? Are you giving experience outside of battle and you're getting some kind of notification that you don't want?
Yes, I mean experience outside of battle
Hi!
Another way of doing it, without the need of a plugin, is to use the following script call:

JavaScript:
// First, store the actor current exp in a variable:
const currentExp = $gameActors.actor(ID).currentExp()

// Then replace VALUE  with the exp that this actor will receive:
const receivedExp = Math.round(VALUE * $gameActors.actor(ID).finalExpRate())

// Sum all:
const finalExp = currentExp + receivedExp

$gameActors.actor(ID).changeExp(finalExp, SHOW)

// You can do the same using party members:
$gameParty.members()[INDEX].changeExp(EXP, SHOW)

Replace "SHOW" with false to not show the level-up message.
Replace "INDEX" with the position of the actor at the party, starting with 0.

For reference:

JavaScript:
Game_Actor.prototype.changeExp = function(exp, show) {
    this._exp[this._classId] = Math.max(exp, 0);
    const lastLevel = this._level;
    const 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();
};

Game_Actor.prototype.gainExp = function(exp) {
    const newExp = this.currentExp() + Math.round(exp * this.finalExpRate());
    this.changeExp(newExp, this.shouldDisplayLevelUp());
};

[EDIT]
Or, you can add this as a plugin, to make things easier:

JavaScript:
Game_Actor.prototype.gainExpWithoutShowLevel = function(exp) {
    const newExp = this.currentExp() + Math.round(exp * this.finalExpRate());
    this.changeExp(newExp, false);
};

And use:

$gameActors.actor(ID).gainExpWithoutShowLevel(exp)
$gameParty.members()[INDEX].gainExpWithoutShowLevel(exp)
Hi!
Another way of doing it, without the need of a plugin, is to use the following script call:

JavaScript:
// First, store the actor current exp in a variable:
const currentExp = $gameActors.actor(ID).currentExp()

// Then replace VALUE  with the exp that this actor will receive:
const receivedExp = Math.round(VALUE * $gameActors.actor(ID).finalExpRate())

// Sum all:
const finalExp = currentExp + receivedExp

$gameActors.actor(ID).changeExp(finalExp, SHOW)

// You can do the same using party members:
$gameParty.members()[INDEX].changeExp(EXP, SHOW)

Replace "SHOW" with false to not show the level-up message.
Replace "INDEX" with the position of the actor at the party, starting with 0.

For reference:

JavaScript:
Game_Actor.prototype.changeExp = function(exp, show) {
    this._exp[this._classId] = Math.max(exp, 0);
    const lastLevel = this._level;
    const 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();
};

Game_Actor.prototype.gainExp = function(exp) {
    const newExp = this.currentExp() + Math.round(exp * this.finalExpRate());
    this.changeExp(newExp, this.shouldDisplayLevelUp());
};

[EDIT]
Or, you can add this as a plugin, to make things easier:

JavaScript:
Game_Actor.prototype.gainExpWithoutShowLevel = function(exp) {
    const newExp = this.currentExp() + Math.round(exp * this.finalExpRate());
    this.changeExp(newExp, false);
};

And use:

$gameActors.actor(ID).gainExpWithoutShowLevel(exp)
$gameParty.members()[INDEX].gainExpWithoutShowLevel(exp)
Thank u so much hero

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-add-exp-for-specific-party-member-and-not-actor-by-script-code.139808/