TheoAllen

TTS Addon - Common Event Reserver

Aug 29th, 2013
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.61 KB | None | 0 0
  1. # =============================================================================
  2. # TTS Addon - Common Event Reserver
  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 ||= {})[:TTS_CommonEvent] = true
  8. # =============================================================================
  9. # CHANGE LOGS:
  10. # -----------------------------------------------------------------------------
  11. # 2013.08.29 - Change update variables workflow + added week
  12. # 2013.08.27 - Finished script
  13. # =============================================================================
  14. =begin
  15.  
  16.   Perkenalan :
  17.   Script ini addon dari TheoAllen Time System yang bisa ngebikin kamu
  18.   ngejalanin common event setiap kali pergantian waktu.
  19.  
  20.   Semisal di setiap pergantian jam kamu menjalankan common event, maka jika
  21.   kamu skip 5 jam, system juga akan ngejalanin common event sebanyak 5 kali
  22.  
  23.   Cara penggunaan :
  24.   Pasang dibawah TTS - Core versi 1.1
  25.   Edit konfigurasinya
  26.  
  27.   Terms of Use :
  28.   Credit gw, TheoAllen. Kalo semisal u bisa ngedit2 script gw trus jadi lebih
  29.   keren, terserah. Ane bebasin. Asal ngga ngeklaim aja. Kalo semisal mau
  30.   dipake buat komersil, jangan lupa, gw dibagi gratisannya.
  31.  
  32. =end
  33. # =============================================================================
  34. # Konfigurasi :
  35. # =============================================================================
  36. module THEO
  37.   module Time
  38.     module ComEv
  39.     # -------------------------------------------------------------------------
  40.     # Common Event ID (Tulis 0 untuk disable)
  41.     # -------------------------------------------------------------------------
  42.       Minute  = 0  # Untuk setiap pergantian menit
  43.       Hour    = 1  # Untuk setiap pergantian jam
  44.       Day     = 2  # Untuk setiap pergantian hari
  45.       Week    = 3  # Untuk setiap pergantian minggu
  46.     # -------------------------------------------------------------------------
  47.     end
  48.   end
  49. end
  50. # =============================================================================
  51. # Akhir dari konfigurasi
  52. # =============================================================================
  53. class TimeSystem
  54.  
  55.   alias theo_comev_res_init initialize
  56.   def initialize
  57.     theo_comev_res_init
  58.     @comev_id = []
  59.   end
  60.  
  61.   alias theo_comev_res_update update
  62.   def update
  63.     theo_comev_res_update
  64.     update_common_event
  65.   end
  66.  
  67.   def update_common_event
  68.     return if @comev_id.empty?
  69.     return if $game_temp.common_event_reserved?
  70.     $game_temp.reserve_common_event(@comev_id.shift)
  71.   end
  72.  
  73.   alias theo_timecv_minute on_minute_change
  74.   def on_minute_change
  75.     if ComEv::Minute > 0 && Minute_ID > 0
  76.       comev = [ComEv::Minute] * ([minute - var[Minute_ID],0].max)
  77.       @comev_id += comev
  78.     end
  79.     theo_timecv_minute
  80.   end
  81.  
  82.   alias theo_timecv_hour on_hour_change
  83.   def on_hour_change
  84.     if ComEv::Hour > 0 && Hour_ID > 0
  85.       comev = [ComEv::Hour] * ([hour - var[Hour_ID],0].max)
  86.       @comev_id += comev
  87.     end
  88.     theo_timecv_hour
  89.   end
  90.  
  91.   alias theo_timecv_day on_day_change
  92.   def on_day_change
  93.     if ComEv::Day > 0 && Day_ID > 0
  94.       comev = [ComEv::Day] * ([day - var[Day_ID],0].max)
  95.       @comev_id += comev
  96.     end
  97.     theo_timecv_day
  98.   end
  99.  
  100.   alias theo_timecv_week on_week_change
  101.   def on_week_change
  102.     if ComEv::Week > 0 && Week_ID > 0
  103.       comev = [ComEv::Week] * ([week - var[Week_ID],0].max)
  104.       @comev_id += comev
  105.     end
  106.     theo_timecv_week
  107.   end
  108.  
  109. end
Advertisement
Add Comment
Please, Sign In to add comment