Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

Resource icon

Clark Exp Limit 1.1

No permission to download

Xilefian

Adventurer
Xy$
0.00
If the limit is just below a level up range for a class then every time experience is gained the level up message will appear.

Also the changeLevel command will bypass this, only to be reset when the next gainExp is called, and the initialisation stage will ignore the limit as well.

It would probably be better to implement this at the changeExp function instead;
JavaScript:
var expLimit = $.Parameters["ExpLimit"]; // Store to prevent constant access of $ (wtf?) and Parameters

var _Game_Actor_changeExp = Game_Actor.prototype.changeExp;
Game_Actor.prototype.changeExp = function( exp,  show ) {
    if ( this.atLimit ) {
       return; // Cancel if actor is already at the limit
    }
    exp = ( exp > expLimit ? expLimit : exp ); // Clamp exp setting to the limit
    this.atLimit = ( exp == expLimit ); // If we've hit the expLimit, set atLimit to true
    _Game_Actor_changeExp.call( this, exp, show ); // Change actor experience
};
The following would fix the initialisation problem;
JavaScript:
var _Game_Actor_initExp = Game_Actor.prototype.initExp;
Game_Actor.prototype.initExp = function() {
    _Game_Actor_initExp.call( this ); // Initialise exp
    if ( this._exp[this._classId] >= expLimit ) {
        this._exp[this._classId] = expLimit; // Clamp exp to limit
        this.atLimit = true; // Set that we're at the limit
    }
};
 
Top