Yanfly has many plugins for RPG Maker MV. Some of them which I use is Skill Learn System. I create some skill for user learning, but I prefer cost some level to learn new skill. That function currently is not available. So I hope Yanfly will create that stuff to plugin or if it already has other way to do like that, please tell me. Anyway, thank you very much.
Cost level to learn skill
JS Plugin RequestsUh, how exactly would that be supposed to work?
Right now you could implement a level cost using the <learn require eval> and <learn cost eval> tags from the lunatic mode. Since you usually need less experience to level up in the lower levels, it would probably make it most effective to repeatedly reduce an actor to level 1 and grind them back up with the help of other party members, so I don't know if that is what you wanted:
An alternative could be for example that the actors level is permanently reduced by a certain amount without resetting their experience. That would require a small plugin though.
Right now you could implement a level cost using the <learn require eval> and <learn cost eval> tags from the lunatic mode. Since you usually need less experience to level up in the lower levels, it would probably make it most effective to repeatedly reduce an actor to level 1 and grind them back up with the help of other party members, so I don't know if that is what you wanted:
<Learn Custom Text>
\i[73] Will reduce your Level by 5.
</Learn Custom Text>
<Learn Require Eval>
a.level > 5;
</Learn Require Eval>
<Learn Cost Eval>
a.changeLevel(a.level - 5, false);
</Learn Cost Eval>
5 is an example cost. I couldn't test this example, so I just hope it works. 🙂
\i[73] Will reduce your Level by 5.
</Learn Custom Text>
<Learn Require Eval>
a.level > 5;
</Learn Require Eval>
<Learn Cost Eval>
a.changeLevel(a.level - 5, false);
</Learn Cost Eval>
5 is an example cost. I couldn't test this example, so I just hope it works. 🙂
An alternative could be for example that the actors level is permanently reduced by a certain amount without resetting their experience. That would require a small plugin though.
It works fine, thank you very much @Another Fen I still have a question, use changeLevel function can decrease level but also lost remain exp between current level and next level, doesn't it?
The progress to the next level would be lost. By default, the changeLevel function will just set the actors experience to the amount required for the target level (as found in rpg_objects.js):
Game_Actor.prototype.changeLevel = function(level, show) {
level = level.clamp(1, this.maxLevel());
this.changeExp(this.expForLevel(level), show);
};
If you want to change that, just copy this function into a new plugin and modify it there (changing the function will also change the behaviour of the "Change Level" event command). If you want to keep the percentual progress, this might work for example (I couldn't test it properly again):
Game_Actor.prototype.changeLevel = function(level, show) {
level = level.clamp(1, this.maxLevel());
this.changeExp(this.expForLevel(level), show);
};
If you want to change that, just copy this function into a new plugin and modify it there (changing the function will also change the behaviour of the "Change Level" event command). If you want to keep the percentual progress, this might work for example (I couldn't test it properly again):
Game_Actor.prototype.changeLevel = function(level, show) {
level = level.clamp(1, this.maxLevel());
var targetExp = this.expForLevel(level);
if (!this.isMaxLevel() && level < this.maxLevel()) {
// Increase EXP to match the current progress:
var restExp = this.currentExp() - this.currentLevelExp();
var oldLevelupExp = this.nextLevelExp() - this.currentLevelExp();
var newLevelupExp = this.expForLevel(level + 1) - targetExp;
targetExp += Math.floor(restExp * newLevelupExp / oldLevelupExp);
}
this.changeExp(targetExp, show);
};
level = level.clamp(1, this.maxLevel());
var targetExp = this.expForLevel(level);
if (!this.isMaxLevel() && level < this.maxLevel()) {
// Increase EXP to match the current progress:
var restExp = this.currentExp() - this.currentLevelExp();
var oldLevelupExp = this.nextLevelExp() - this.currentLevelExp();
var newLevelupExp = this.expForLevel(level + 1) - targetExp;
targetExp += Math.floor(restExp * newLevelupExp / oldLevelupExp);
}
this.changeExp(targetExp, show);
};
Thank you @Another Fen It works. I just add a new function name decreaseLevel instead of override changeLevel function.
Original thread: https://forums.rpgmakerweb.com/threads/cost-level-to-learn-skill.61685/