Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # Text Sound Effect
- #------------------------------------------------------------------------------
- # by Zerbu
- # edited by mjshi for some variation :)
- #==============================================================================
- module Text_Sound_Effect
- #--------------------------------------------------------------------------
- # Configuration
- #--------------------------------------------------------------------------
- # The sound effect to play ("Name", Volume, Pitch)
- # This can also be a filename without the file extension
- # (i.e., beep.wav should be written as "beep")
- MESSAGE_SOUND = RPG::SE.new("Knock", 100, 100)
- # The number of characters to display before each time the sound plays
- # I recommend that you make this number at least 2 larger than the
- # largest number in your variation.
- MESSAGE_SOUND_FRAMES = 4
- # Variation decreases the number of characters displayed before the sound
- # plays. Set to true to turn on, false to turn off.
- VARY = true
- # Have multiple versions of the same number increases the chance of that
- # specific delay occuring. It is not recommended to have variations
- # above 2 seconds unless your message sound frames is super long or
- # something.
- VARIATION = [0, 0, 1, 1, 2]
- # Write a switch # here. Turn this switch on to disable sound effects.
- # To disable this feature, type nil.
- MESSAGE_SOUND_DISABLE = nil
- end
- class Window_Message < Window_Base
- include Text_Sound_Effect
- alias textsound_process_character_normal process_character
- def process_character(c, text, pos)
- if !MESSAGE_SOUND_DISABLE or !$game_switches[MESSAGE_SOUND_DISABLE]
- if !defined?(@sound_frames)
- @sound_frames = 0
- end
- if @sound_frames == 0
- MESSAGE_SOUND.play
- end
- @sound_frames+=1
- if @sound_frames == MESSAGE_SOUND_FRAMES and VARY == false
- @sound_frames = 0
- elsif @sound_frames == MESSAGE_SOUND_FRAMES and VARY == true
- @sound_frames = VARIATION.sample
- end
- end
- textsound_process_character_normal(c, text, pos)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement