Advertisement
Diego-Mertens

paste1

Mar 5th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. #==============================================================================#
  2. # Better Fast-forward Mode #
  3. # v1.0 #
  4. # #
  5. # by Marin #
  6. #==============================================================================#
  7. # Usage #
  8. # #
  9. # SPEEDUP_STAGES are the speed stages the game will pick from. If you click F, #
  10. # it'll choose the next number in that array. It goes back to the first number #
  11. # afterward. #
  12. # #
  13. # $GameSpeed is the current index in the speed up array. #
  14. # Should you want to change that manually, you can do, say, $GameSpeed = 0 #
  15. # #
  16. # If you don't want the user to be able to speed up at certain points, you can #
  17. # use "pbDisallowSpeedup" and "pbAllowSpeedup". #
  18. #==============================================================================#
  19. # Please give credit when using this. #
  20. #==============================================================================#
  21.  
  22. # When the user clicks F, it'll pick the next number in this array.
  23. SPEEDUP_STAGES = [1,2,3]
  24.  
  25.  
  26. def pbAllowSpeedup
  27. $CanToggle = true
  28. end
  29.  
  30. def pbDisallowSpeedup
  31. $CanToggle = false
  32. end
  33.  
  34. # Default game speed.
  35. $GameSpeed = 0
  36.  
  37. $frame = 0
  38. $CanToggle = !FileTest.exist?(Dir.pwd + "/_installer/Scripts.rxdata")
  39. module Graphics
  40. class << Graphics
  41. alias fast_forward_update update
  42. end
  43.  
  44. def self.update
  45. if $CanToggle && Input.trigger?(Input::G)
  46. $GameSpeed += 1
  47. $GameSpeed = 0 if $GameSpeed >= SPEEDUP_STAGES.size
  48. end
  49. $frame += 1
  50. return unless $frame % SPEEDUP_STAGES[$GameSpeed] == 0
  51. fast_forward_update
  52. $frame = 0
  53. end
  54. end
  55.  
  56. module Input
  57. class << Input
  58. alias fast_forward_button_to_key buttonToKey
  59. end
  60.  
  61. G = 51
  62.  
  63. def self.buttonToKey(btn)
  64. return [0x47] if btn == Input::G
  65. fast_forward_button_to_key(btn)
  66. end
  67. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement