"Failed to execute "createLinearGradient" on "CanvasRenderingContext2D: Float parameter 3 is non-fin

Discussion in 'Javascript/Plugin Support' started by BustonCharts, Nov 10, 2019.

  1. BustonCharts

    BustonCharts Villager Member

    Messages:
    25
    Likes Received:
    1
    First Language:
    Americano
    Primarily Uses:
    RMMV
    ite. When using a skill, the game crashes with this error. It was doing it in the menu and in battle, but I removed the animation and now it works in the menu, but crashes when used in battle. No formula is set, no element, 1 ally target, 5MP no TP required, certain hit, 100% success, 1 repeat, no critical, no variance, 20% healing, HP Recover, Skill Type Special and Occasion: Always are its settings.
     
    #1
  2. bgillisp

    bgillisp Global Moderators Global Mod

    Messages:
    12,313
    Likes Received:
    12,536
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMVXA
    Usually that is a plug-in error. You will want to post a list of all of your plug-ins.

    Moved to Plug-in Support

     
    #2
  3. BustonCharts

    BustonCharts Villager Member

    Messages:
    25
    Likes Received:
    1
    First Language:
    Americano
    Primarily Uses:
    RMMV
    No plugins are installed.
     
    #3
  4. MrNybbles

    MrNybbles Veteran Veteran

    Messages:
    31
    Likes Received:
    22
    First Language:
    English
    Primarily Uses:
    RMMV
    The cause of the crash seems unrelated to your still, yet is triggered by using it.

    Non-finite values would be things like NaNs (a value meaning Not A Number), +infinity, and -infinity, undefined, strings, objects, arrays, etc. Basically not an Integer or a Real number.

    The function 'createLinearGradient' is only found in rpg_core.js and is called from 'Bitmap.prototype.gradientFillRect'.

    To get more information when this happens, press the F8 (on Windows) key to open the Dev Console and you should see a stack trace, something like this:
    Example Stack Dump:
    Code:
    rpg_managers.js:1949 TypeError: Failed to execute 'createLinearGradient' on 'CanvasRenderingContext2D': The provided double value is non-finite.
        at Bitmap.gradientFillRect (rpg_core.js:1289)
        at Window_MenuStatus.Window_Base.drawGauge (rpg_windows.js:469)
        at Window_MenuStatus.Window_Base.drawActorHp (rpg_windows.js:555)
        at Window_MenuStatus.Window_Base.drawActorSimpleStatus (rpg_windows.js:592)
        at Window_MenuStatus.drawItemStatus (rpg_windows.js:1768)
        at Window_MenuStatus.drawItem (rpg_windows.js:1741)
        at Window_MenuStatus.Window_Selectable.drawAllItems (rpg_windows.js:1256)
        at Window_MenuStatus.Window_Selectable.refresh (rpg_windows.js:1283)
        at Window_MenuStatus.initialize (rpg_windows.js:1708)
        at new Window_MenuStatus (rpg_windows.js:1696)
    
    So in my example things went wrong when trying to draw the Actor's HP Gauge. That should get you one step closer to the cause.

    At this point I recommend copying fresh versions of all your rpg_*.js files in your projects 'js' directory from a different project with no issues just in case something got corrupted in those files.

    However, I don't know why there is a variation in our error messages. When I forced an error I get told it is expecting a Double, not a Float and I don't get told which parameter went wrong. What platform are you running on?
     
    #4
    caethyril likes this.
  5. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,280
    Likes Received:
    799
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    What version are your project files at? You can check by going to Game > Open Folder, then opening the js subfolder there. Open the rpg_core.js file in a text-editor (e.g. Notepad) and check the top couple of lines for a version number, e.g. for me it shows this:
    Code:
    //=============================================================================
    // rpg_core.js v1.6.2
    //=============================================================================
    Also, if your project code version does not match your editor version (Help > About) then you may get various unexpected results.

    I would guess the error is due to you having a damage type set, but no formula. This means the formula will return undefined, which is non-numerical and will mess up the gauge scaling if you are using a very outdated version of the core scripts. Some updates changed more than just the core script files, so MrNybbles's file-copy suggestion might not be sufficient; you can find update announcements and related instructions/details over here: https://forums.rpgmakerweb.com/index.php?forums/rpg-maker-mv-software-updates.171/&order=post_date

    Short answer: set your skill's damage type to None if it has no damage formula~
     
    #5
    ramza and MrNybbles like this.

Share This Page