I'm looking for a way to limit the level of the players initial class down to a certain number and then once they hit that cap, say 40 or 50, they can revisit the class trainer and choose another class to upgrade into. I need to be able to have the game detect that the character has reached that point AND a way to stop them from leveling up after hitting the soft cap.
Soft level cap and conditional variable?
RPG Maker MV SupportJust set your exp to stop at level 50 and make event that turns on a switch at that level to activate your trainer npc.
Right, I can understand that, just don't know the how exactly.
If you only need to check if your character has reached a certain level to determine the response of your class trainer, you can do that using a variable and a conditional branch:
@>Control Variables: [0020:Current Level] = [Eric]'s Level
@>Conditional Branch: Variable [0020:Current Level] >= 40
...
@>Else
...
@>Branch End
If you want an event to trigger the moment your character reaches level 40 without any additional input, you could run a common event every time the character gets experience to check their level (you can run a common event right after a battle by activating a switch at the start of the fight through a troop event, and have a parallel common event after the battle that is activated by that switch).
By default the game is coded so characters have a static maximum level.
You could try to replace your old character with a clone that has a higher maximum level or stripping any extra experience though a common event, but the easiest way would probably to use a small plugin to allow you to change the maximum level during the game:
Code:
/*
* @plugindesc Change an actors maximum level
* @help Change an actors maximum level using this script command:
*
* $gameActors.actor( ID ).setMaxLevel( MAX );
*
* ID : Actors Database ID
* MAX : New Maximum Level or 0 to return to the database value.
*/
Game_Actor.prototype.setMaxLevel = function(newMaximum) {
this._maxLevel = newMaximum;
this.changeExp(this.currentExp());
};
Game_Actor.prototype.maxLevel = function() {
return this._maxLevel || this.actor().maxLevel;
};
Imported as a plugin this code should allow you to use
$gameActors.actor(15).setMaxLevel(95);
in a script command to change actor #15's maximum level to 95.
Hope this helps.
Original thread: https://forums.rpgmakerweb.com/threads/soft-level-cap-and-conditional-variable.126920/