Advertisement
mobychan

MSS - Text SE

Jul 23rd, 2012
6,280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 5.18 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # ▼ Moby's Script System - Text SE V1.0
  4. # -- Last Updated: 2012.07.23
  5. #
  6. #==============================================================================
  7.  
  8. $imported = {} if $imported.nil?
  9. $imported["MSS-Text_SE"] = 1.0
  10.  
  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # N/A
  15. #
  16. #==============================================================================
  17. # ▼ Introduction
  18. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  19. # This Script plays a SE you define in the module at the top every x letters.
  20. # Possible Settings:
  21. # - SE File Name
  22. # - Pitch Range
  23. # - Volume
  24. # - Interval(x)
  25. #
  26. #==============================================================================
  27. # ▼ Instructions
  28. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  29. # To install this script, open up your script editor and copy/paste this script
  30. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  31. #
  32. # All settings possible are placed in the module at the top.
  33. #
  34. # If you have any questions, bugs you want to report or anything else,
  35. # please contact me at mobychan@gmx.de or via my profile on
  36. # http://forums.rpgmakerweb.com (mobychan) or
  37. # http://w11.zetaboards.com/RMParadise/index/ (mobychan).
  38. #
  39. #
  40. #==============================================================================
  41. # ▼ Compatibility
  42. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  43. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  44. # it will run with RPG Maker VX without adjusting.
  45. #
  46. #==============================================================================
  47. #
  48. #==============================================================================
  49. # ▼ Methods changed/added
  50. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  51. # -----------------------------------------------------------------------------
  52. # Aliased methods:
  53. # -----------------------------------------------------------------------------
  54. # class Window_Message:
  55. #     - initialize
  56. #     - process_normal_character
  57. #     - process_new_page
  58. #
  59. # -----------------------------------------------------------------------------
  60. # Added methods:
  61. # -----------------------------------------------------------------------------
  62. # module Sound:
  63. #     - self.play_text_se
  64. #
  65. #==============================================================================
  66. #
  67. #==============================================================================
  68. # ▼ Compatibility Issues
  69. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  70. # Since this script doesn't override anything there shouldn't be any issues.
  71. # I fsomething doesn't work properly, try putting this script below every other
  72. # script.
  73. #==============================================================================
  74.  
  75.  
  76. module TSE
  77.   # The name of the file that will be played, must be placed in Audio/SE
  78.   SE = "Cursor1"
  79.   # The pitch range of the file being played
  80.   # [start_pitch, end_pitch]
  81.   # start and end pitch can be the same to have a static pitch
  82.   Pitch = [150, 175]
  83.   # The volume of the file being played
  84.   Volume = 100
  85.   # The interval at which the sound is being played, every x characters
  86.   Interval = 4
  87. end
  88.  
  89.  
  90.  
  91. #==============================================================================
  92. # ** Sound
  93. #==============================================================================
  94.  
  95. module Sound
  96.  
  97.   # System Sound Effect
  98.   def self.play_text_se
  99.     file = "Audio/SE/" + TSE::SE
  100.     pitch = rand(TSE::Pitch[1] - TSE::Pitch[0]) + TSE::Pitch[0]
  101.     Audio.se_play(file, TSE::Volume, pitch)
  102.   end
  103. end
  104.  
  105.  
  106.  
  107. #==============================================================================
  108. # ** Window_Message
  109. #==============================================================================
  110. class Window_Message < Window_Base
  111.   #--------------------------------------------------------------------------
  112.   # * Object Initialization
  113.   #--------------------------------------------------------------------------
  114.   alias tse_init initialize unless $@
  115.   def initialize
  116.     tse_init
  117.     @character = 0
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # * Normal Character Processing
  121.   #--------------------------------------------------------------------------
  122.   alias tse_process_normal_character process_normal_character unless $@
  123.   def process_normal_character(c, pos)
  124.     tse_process_normal_character(c, pos)
  125.     Sound.play_text_se if @character % TSE::Interval == 0 && !@line_show_fast
  126.     @character += 1
  127.   end
  128.   #--------------------------------------------------------------------------
  129.   # * New Page Character Processing
  130.   #--------------------------------------------------------------------------
  131.   alias tse_process_new_page process_new_page unless $@
  132.   def process_new_page(text, pos)
  133.     tse_process_new_page(text, pos)
  134.     @character = 0
  135.   end
  136. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement