TheoAllen

Theo - Simple Message SE

Jul 20th, 2013
557
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.65 KB | None | 0 0
  1. # =============================================================================
  2. # TheoAllen - Simple Message SE
  3. # Version : 1.0
  4. # Contact : www.rpgmakerid.com (or) http://theolized.blogspot.com
  5. # (This script documentation is written in informal indonesian language)
  6. # =============================================================================
  7. ($imported ||= {})[:Theo_MessageSE] = true
  8. # =============================================================================
  9. # CHANGE LOGS:
  10. # -----------------------------------------------------------------------------
  11. # 2013.07.20 - Finished script
  12. # =============================================================================
  13. =begin
  14.  
  15.   Perkenalan :
  16.   Script ini bekerja untuk play SE saat proses penulisan text pada window
  17.   message (typing message)
  18.  
  19.   Cara penggunaan :
  20.   Pasang script ini dibawah material namun diatas main
  21.   Edit konfigurasinya
  22.  
  23.   Terms of Use :
  24.   Credit gw, TheoAllen. Kalo semisal u bisa ngedit2 script gw trus jadi lebih
  25.   keren, terserah. Ane bebasin. Asal ngga ngeklaim aja. Kalo semisal mau
  26.   dipake buat komersil, jangan lupa, gw dibagi gratisannya.
  27.  
  28. =end
  29. # =============================================================================
  30. # Konfigurasi :
  31. # =============================================================================
  32. module THEO
  33.   module MSG
  34.    
  35.     # Nama file SE yang harus ada di Audio/SE
  36.     FileName  = "Cursor1"
  37.    
  38.     # Volume SE yang akan dibunyikan
  39.     Volume    = 60
  40.    
  41.     # Pitch SE yang akan dibunyikan
  42.     Pitch     = 100
  43.    
  44.     # Perbedaan pitch tiap kali dibunyikan
  45.     RandPitch = 10 # (jika pitch 110 dan RandPitch 10 maka pitch = 100 - 120)
  46.    
  47.     # Jeda karakter untuk ngebunyiin SE
  48.     CharWait  = 3
  49.    
  50.     # Switch ID untuk ngedisable play message SE (ON = disable)
  51.     Switch_id = 0
  52.    
  53.   end
  54. end
  55. # =============================================================================
  56. # Akhir dari konfigurasi :
  57. # =============================================================================
  58. class Window_Message < Window_Base
  59.   include THEO::MSG  
  60.  
  61.   alias theo_msg_se_init initialize
  62.   def initialize(*args)
  63.     theo_msg_se_init(*args)
  64.     @charwait = 0
  65.   end
  66.  
  67.   alias theo_wait_one_char_se wait_for_one_character
  68.   def wait_for_one_character
  69.     theo_wait_one_char_se
  70.     play_msg_se unless @show_fast || @line_show_fast
  71.   end
  72.  
  73.   def play_msg_se
  74.     @charwait += 1
  75.     return if $game_switches[Switch_id]
  76.     return unless @charwait % [CharWait,1].max == 0
  77.     pitch = Pitch + (rand(RandPitch*2) - RandPitch)
  78.     name = sprintf("Audio/SE/%s",FileName)
  79.     Audio.se_play(name,Volume,pitch)
  80.   end
  81.  
  82. end
Advertisement
Add Comment
Please, Sign In to add comment