TheoAllen

Theo - Message Sound Effect Code

Oct 13th, 2013
470
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.50 KB | None | 0 0
  1. # =============================================================================
  2. # TheoAllen - Message Sound Effect Code
  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_MsgSECode] = true
  8. # =============================================================================
  9. # CHANGE LOGS:
  10. # -----------------------------------------------------------------------------
  11. # 2013.10.08 - Finished script
  12. # =============================================================================
  13. =begin
  14.  
  15.   Perkenalan :
  16.   Script ini ngebikin kamu bisa ngeplay SE pas text diketik dalam message box
  17.  
  18.   Cara penggunaan :
  19.   Pasang dibawah material namun diatas main
  20.   Edit konfigurasinya untuk mencatat SE yang akan kamu gunain
  21.  
  22.   Gunakan kode \SE[index] dimana index adalah database SE yang ada dalam
  23.   konfigurasi dibawah
  24.  
  25.   Terms of use :
  26.   Credit gw, TheoAllen. Kalo semisal u bisa ngedit2 script gw trus jadi lebih
  27.   keren, terserah. Ane bebasin. Asal ngga ngeklaim aja. Kalo semisal mau
  28.   dipake buat komersil, jangan lupa, gw dibagi gratisannya.  
  29.  
  30. =end
  31. # =============================================================================
  32. # Konfigurasi :
  33. # =============================================================================
  34. class Window_Message < Window_Base # <-- Jangan disentuh
  35. # ----------------------------------------------------------------------------
  36. # Catat SE yang akan digunakan disini
  37.   SE_Names = {
  38.  
  39.   # index => ["SE Name", Volume, Pitch],
  40.         1 => ["Absorb1",    100,   100],
  41.  
  42.   # Tambahin sendiri
  43.        
  44.   } # <-- Jangan disentuh
  45.  
  46. # =============================================================================
  47. # Akhir dari konfigurasi
  48. # =============================================================================
  49.   alias theo_msgsound_process_esc_char process_escape_character
  50.   def process_escape_character(code, text, pos)
  51.     theo_msgsound_process_esc_char(code, text, pos)
  52.     case code.upcase
  53.     when 'SE'
  54.       play_se(obtain_escape_param(text)) rescue show_play_se_error
  55.     end
  56.   end
  57.  
  58.   def play_se(index)
  59.     name = SE_Names[index][0]
  60.     vol = SE_Names[index][1]
  61.     pitch = SE_Names[index][2]
  62.     RPG::SE.new(name,vol,pitch).play
  63.   end
  64.  
  65.   def show_play_se_error
  66.     msgbox "Error: Invalid SE index"
  67.     SceneManager.exit
  68.   end
  69.  
  70. end
Advertisement
Add Comment
Please, Sign In to add comment