设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 71|回复: 0

[转载发布] Speed Up

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    7959

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    29925
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    38778

    灌水之王

    发表于 3 天前 | 显示全部楼层 |阅读模式
    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:       
    1. //=============================================================================
    2. // Speedup
    3. //=============================================================================
    4. /*:
    5. * @ZERO_Speedup
    6. * @plugindesc Speed up game while button pressed
    7. * @version 1.2
    8. * @author Zero_G
    9. * @filename ZERO_Speedup.js
    10. * @help
    11. -------------------------------------------------------------------------------
    12. == Description ==
    13. This plugin will speed up the game while a button is pressed
    14. Based on SumRndmDde Speedup script (http://sumrndm.site/debug-speed-up/)
    15. == Terms of Use ==
    16. - Free for use in non-commercial projects with credits
    17. - Free for use in commercial projects
    18. - Please provide credits to Zero_G
    19. == Usage ==
    20. Just add the plugin.
    21. == Changelog ==
    22. 1.1 -Fixed not working out of test play
    23. 1.2 -Updated method of getting plugin parameters, now you can freely change
    24.      the name of the .js file
    25.      -Added a null check for $gameTemp, so it doens't break when trying
    26.      to speedup when game is loading
    27. -------------------------------------------------------------------------------
    28. @param Speedup Button
    29. @desc Button to speedup the game
    30. @default a
    31. @param Test Play Only
    32. @desc Speed up only during test play
    33. @type boolean
    34. @default false
    35. @param Speed Amount
    36. @desc Amount to speed up
    37. @type number
    38. @default 5
    39. -------------------------------------------------------------------------------
    40. */
    41. var Imported = Imported || {};
    42. var ZERO = ZERO || {};
    43. Imported.ZERO_Speedup = 1;
    44. ZERO.Speedup = ZERO.Speedup || {};
    45. (function ($) {
    46.     // Get plugin name and parameters
    47.     var substrBegin = document.currentScript.src.lastIndexOf('/');
    48.     var substrEnd = document.currentScript.src.indexOf('.js');
    49.     var scriptName = document.currentScript.src.substring(substrBegin+1, substrEnd);
    50.     $.params = PluginManager.parameters(scriptName);
    51.    
    52.     $.button = $.params['Speedup Button'].trim();
    53.     $.testPlayOnly = ($.params['Test Play Only'].trim() === 'true');
    54.     $.speed = Number($.params['Speed Amount'].trim());
    55.     let speed = 1
    56.     // Add key mappings
    57.     function addKeyMapping(key){
    58.         let buttonCode = key.toUpperCase().charCodeAt(0);
    59.         // Prevent from mapping predefined strings (ej: 'pageup', 'left')
    60.         for (const [key_, value] of Object.entries(Input.keyMapper)) {
    61.             if(key.localeCompare(value) == 0) return key;
    62.         }
    63.         if (Input.keyMapper[buttonCode] === undefined) {
    64.             Input.keyMapper[buttonCode] = key;
    65.             return key;
    66.         }else{
    67.             // If it was already defined, return the char/string it was defined with
    68.             return Input.keyMapper[buttonCode];
    69.         }
    70.     }
    71.     $.button = addKeyMapping($.button);
    72.     //------------------------------//
    73.     // Check when button is pressed //
    74.     //------------------------------//
    75.     // SpeedUp Start Event Listener
    76.     document.addEventListener('keydown', event => {
    77.         if($gameTemp){
    78.             if (Input.keyMapper[event.keyCode] == $.button && ($gameTemp.isPlaytest() || !$.testPlayOnly)) {
    79.                 speed = $.speed;
    80.             }
    81.         }
    82.     })
    83.     // SpeedUp Stop Event Listener
    84.     document.addEventListener('keyup', event => {
    85.         if($gameTemp){
    86.             if (Input.keyMapper[event.keyCode] == $.button && ($gameTemp.isPlaytest() || !$.testPlayOnly)) {
    87.                 speed = 1;
    88.             }
    89.         }
    90.     })
    91.     //------------------------------//
    92.     // Speedup function             //
    93.     //------------------------------//
    94.     var _Scene_Map_update = Scene_Map.prototype.update;
    95.     Scene_Map.prototype.update = function() {
    96.         for(var i = 0; i < Math.floor(speed); i++) {
    97.             _Scene_Map_update.call(this)
    98.         }
    99.     };
    100.     var _Spriteset_Base_update = Spriteset_Base.prototype.update;
    101.     Spriteset_Base.prototype.update = function() {
    102.         for(var i = 0; i < Math.floor(speed); i++) {
    103.             _Spriteset_Base_update.call(this);
    104.         }
    105.     };
    106.     var _Scene_Battle_prototype_update = Scene_Battle.prototype.update;
    107.     Scene_Battle.prototype.update = function() {
    108.         for(var i = 0; i < Math.floor(speed); i++) {
    109.             _Scene_Battle_prototype_update.call(this);
    110.         }
    111.     };
    112.   
    113. })(ZERO.Speedup);
    复制代码




    本贴来自国际rpgmaker官方论坛作者:Zero_G处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/speed-up.127073/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-1 02:36 , Processed in 0.086239 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表