Speed Up

Zero_G

Veteran
Veteran
Joined
Mar 28, 2020
Messages
43
Reaction score
29
First Language
English
Primarily Uses
RMVXA
This one is based on Debug Speed Up by SumRndmDde. But I only wanted the speed up while a button is pressed. So I stripped most of the functions of the script, also added speedup during combat that wasn't implemented.

JavaScript:
//=============================================================================
// ZERO_Speedup.js
//=============================================================================
/*:
 * @ZERO_Speedup
 * @plugindesc Speed up game while button pressed
 * @version 1.1
 * @author Zero_G
 * @filename ZERO_Speedup.js
 * @help
 -------------------------------------------------------------------------------
 == Description ==
 This plugin will speed up the game while a button is pressed

 Based on SumRndmDde Speedup script (http://sumrndm.site/debug-speed-up/)

 == Terms of Use ==
 - Free for use in non-commercial projects with credits
 - Free for use in commercial projects
 - Please provide credits to Zero_G

 == Usage ==
 Just add the plugin.

 == Changelog ==
 1.1 Fixed not working out of test play
 
 -------------------------------------------------------------------------------
 @param Speedup Button
 @desc Button to speedup the game
 @default a
 
 @param Test Play Only
 @desc Speed up only during test play
 @type boolean
 @default false

 @param Speed Amount
 @desc Amount to speed up
 @type number
 @default 5
 
 -------------------------------------------------------------------------------

*/

var Imported = Imported || {};
var ZERO = ZERO || {};
Imported.ZERO_Speedup = 1;
ZERO.Speedup = ZERO.Speedup || {};

(function ($) {
    $.params = PluginManager.parameters('ZERO_Speedup');
    $.button = $.params['Speedup Button'].trim();
    $.testPlayOnly = ($.params['Test Play Only'].trim() === 'true');
    $.speed = Number($.params['Speed Amount'].trim());
    let speed = 1

    // Add key mappings
    function addKeyMapping(key){
        let buttonCode = key.toUpperCase().charCodeAt(0);

        // Prevent from mapping predefined strings (ej: 'pageup', 'left')
        for (const [key_, value] of Object.entries(Input.keyMapper)) {
        if(key.localeCompare(value) == 0) return key;
        }

        if (Input.keyMapper[buttonCode] === undefined) {
        Input.keyMapper[buttonCode] = key;
        return key;
        }else{
        // If it was already defined, return the char/string it was defined with
        return Input.keyMapper[buttonCode];
        }
    }

    $.button = addKeyMapping($.button);

    //------------------------------//
    // Check when button is pressed //
    //------------------------------//

    // SpeedUp Start Event Listener
    document.addEventListener('keydown', event => {
        if (Input.keyMapper[event.keyCode] == $.button) {
            if($gameTemp.isPlaytest() || !$.testPlayOnly){
                speed = $.speed;
            }
        }
    })

    // SpeedUp Stop Event Listener
    document.addEventListener('keyup', event => {
        if (Input.keyMapper[event.keyCode] == $.button) {
            if($gameTemp.isPlaytest() || !$.testPlayOnly){
                speed = 1;
            }
        }
    })

    //------------------------------//
    // Speedup function             //
    //------------------------------//

    var _Scene_Map_update = Scene_Map.prototype.update;
    Scene_Map.prototype.update = function() {
        for(var i = 0; i < Math.floor(speed); i++) {
            _Scene_Map_update.call(this)
        }
    };

    var _Spriteset_Base_update = Spriteset_Base.prototype.update;
    Spriteset_Base.prototype.update = function() {
        for(var i = 0; i < Math.floor(speed); i++) {
            _Spriteset_Base_update.call(this);
        }
    };

    var _Scene_Battle_prototype_update = Scene_Battle.prototype.update;
    Scene_Battle.prototype.update = function() {
        for(var i = 0; i < Math.floor(speed); i++) {
            _Scene_Battle_prototype_update.call(this);
        }
    };
  
})(ZERO.Speedup);
 
Last edited:

Zero_G

Veteran
Veteran
Joined
Mar 28, 2020
Messages
43
Reaction score
29
First Language
English
Primarily Uses
RMVXA
Fixed a bug where the script wasn't working out of test play even if the parameter was correctly set.
 

Latest Threads

Latest Posts

Latest Profile Posts

Since I started in this world of make games, It's hard for me to enjoy playing a game. It's like, coding and make it work, sounds like I'm playing and have fun o_O
Not sure if it's true (and I won't judge or blame anyone if it is, really), but I heard from confident sources that you guys (and girls) really really like to
How is this new year for everyone? Hope you are well. Still deep in Covid in the US. Its like a vampire and refuses to die with even more strains. I need some holy water to kill it with.
in my game, what's known as HeadSpace is combining with the real world...
oh looks like the forums updated while I wasn't looking and we can put a banner now. Neat!

Forum statistics

Threads
107,669
Messages
1,031,289
Members
139,790
Latest member
TransDiv
Top