Level Up Crash

Discussion in 'RPG Maker MV Improvement Boards' started by Frogboy, Dec 13, 2017.

    Tags:
  1. Frogboy

    Frogboy I'm not weak to fire Veteran

    Messages:
    1,672
    Likes Received:
    2,093
    Location:
    North Carolina, U.S.
    First Language:
    English
    Primarily Uses:
    RMMV
    User: Frogboy
    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
    Other: While this bug is the result of user error, it's probably something that should be handled without crashing the game.

    bug.png

    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));
          } 
        });
    };
    
     
    Last edited: Dec 13, 2017
    #1
    Vendon likes this.

Share This Page