how to turn off EXP gain

So, I'm making a UT fangame, and if you didn't know, there's a way to spare enemies in the game. I tried a common event which applies a skill which adds a state that turns off exp gain, but the characters still gain exp.
The least buggiest approach I think is to override the function that tells the game how much EXP an enemy nets. Save the following as a plugin and install it.
Code:
/*:
 * @plugindesc Turns off EXP gain if an enemy is spared
*/
Game_Enemy.prototype.exp = function() {
    return isSpared ? 0 : this.enemy().exp;
};
I don't know how you're marking enemies as spared so you're going to need to replace "isSpared" with whatever is appropriate for your implementation. If you're marking them with states, you could replace "isSpared" with "this.isStateAffected(stateId)"
I tried a common event which applies a skill which adds a state that turns off exp gain, but the characters still gain exp.
you might have the state set to be removed at the end of the fight. if thats true, then your actors wouldnt have it by the time the exp is given out.
you might have the state set to be removed at the end of the fight. if thats true, then your actors wouldnt have it by the time the exp is given out.
That worked, thanks!
How are you sparing the enemies? If they're not being killed, they shouldn't be adding any exp to the battle results.

That should just work without any states or code.
How are you sparing the enemies? If they're not being killed, they shouldn't be adding any exp to the battle results.

That should just work without any states or code.
a skill called "spare" which kills the enemy. When a variable called mercy is @ 100, it adds the skill, which triggers a common event.
a skill called "spare" which kills the enemy.
Just to put it out there, if your skill makes the enemy escape instead, all the rest will just work.

Because as it is, presuming you have these things in your game, you're getting not just the exp but also the gold drop and any item drop chances from those enemies by killing them.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-turn-off-exp-gain.164521/