Mohon maaf, blog ini sedang dalam tahap renovasi pembaharuan link.

Rei Real Time KTS MOD v1.2

| | 0 komentar

Ingin bikin game Tamagotchi? Atau game seperti pokemon?
Ini dia script yang kamu butuhkan!
Ini akan membuatmu memiliki Time System VX yang benar-benar REAL TIME dan hanya
satu-satunya di dunia saat ini, YAY!
Jadi kalau kamu main jam 6 pagi, di gamenya juga jam 6 pagi loh!
Fitur
  • Memungkinkan game memiliki time system yang benar-benar REAL TIME
  • Season dan Weather system
  • Auto tinting yang real time

Screenshots

Entah gmana caranya ambil screenshot untuk time system..?? hehehe...

Demo
Untuk demo scriptnya dapat di download disini

Scripts

#==============================================================================
# ¦ Kylock's Time System VX 1.5 MOD V.1.2
#     6.3.2008                 10.8.2009
#------------------------------------------------------------------------------
#  Script by: Kylock
#  MOD by reijubv
#==============================================================================
# MOD changelog :
# > V.1.0 (24/5/2009) = Awal di rilis
# > V.1.1 (30/5/2009) = Sekarang dengan system "Musim" dan cuaca otomatis
# > V.1.2 (10/8/2009) = Sekarang punya "Auto Tint" System baru!
#==============================================================================
# Ingin bikin game Tamagotchi? Atau game seperti pokemon?
# Ini dia script yang kamu butuhkan!
# Ini akan membuatmu memiliki Time System VX yang benar-benar REAL TIME dan hanya
# satu-satunya di dunia saat ini, YAY!
# Jadi kalau kamu main jam 6 pagi, di gamenya juga jam 6 pagi loh!
#------------------------------------------------------------------------------
# NOTES:
# 1. JANGAN GUNAKAN KTS NORMAL DENGAN SCRIPT INI APAPUN ALASANNYA!
# 2. $kts.go,$kts.stop, kts.sec(n),$kts.hours(n),$kts.days(n),$kts.jump_to_hour(n)
#    semua fitur KTS biasa itu dihapus.
# 3. Variabel START_DAY, START_HOUR, AMPM, DAYNAMES dan SPEED juga dihapus.
# 4. 8 variabel baru untuk dipakai :
#    a. WEEKDAY = 0 to 6 (Index hari dalam 1 minggu, dari 0 sampai 6)
#    b. MONTH   = 1 to 12 (Index Bulan, 1 - 12)
#    c. MONTHNAM= Jan, Feb, May, etc..
#    d. MONTHDAY= 1 to 31 (Hari dalam 1 bulan,jumlahnya menyesuaikan bulan skrg)
#    e. YEAR    = 1994, 2009, etc (Tahun)
#    f. SEASON  = Nama musim, set nama musim di baris 306
#    g. WEATHERN= Nama cuaca, set nama cuaca di baris 161
#    h. WEATHER = Id dari cuaca tersebut.
# 5. 4 switch baru! :
#    a. SPRING  = Switch ini nyala saat musim semi.
#    b. SUMMER  = Switch ini nyala saat musim panas.
#    c. FALL    = Switch ini nyala saat musim gugur.
#    d. WINTER  = Switch ini nyala saat musim salju.
#===============================================================================
# Credit reijubv dan Kylock!
#===============================================================================
# ? Auto-tone Instructions
#------------------------------------------------------------------------------
#    Map yang didefinisikan sebagai "Outdoor" adalah map yang akan terkena efek
# "Tint Screen otomatis". Untuk menentukan apakah sebuah map adalah "Outdoor"
# atau tidak, tambahkan [KTS] pada nama map tersebut! Contohnya, nama map Village
# of Frog dirubah jadi "Village of Frog [KTS]" atau "[KTS]Village of Frog" atau
# malah "Village of [KTS] Frog", pokoknya ada [KTS]nya, terserah kamu mau dimana.
#  Jangan khawatir karena [KTS] akan otomatis dihapus oleh scriptnya, sehingga
# script yang membutuhkan nama map mu tidak akan membaca [KTS] itu.
#==============================================================================
# SETTING SCRIPT INI DIBAWAH!
#==============================================================================
$imported = {} if $imported == nil
$imported["Rei_"+"KTS_MOD"] = true
#==============================================================================
# KTS Module.
#==============================================================================
module KTS
  #-----------------------------------------------------------------------
  # Settingan periode waktu (format = [waktu_awal,waktu_akhir]
  #-----------------------------------------------------------------------
  T1 = [ 0,4 ] # Malam (setelah tengah malam)
  T2 = [ 5,8 ] # Pagi
  T3 = [ 9,15] # Siang
  T4 = [16,17] # Sore
  T5 = [18,24] # Malam (Sebelum tengah malam)
  #-----------------------------------------------------------------------
  # Setting variabel dan switch dibawah
  #-----------------------------------------------------------------------
  # Set jadi true kalau kamu mau simpan waktu di variabel (DISARANKAN)
  DATABASE_OUTPUT = true
    # Variabel
    TIME    = 1 # Waktu dalam format string => "JAM:MENIT"
    SECONDS = 2 # Detik, 1 sampai 59
    MINUTES = 3 # Menit, 1 sampai 59
    HOURS   = 4 # Jam, 1 sampai 24
    DAYS    = 5 # Hari, 1 sampai 365 atau 366
    DAYNAME = 6 # Nama hari, di singkat jadi 3 huruf (Mon,Sun,Wed,dsb)
    WEEKDAY = 7 # 0 to 6 (Index hari dalam 1 minggu)
    MONTH   = 8 # 1 to 12 (Index bulan dalam 1 tahun)
    MONTHNAM= 9 # Nama bulan, di singkat jadi 3 huruf (Jan,Feb,Mar,dsb)
    MONTHDAY= 10# Index hari dalam 1 bulan, (1-31,1-30,1-29,1-28,menyesuaikan)
    YEAR    = 11# 1994, 2009, dsb
    SEASON  = 12# Nama musim (Summer, Spring, ETC)
    WEATHERN= 13# Nama cuaca
    WEATHER = 14# Index cuaca
    # Switch
    NIGHT   = 1 # Switch ini menyala saat malam hari
    DAWN    = 2 # Switch ini menyala saat pagi hari
    DAY     = 3 # Switch ini menyala saat siang hari
    SUNSET  = 4 # Switch ini menyala saat sore hari
    SPRING  = 5 # Switch ini menyala saat musim semi
    SUMMER  = 6 # Switch ini menyala saat musim panas
    FALL    = 7 # Switch ini menyala saat musim gugur
    WINTER  = 8 # Switch ini menyala saat musim salju
  #-----------------------------------------------------------------------
  # Settingan untuk Screen Tone !
  #-----------------------------------------------------------------------
  # true = aktifkan screen tone di map outdoor.
  USE_TONE = true
  # Berapa lama perubahan tonenya? dalam frame
  FADE_LENGTH = 240
  # Setting pewarnaan screen sesuai dengan periode waktu
  #              RED, GREEN, BLUE, GREY
  C1 = Tone.new(-187,  -119,  -17,  68)
  C2 = Tone.new(  17,   -51, -102,   0)
  C3 = Tone.new(   0,     0,    0,   0)
  C4 = Tone.new( -68,  -136,  -34,   0)
  C5 = Tone.new(-187,  -119,  -17,  68)
  # Ga tau apa ini. . . sepertinya untuk merubah kembali tone ke tone lain
  A1 = Tone.new( 187,   119,   17, -68)
  A2 = Tone.new( -17,    51,  102,   0)
  A3 = Tone.new(   0,     0,    0,   0)
  A4 = Tone.new(  68,   136,   34,   0)
  A5 = Tone.new( 187,   119,   17, -68)
  #-----------------------------------------------------------------------
  # MOD SETTINGS
  #-----------------------------------------------------------------------
  # Gunakan system Auto tone yg baru? Jadi kamu ga usah setting apa2 di Tone
  # setting diatas kecuali USE_TONE!
  AUTO_TONE = true
  #-----------------------------------------------------------------------
  # Settings untuk musim (format => [bulan_awal,bulan_akhir]
  #-----------------------------------------------------------------------
  S1 = [ 1,3 ] # Semi
  S2 = [ 4,6 ] # Panas
  S3 = [ 7,9 ] # Gugur
  S4 = [10,12] # Salju
  # Pakai sistem cuaca otomatis?
  WEATHER_SYSTEM = true
  # Set perubahan cuaca (dalam frame)
  WEATHER_LENGTH = 240
  # Waktu sebelum perubahan cuaca lagi (Dalam jam)
  WEATHER_COOLDOWN = 3
  # Nama cuaca, (Id dan nama harus sesuai dengan weather system di game-mu,
  # default-default VX ya 3 ini...tambahkan kalau perlu
  # Ingat, Id cuaca mulai dari 1, 0 adalah "Tanpa efek cuaca"
  #                   0       1        2         3
  WEATHER_NAME = ["Cerah", "Hujan" , "Badai" , "Bersalju"]
  #-----------------------------------------------------------------------
  # Settingan untuk cuaca yang memungkinkan
  # Untuk menambahkan cuaca, gunakan format ini :
  # W[#] = [ WeatherId, .....]
  # W[#] berarti, musim dengan Id # (0 = Semi, 1 = Panas, 2 = Gugur, 3 = Salju)
  # Cuaca hanya muncul ketika player berada di map yang "Outdoor",
  # Cuaca-cuaca ini akan muncul secara random!
  #-----------------------------------------------------------------------
  W = {}
  W[1] = [0, 1, 2 ] # [ WeatherId, .....]
  W[2] = [0, 1, 2 ] # [ WeatherId, .....]
  W[3] = [0, 1, 2 ] # [ WeatherId, .....]
  W[4] = [0, 1, 3 ] # [ WeatherId, .....]
  # Apakah kamu mau pakai BGS yang khusus di setiap cuaca?
  WEATHERSOUND_OK = true
  # kalau true, setup BGS di baris 390-an
  # Ingat, BGS HANYA BERUBAH KALAU KAMU KELUAR/MASUK SEBUAH MAP, TAPI CUACA AKAN
  # TETAP BERUBAH MESKIPUN KAMU DIAM DI 1 MAP SEUMUR HIDUPMU!
end
#==============================================================================
# Core Time System Engine (MODDED)
#==============================================================================
class Kylock_Time_System
  # sets instance variables
  def initialize
    $kts_map_data = load_data("Data/MapInfos.rvdata")
    @event_offset = (Time.now.strftime("%H").to_i * 3600) + (Time.now.strftime("%w").to_i * 86400)
    $kts_event_tone = false
    $kts_event_weather = false
    $kts_battle_tone = true
    $kts_anti_tone = Tone.new(0,0,0,0)
    @startingweatherdelay = 0
    @curweather = 0
    @played = false
  end
  # Computes current time and updates variables if used
  def update
    if !@kts_stop
      # for scripters
      @total_seconds = Graphics.frame_count + @event_offset
      @total_minutes = @total_seconds / 60
      @total_hours = @total_minutes / 60
      @total_days = @total_hours / 24
      @total_weeks = @total_days / 7
      @total_months = @total_weeks / 4
      @total_years = @total_months/12
      #
      @seconds = Time.now.sec
      @minutes = Time.now.min
      @hours   = Time.now.hour
      @days    = Time.now.strftime("%j").to_i
      @weekday = Time.now.strftime("%w").to_i
      @month = Time.now.strftime("%m").to_i
      @monthname = Time.now.strftime("%b")
      @monthday = Time.now.strftime("%d")
      @year = Time.now.strftime("%Y").to_i
      update_tint
      update_weather
      if KTS::DATABASE_OUTPUT
        $game_variables[KTS::TIME]    = getTime
      end
    end
  end
  #
  def update_variables
    $game_variables[KTS::SECONDS] = @seconds
    $game_variables[KTS::MINUTES] = @minutes
    $game_variables[KTS::HOURS]   = @hours
    $game_variables[KTS::DAYS]    = @days
    $game_variables[KTS::DAYNAME] = getDayName
    $game_variables[KTS::WEEKDAY] = @weekday
    $game_variables[KTS::MONTH] = @month
    $game_variables[KTS::MONTHNAM] = @monthname
    $game_variables[KTS::YEAR] = @year
    if KTS::WEATHER_SYSTEM == true
      $game_variables[KTS::WEATHERN] = getWeatherName
      $game_variables[KTS::WEATHER] = @weather
    end
    $game_variables[KTS::SEASON] = getSeasonName
    $game_variables[KTS::MONTHDAY] = @monthday
  end
  #
  def update_switches
    if @period == 1 || @period == 5
      $game_switches[KTS::NIGHT] = true
    else
      $game_switches[KTS::NIGHT] = false
    end
    if @period == 2
      $game_switches[KTS::DAWN] = true
    else
      $game_switches[KTS::DAWN] = false
    end
    if @period == 3
      $game_switches[KTS::DAY] = true
    else
      $game_switches[KTS::DAY] = false
    end
    if @period == 4
      $game_switches[KTS::SUNSET] = true
    else
      $game_switches[KTS::SUNSET] = false
    end
  end
  #
  def update_season_swithces
    if @month >= KTS::S1[0] and @month <= KTS::S1[1]
      @speriod = 1
      $game_switches[KTS::SPRING] = true
    else
      $game_switches[KTS::SPRING] = false
    end
    if @month >= KTS::S2[0] and @month <= KTS::S2[1]
      @speriod = 2
      $game_switches[KTS::SUMMER] = true
    else
      $game_switches[KTS::SUMMER] = false
    end
    if @month >= KTS::S3[0] and @month <= KTS::S3[1]
      @speriod = 3
      $game_switches[KTS::FALL] = true
    else
      $game_switches[KTS::FALL] = false
    end
    if @month >= KTS::S4[0] and @month <= KTS::S4[1]
      @speriod = 4
      $game_switches[KTS::WINTER] = true
    else
      $game_switches[KTS::WINTER] = false
    end
  end
  #-----------------------------------------------------------------------
  # Script Support/Misc Functions (MODDED)
  #-----------------------------------------------------------------------
  def getTime
    time = Time.now.strftime("%H:%M %p")
    return time
  end
  def getSeasonName
    sname = "Spring" if @speriod == 1
    sname = "Summer" if @speriod == 2
    sname = "Fall" if @speriod == 3
    sname = "Winter" if @speriod == 4
    return sname
  end
  def getMonthName
    monthname = Time.now.strftime('%b')
    return monthname
  end
  def getDayName
    weekday = Time.now.strftime('%a')
    return weekday
  end
  def getWeatherName
    weathername = KTS::WEATHER_NAME[@weather]
    return weathername
  end
  # Get tint method from BlizzATES (XP)
  def get_tint
    red = 0
    green = 0
    blue = 0
    grey = 0
    if @period == 2 or @period == 3 or @period == 4
      red = green = 0
      day = KTS::T2[0]
      night = KTS::T5[0]
      ratio = ((@hours-day)*60+@minutes) * 255 / (60*(night-day))
      if ratio >= 160
        red = green = blue = 192-ratio
      elsif ratio >= 96
        red = green = blue = 32
      elsif ratio >= 64
        red = green = blue = ratio-64
      end
    else
      red = green = -96
      day = KTS::T2[0]
      night = KTS::T5[0]
      hour = (@hours >= night ? @hours : @hours+24)
      ratio = ((hour-night)*60+@minutes) * 255 / (60*(day+24-night))
      if ratio >= 160
        red = ratio-288
        green = ratio-288
        blue = ratio-192
      elsif ratio >= 96
        red = -128
        green = -128
        blue = -32
      elsif ratio >= 64
        red = -32-ratio
        green = -32-ratio
        blue = 64-ratio
      end
    end
    return Tone.new(red, green, blue, grey)
  end

  #-----------------------------------------------------------------------
  # Screen Tone Functions
  #-----------------------------------------------------------------------
  def update_tint(duration = KTS::FADE_LENGTH)
    return if $BTEST
    if KTS::USE_TONE && !$kts_event_tone && $kts_map_data[$game_map.map_id].outside_tint?
      if @hours >= KTS::T1[0] and @hours <= KTS::T1[1]
        @period = 1
        screen.start_tone_change(KTS::C1,duration) if !KTS::AUTO_TONE
        $kts_anti_tone = KTS::A1
      elsif @hours >= KTS::T2[0] and @hours <= KTS::T2[1]
        @period = 2
        screen.start_tone_change(KTS::C2,duration) if !KTS::AUTO_TONE
        $kts_anti_tone = KTS::A2
      elsif @hours >= KTS::T3[0] and @hours <= KTS::T3[1]
        @period = 3
        screen.start_tone_change(KTS::C3,duration) if !KTS::AUTO_TONE
        $kts_anti_tone = KTS::A3
      elsif @hours >= KTS::T4[0] and @hours <= KTS::T4[1]
        @period = 4
        screen.start_tone_change(KTS::C4,duration) if !KTS::AUTO_TONE
        $kts_anti_tone = KTS::A4
      elsif @hours >= KTS::T5[0] and @hours <= KTS::T5[1]
        @period = 5
        screen.start_tone_change(KTS::C5,duration) if !KTS::AUTO_TONE
        $kts_anti_tone = KTS::A5
      end
      screen.start_tone_change(get_tint,0) if KTS::AUTO_TONE
    else
      # no tone if indoors
      if !$kts_map_data[$game_map.map_id].outside_tint?
        screen.start_tone_change(Tone.new(0,0,0,0),duration)
      end
    end
  end
  # Set weather
  def setweather(duration)
    if ((@startingweatherdelay - @hours) >= KTS::WEATHER_COOLDOWN) or
       ((@startingweatherdelay - @hours) <= -KTS::WEATHER_COOLDOWN)
      @startingweatherdelay = Time.now.hour
      the_weatherset = KTS::W[@speriod]
      @curweather = the_weatherset[rand(KTS::W[@speriod].length)]
      @weather = @curweather
    else
      @weather = @curweather
    end
    $game_map.screen.weather(@weather, 9 , duration)
  end
   
  #-----------------------------------------------------------------------
  # Season/weather update
  #-----------------------------------------------------------------------
  def update_weather(duration = KTS::WEATHER_LENGTH)
    return if $BTEST
    if KTS::WEATHER_SYSTEM && !$kts_event_weather && $kts_map_data[$game_map.map_id].outside_tint?
      if @month >= KTS::S1[0] and @month <= KTS::S1[1]
        @speriod = 1
      elsif @month >= KTS::S2[0] and @month <= KTS::S2[1]
        @speriod = 2
      elsif @month >= KTS::S3[0] and @month <= KTS::S3[1]
        @speriod = 3
      elsif @month >= KTS::S4[0] and @month <= KTS::S4[1]
        @speriod = 4
      end
      setweather(duration)
    else
      # no weather if indoors
        if !$kts_map_data[$game_map.map_id].outside_tint?
          Audio.bgs_stop #Stop BGS
          $game_map.screen.weather(0, 0, 0)
        end
    end
  end

  def screen
    if $game_temp.in_battle
      return $game_troop.screen
    else
      return $game_map.screen
    end
  end
 
  # Extra Feature ; Change BGS
  def start_bgs
    return if !$kts_map_data[$game_map.map_id].outside_tint?
     if $kts_map_data[$game_map.map_id].outside_tint?
# This is night BGS, disabled in this MOD
#~       if $game_switches[KTS::NIGHT] == true
#~         Audio.bgs_play("Audio/BGS/Forest", 80, 100)
#~       elsif $game_switches[KTS::DAWN] or $game_switches[KTS::SUNSET]
#~         Audio.bgs_play("Audio/BGS/Forest", 30, 100)
#~       else
#~         Audio.bgs_stop
#~       end
      if  KTS::WEATHER_SYSTEM == true
        if KTS::WEATHERSOUND_OK == true
          if @weather == 1
            Audio.bgs_play("Audio/BGS/Rain", 70, 100)
          elsif @weather == 2
            Audio.bgs_play("Audio/BGS/Storm", 70, 100)
         
            # ADD MORE IF YOU WANT to play BGS when weather with Id @weather occurs!
            # Like this :
            # elsif @weather == Id
            #  Audio.bgs_play("Audio/BGS/SomeBGS", 70, 100)
          else
            Audio.bgs_stop
          end
        end
      end
    end
  end
 
end

class Spriteset_Map
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias kts_initialize initialize
  def initialize
    $kts.update_switches if KTS::DATABASE_OUTPUT
    $kts.update_variables if KTS::DATABASE_OUTPUT
    $kts.update_season_swithces if KTS::DATABASE_OUTPUT
    kts_initialize
  end
end

#==============================================================================
# Instantly updates screen tone when a new map is loaded.
#==============================================================================
class Game_Map
  alias kts_setup setup
  def setup(map_id)
    kts_setup(map_id)
    $kts_event_tone = false
    $kts.update
    $kts.update_tint(0)
    $kts.update_weather(0) if KTS::WEATHER_SYSTEM
    $kts.start_bgs
  end
end

#==============================================================================
# Instantly updates screen tone when a battle starts.
#==============================================================================
class Spriteset_Battle
  alias kts_create_battleback create_battleback
  def create_battleback
    $kts.update_tint(0)
    kts_create_battleback
  end
end

#==============================================================================
# Temporarily disables auto-toning if an event tints the screen.
#==============================================================================
class Game_Interpreter
  alias kts_Interpreter_command_223 command_223
  def command_223
    $kts_event_tone = true
    kts_Interpreter_command_223
  end
  alias kts_Interpreter_command_236 command_236
  def command_236
    $kts_event_weather = true
    kts_Interpreter_command_226
  end
end

#==============================================================================
# Integrates the Time System into the Game System.
#==============================================================================
class Game_System
  # inits a KTS object
  alias kts_initialize initialize
  def initialize
    $kts=Kylock_Time_System.new
    kts_initialize
  end
  # Updates kts every game frame
  alias kts_update update
  def update
    $kts.update
    kts_update
  end
end

#==============================================================================
# Scans Map Names for Toning
#==============================================================================
class RPG::MapInfo
  def name # Definition prevents location scripts from reading anything within
    return @name.gsub(/\[.*\]/) {""} # brackets, including the brackets
  end
  def original_name
    return @name
  end
  def outside_tint?
    return @name.scan(/\[KTS\]/).size > 0
    # old regexp: return @name.scan(/[\KTS]/).size > 0
  end
end

#==============================================================================
# Sets up the time window for the menu. (MODDED)
#==============================================================================
class Window_KTS < Window_Base
  def initialize(x, y)
    super(x, y, 160, WLH+32)
    refresh
  end
  def refresh
    self.contents.clear
    self.contents.draw_text(0, -6, 120, 32,$kts.getDayName+" "+$kts.getTime, 2)
  end
  def update
    super
    $kts.update
    self.contents.clear
    self.contents.draw_text(0, -6, 120, 32, $kts.getDayName+" "+$kts.getTime, 2)
  end
end

#==============================================================================
# Adds the time window to the menu.
#==============================================================================
class Scene_Menu < Scene_Base
  alias kts_start start
  def start
    kts_start
    @kts_window = Window_KTS.new(0,304)
  end
  alias kts_terminate terminate
  def terminate
    kts_terminate
    @kts_window.dispose
  end
  alias kts_update update
  def update
    kts_update
    @kts_window.update
  end
end

#==============================================================================
# Saves and Loads game time to/from save game file.
#==============================================================================
class Scene_File
  alias kts_write_save_data write_save_data
  def write_save_data(file)
    kts_write_save_data(file)
    Marshal.dump($kts, file)
  end
  alias kts_read_save_data read_save_data
  def read_save_data(file)
    kts_read_save_data(file)
    $kts = Marshal.load(file)
  end
end

0 komentar:

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))

Posting Komentar

 
© Copyright 2011. All rights reserved | www.techiru.com is proudly powered by Style Logic | My_Creation