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 Profile Posts

Ugh, I may have been cumbersomely eventing a bunch of stuff I could have easily done changing the tileset "Passage (4 dir)" and "Ladder" options. Oops :D
I have no idea why some of the program "splash screen" always on top. E.g, RMMZ loading screen stuck on the top blocking anything I want to do until it fully loaded. What is even the purpose?
One of the secret places in the game.
Had a dream last night that I died -- what a way to start the weekend! :'D
For some reasons, my signature was replaced by god-knows-what, written in French. Had to re-replace it with my signature Nazeem-ish quote; not gonna remake my signature any time soon.

Forum statistics

Threads
107,639
Messages
1,031,062
Members
139,759
Latest member
Tapi
Top