RMMV JavaScript Unofficial Bugfix Snippets

Discussion in 'JS Plugin Releases (RMMV)' started by Shaz, Oct 23, 2015.

  1. Shaz

    Shaz Veteran Veteran

    Messages:
    37,568
    Likes Received:
    11,270
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    This thread will be used to compile code snippets written to correct JavaScript bugs with the default scripts.  Add these as plugins, at the top of your plugin list.  These are only guaranteed to work with the default scripts.
     
    #1
    wclear likes this.
  2. Zalerinian

    Zalerinian Jack of all Errors Veteran

    Messages:
    4,695
    Likes Received:
    922
    Location:
    The Internet.
    First Language:
    English
    Primarily Uses:
    N/A
    #2
  3. Shaz

    Shaz Veteran Veteran

    Messages:
    37,568
    Likes Received:
    11,270
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Steam version won't update until tomorrow either, I suspect.  I'm in the dark, like you, right now :)
     
    #3
  4. Ramiro

    Ramiro Now with an army of Mecha-Ralphs! Veteran

    Messages:
    860
    Likes Received:
    366
    Location:
    Argentina
    First Language:
    Spanish
    #4
  5. Shaz

    Shaz Veteran Veteran

    Messages:
    37,568
    Likes Received:
    11,270
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Is this a fix for a bug with the standard scripts?  That is what this thread is for.  Are you saying there is something wrong with the default scripts?
     
    #5
  6. Ramiro

    Ramiro Now with an army of Mecha-Ralphs! Veteran

    Messages:
    860
    Likes Received:
    366
    Location:
    Argentina
    First Language:
    Spanish
    They doesn't work if the function doesn't have a name. So this fixes that.

    But I don't really know if I could consider that a bug or not. You won't have problems if:

    • Your class is not inside an object but window.
    • Your class is created with a name.
    This is a way to solve the case when  one of those two conditions are not met...

    By default:

    function Class {}; // this can be serialized (saved inside a json file and loaded)var Class = function {}; // this can't be serializedSceneManager.Subclass = function {}; // this class can't be serialized too_Of course that is the oly thing I could see with not too much viewing the code of the engine...

    So while it doesn't automatically fixes those problems, it give a way to solve it quickly...
     
    Last edited by a moderator: Oct 23, 2015
    #6
  7. Shaz

    Shaz Veteran Veteran

    Messages:
    37,568
    Likes Received:
    11,270
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    What doesn't work? This thread is for bugs with the default scripts. "Your class" implies stuff YOU are doing/changing, so is not related to the default scripts. Therefore it is not a bug fix.
     
    #7
  8. Ramiro

    Ramiro Now with an army of Mecha-Ralphs! Veteran

    Messages:
    860
    Likes Received:
    366
    Location:
    Argentina
    First Language:
    Spanish
    Sorry then, I think I need some rest, but yes, it's not a bugfix for core classes...

    I'll check the default classes with more attention tomorrow... before I fall sleep at my pc...
     
    Last edited by a moderator: Oct 23, 2015
    #8
  9. Shaz

    Shaz Veteran Veteran

    Messages:
    37,568
    Likes Received:
    11,270
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    okay, cool. If it's a plugin you'll be able to post it when we open up plugin posting. This is JUST for core script fixes :)
     
    #9
  10. Ramiro

    Ramiro Now with an army of Mecha-Ralphs! Veteran

    Messages:
    860
    Likes Received:
    366
    Location:
    Argentina
    First Language:
    Spanish
    There is a bug I found, if you enter a battle with dead/sleep characters, they don't show up:

    [​IMG]
    I found why and this is the fix:

    Now, it looks like this:

    [​IMG]
    But It may broke other things... for now I can't find a moment when it does.

    Here is the code:

    //=============================================================================// Sprite_ActorFix.js// By Ramiro Rojo// Version: 1.0.0// Released under CC0 Universal 1.0// You can read the full license from here:// https://creativecommons.org/publicdomain/zero/1.0/legalcode// but basically means "public domain" in fancy words//-----------------------------------------------------------------------------// If you are using the YEP_CorenEngine, put this after...//=============================================================================/*: * @plugindesc Fixes some bugs on battle sprites. * @help * Just add it and enjoy, you may want to configure the parameters to work... */var Imported = Imported || {};Imported.Sprite_ActorFix = true;(function () { var moveToStartPosition = Sprite_Actor.prototype.moveToStartPosition; var setBattler = Sprite_Actor.prototype.setBattler; var setHome = Sprite_Actor.prototype.setHome; var startMove = Sprite_Battler.prototype.startMove; Sprite_Actor.prototype._getActorHomeX = function (index) { if (Imported.YEP_BattleEngineCore) { if ($gameSystem.isSideView()) { return eval(Yanfly.Param.BECHomePosX); } else { return eval(Yanfly.Param.BECFrontPosX); } } return Graphics.boxWidth - 216 + index * 32; } Sprite_Actor.prototype._getActorHomeY = function (index) { if (Imported.YEP_BattleEngineCore) { if ($gameSystem.isSideView()) { return eval(Yanfly.Param.BECHomePosY); } else { return eval(Yanfly.Param.BECFrontPosY); } } return Graphics.boxHeight - 344 + index * 48; } Sprite_Actor.prototype.setHome = function(x, y) { var battler = this._actor; if (battler) { if (!battler.canMove()) { var index = battler.index(); this._homeX = this._getActorHomeX(index); this._homeY = this._getActorHomeY(index); this.startMove(0, 0, 0); console.log("%i, %i", this._homeX, this._homeY); return; } } setHome.apply(this, arguments); } Sprite_Battler.prototype.startMove = function () { var battler = this._actor; if (battler && !battler.canMove()) { this._offsetX = 0; this._offsetY = 0; return; } startMove.apply(this, arguments); }})();
    I can't find why marsha's pose is still wrong anyway...
     
    Last edited by a moderator: Oct 25, 2015
    #10
  11. Jeneeus Guruman

    Jeneeus Guruman The Returnee Veteran

    Messages:
    1,078
    Likes Received:
    188
    Location:
    Philippines
    First Language:
    Filipino
    So I found a bug on the default script without any plugins installed when choosing the escape command. Whether escaping is successful or not, all statuses that will be removed after the battle will be removed even if the party fails to escape. Here's my code to fix it though.
     
    #11
    Wren and Shaz like this.
  12. Fernyfer775

    Fernyfer775 Veteran Veteran

    Messages:
    1,297
    Likes Received:
    800
    First Language:
    English
    Are you sure the states option "remove at battle end" isn't checked?
     
    #12
  13. Jeneeus Guruman

    Jeneeus Guruman The Returnee Veteran

    Messages:
    1,078
    Likes Received:
    188
    Location:
    Philippines
    First Language:
    Filipino
    The bug I found only occurs with those states that has "remove at battle end" option checked. Those that are unchecked are just fine and stays at the end if the battle, regardless if escaping is successful or failed.
     
    #13
  14. Shaz

    Shaz Veteran Veteran

    Messages:
    37,568
    Likes Received:
    11,270
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Yep, confirmed this is a bug.  Have logged with KDKW for a fix.  Thanks :)
     
    #14
  15. Liquidize

    Liquidize Caffeine Overload Developer

    Messages:
    466
    Likes Received:
    454
    Location:
    Somewhere.
    First Language:
    English
    Primarily Uses:
    RMMV
    This script is a fix for a bug that causes a crash/an exception when no damage formula is entered for a skill. Prior to this script it would return Not-a-number causing the crash when trying to evaluate what value to give the gauges. This script overwrites the damage formula evaluating function and if its supposed to return NaN it will return 0 (no damage).

    This bug occurs when using side-view-battle (no plugins), I am unsure if it did occur when using front view or when using other plugins, but if it did that should also be fixed.

    Script:

    http://pastebin.com/YFhpkVDv
     
    #15
  16. Shaz

    Shaz Veteran Veteran

    Messages:
    37,568
    Likes Received:
    11,270
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Is this the error?

    TypeError

    Failed to execute 'creaeLinearGradient' on 'CanvasRenderingContext2D': float parameter 3 is non-finite.

    That's a weird-looking error for a damage formula being missing!
     
    #16
  17. Liquidize

    Liquidize Caffeine Overload Developer

    Messages:
    466
    Likes Received:
    454
    Location:
    Somewhere.
    First Language:
    English
    Primarily Uses:
    RMMV
    Yes that is the error :) . I believed it is caused because, when there is no formula the evaluation function doesn't actually return a number which is why that 'createLinearGradient' function is producing an error over a float parameter that doesn't exists. 
     
    Last edited by a moderator: Nov 2, 2015
    #17
  18. Shaz

    Shaz Veteran Veteran

    Messages:
    37,568
    Likes Received:
    11,270
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    thanks. Reproduced, and logged.
     
    #18
  19. orlando

    orlando Veteran Veteran

    Messages:
    177
    Likes Received:
    84
    This was mentioned in another thread, but apparently the engine isn't coded to stick to 60FPS in game logic speed.

    This snippet fixes it and both compensates for fast and slow computers with adjusting the scene updates accordingly:

    // fixed FPS to fix framerate problems:var logicLength = (1000.0/60.0);SceneManager.update = function() { try { this.tickStart(); // frame start // ensure we have the required time values: var time_now = performance.now(); if (typeof(this.lastTick) == "undefined") { this.lastTick = time_now; } if (this.lastTick + 500.0 < time_now) { this.lastTick = time_now; } // game loop updates (catches up to fixed 60 FPS): while (this.lastTick < time_now) { this.updateInputData(); this.changeScene(); this.updateScene(); this.lastTick += logicLength; } // render scene (on demand): this.renderScene(); this.requestUpdate(); this.tickEnd(); // frame end } catch (e) { this.catchException(e); }};SceneManager.updateMain = function() { throw "unused, code migrated to SceneManager.update()";}Might wanna share this with the devs unless they want to use some other fancy way of fixing this.
    TL;DR: this fixes walk speed unintentionally speeding up on faster computers with 144hz screens (and vice versa fixes slow walking on computers that don't reach 60FPS drawing speed).

    Edit: snippet fix, previous version caused key presses to be evaluated twice sometimes
     
    Last edited by a moderator: Nov 22, 2015
    #19
  20. Shaz

    Shaz Veteran Veteran

    Messages:
    37,568
    Likes Received:
    11,270
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    You mentioned walk speed, but I don't see that that bit of code has anything to do with walk speed specifically (rather, walk-speed changing would be a symptom of the problem, but there would be many other symptoms as well). Can you clarify/confirm? Do you have a link to the original thread?
     
    #20

Share This Page