TheoAllen

Theo - Storm Effect

Apr 14th, 2013
491
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.88 KB | None | 0 0
  1. # ============================================================================
  2. # TheoAllen - STORM EFFECTS ~
  3. # Version : 1.0b
  4. # Author : TheoAllen
  5. # Contact : www.rpgmakerid.com
  6. # (This script documentation is written in informal indonesian language)
  7. # ============================================================================
  8. $imported = {} if $imported.nil?
  9. $imported[:Theo_Storm] = true
  10. module THEO
  11. # =============================================================================
  12. # CHANGE LOGS:
  13. # -----------------------------------------------------------------------------
  14. # 2013.05.02 - Nambahin dokumentasi lebih detil
  15. #            - Nambahin konfigurasi SE
  16. # 2013.04.14 - Started and Finished script
  17. # =============================================================================
  18. =begin
  19.  
  20.   PENGENALAN :
  21.   Script ini untuk membuat effect storm / badai dengan menambahkan effect
  22.   macem kilatan petir dan effect suara petir menggelegar.
  23.  
  24.   PENGGUNAAN :
  25.   Tulis dalam script call :
  26.   - THEO.thunder_on     >> nyalain effect suara petir
  27.   - THEO.thunder_off    >> matiin effect suara petir
  28.   - THEO.flash_on       >> nyalain effect flashing screen
  29.   - THEO.flash_off      >> matiin effect flasing screen
  30.  
  31.   Untuk ganti chance efeknya:
  32.   - THEO.thunder_chance(chance,dice) >> chance/dice (masukinnya berupa angka)
  33.   - THEO.flash_chance(chance,dice) >> sama kek thunder :v
  34.  
  35.   TERMS OF USE :
  36.   Credit gw, TheoAllen. Kalo semisal u bisa ngedit2 script gw trus jadi lebih
  37.   keren, terserah. Ane bebasin. Asal ngga ngeklaim aja. Kalo semisal mau
  38.   dipake buat komersil, jangan lupa, gw dibagi gratisannya.
  39.  
  40. =end
  41. # ============================================================================  
  42. # Konfigurasi :
  43. # ============================================================================
  44.  
  45.   THUNDER_CHANCE  = [10,1000]   # nilai default thunder chance
  46.   FLASH_CHANCE    = [ 5,1000]   # nilai default flash chance
  47.   THUNDER_SE      = "Thunder9"  # file untuk SE petir
  48.  
  49. # ============================================================================
  50. # Setelah line ini jangan diedit kecuali ente ngerti ~
  51. # ============================================================================  
  52.   def self.thunder_chance(chance,dice)
  53.     $game_system.thunder_chance = [chance,dice].dup
  54.   end
  55.  
  56.   def self.flash_chance(chance,dice)
  57.     $game_system.flash_chance = [chance,dice].dup
  58.   end
  59.  
  60.   def self.thunder_on
  61.     $game_system.thunder_switch = true
  62.   end
  63.  
  64.   def self.thunder_off
  65.     $game_system.thunder_switch = false
  66.   end
  67.  
  68.   def self.flash_on
  69.     $game_system.flash_switch = true
  70.   end
  71.  
  72.   def self.flash_off
  73.     $game_system.flash_switch = false
  74.   end
  75.  
  76. end
  77.  
  78. class Game_System
  79.   attr_accessor :flash_chance
  80.   attr_accessor :flash_switch
  81.   attr_accessor :thunder_chance
  82.   attr_accessor :thunder_switch
  83.  
  84.   alias theolized_storm_init initialize
  85.   def initialize
  86.     theolized_storm_init
  87.     @flash_chance = THEO::THUNDER_CHANCE.dup
  88.     @flash_switch = false
  89.     @thunder_chance = THEO::FLASH_CHANCE.dup
  90.     @thunder_switch = false
  91.   end
  92.  
  93. end
  94.  
  95. class Scene_Map < Scene_Base
  96.  
  97.   alias vg_update update
  98.   def update
  99.     vg_update
  100.     apply_effects
  101.   end
  102.  
  103.   def apply_effects
  104.     apply_flashing_screen if system.flash_switch
  105.     apply_thunder_bgs if system.thunder_switch
  106.   end
  107.  
  108.   def apply_flashing_screen
  109.     chance = (rand*system.flash_chance[1]).round
  110.     if chance <= system.flash_chance[0]
  111.       color = Color.new(255,255,255,(rand*255).round)
  112.       screen.start_flash(color,(rand*30).round)
  113.     end
  114.   end
  115.  
  116.   def apply_thunder_bgs
  117.     chance = (rand*system.thunder_chance[1]).round
  118.     if chance <= system.flash_chance[0]
  119.       file = sprintf("Audio/SE/%s",THEO::THUNDER_SE)
  120.       Audio.se_play(file,(rand*60).round)
  121.     end
  122.   end
  123.  
  124.   def screen
  125.     $game_map.screen
  126.   end
  127.  
  128.   def system
  129.     $game_system
  130.   end
  131.  
  132. end
Advertisement
Add Comment
Please, Sign In to add comment