User: Frogboy
Bug: Crash on level up
How to Replicate the Bug:
You can fix this by simply adding a check to make sure the skill exists.
Bug: Crash on level up
How to Replicate the Bug:
- Create a new project
- Increase the maximum number of skills to 11
- Assign skill 11 to be gained by Harold at level 2
- Decrease the maximum number of skills back to 10
- Set the slime to give 100XP. Might as well set the Slime to 1HP as well for quick testing.
- Do a battle test against the Slime either in game or in the editor
- When you win the battle, the game will try to assign this removed skill to Harold and crash
You can fix this by simply adding a check to make sure the skill exists.
Code:
Game_Actor.prototype.displayLevelUp = function(newSkills) {
var text = TextManager.levelUp.format(this._name, TextManager.level, this._level);
$gameMessage.newPage();
$gameMessage.add(text);
newSkills.forEach(function(skill) {
if (skill) {
$gameMessage.add(TextManager.obtainSkill.format(skill.name));
}
});
};
