XP 스크립트

#=======================================#
# â–¦nbsp; class Game_Title                                                                #
#    written by Deke
#    Rewiten by Near Fantastica
#    Tweaked by Silentdragon
#------------------------------------------------------------------------------#
#=======================================#
class Game_Time

attr_accessor :minute_length
attr_accessor :hours
attr_accessor :minutess
attr_accessor :timess

def initialize
@minute_length=2.0      #length of game minute in real seconds
@hour_length= 60.0      #minute in an hour
@day_length=24.0        #hours in a day
@month_length=30.0    #days in a month
@year_length=12.0      #months in a year
@minutes=0                #starting minute count
@timess=Time.now          #Real-Time Tweak
@hours=timess.strftime("%H").to_i #Real Hours
@minutess=timess.strftime("%M").to_i #Real Min
end

def get_time
@timess=Time.now          #Real-Time Tweak
@hours=timess.strftime("%H").to_i #Real Hours
@minutess=timess.strftime("%M").to_i #Real Min
end
def get_tone
get_time
hour=hours
minutes=minutess + hour*@hour_length
phase_shift=Math::PI*(minutes/(@hour_length*@day_length))
illumination=  -150+ 165*Math.sin(phase_shift)
tone=Tone.new(illumination,illumination,illumination,0)
return tone
end

end # of class Game_Time 

#=======================================#
# â–¦nbsp; class Window_Time                                                            #
# written by Deke                                                                      #
#------------------------------------------------------------------------------#
#=======================================#
class Window_Time < Window_Base

#--------------------------------------------------------------------------
def initialize
 super(0, 0, 160, 96)
 self.contents = Bitmap.new(width - 32, height - 32)
 self.contents.font.name = $defaultfonttype  # "Time" window font
 self.contents.font.size = $defaultfontsize
 refresh
end

#--------------------------------------------------------------------------
def refresh
 $game_time.get_time
 self.contents.clear
 @total_sec = Graphics.frame_count / Graphics.frame_rate
 @minute=$game_time.minutess
 hour = $game_time.hours
 pm_flag= hour >=12 ? true : false
 hour= hour >= 12 ? hour-12 : hour
 if hour.floor==0
  text=sprintf("%02d:%02d",12,@minute)
 else
  text=sprintf("%02d:%02d",hour,@minute)
 end
 if pm_flag
  text += " PM"
 else
  text += " AM"
 end
 self.contents.font.color = normal_color
 self.contents.draw_text(4, 0, 120, 32, text, 2)
end

#--------------------------------------------------------------------------
def update
 $game_time.get_time
 if $game_time.minutess != @minute
  refresh
 end
end
end # of class

#=======================================
class Game_Temp
#--------------------------------------------------------------------------
# &acirc;—? Refer setup to Game Temp
#--------------------------------------------------------------------------
alias dns_game_temp_initalize initialize
#--------------------------------------------------------------------------
# &acirc;—? Refer the Attr
#--------------------------------------------------------------------------
attr_reader    :map_infos  #Added Lines
attr_reader    :outside_array  #Added Lines
#--------------------------------------------------------------------------
# &acirc;—? Refer setup to Scene Map
#--------------------------------------------------------------------------
def initialize
  dns_game_temp_initalize
  @outside_array = Array.new
  @map_infos = load_data("Data/MapInfos.rxdata")
  for key in @map_infos.keys
      @outside_array[key] = @map_infos[key].name.include?("*")
  end
end
end

#=======================================
class Scene_Map
#--------------------------------------------------------------------------
# &acirc;—? Refer setup to Scene Map
#--------------------------------------------------------------------------
alias dns_scene_map_main main
alias dns_scene_map_update update
#--------------------------------------------------------------------------
# &acirc;—? Main
#--------------------------------------------------------------------------
def main
  if $game_temp.outside_array[$game_map.map_id]
    tone=$game_time.get_tone
  $game_time.get_time
    @minute=$game_time.minutess
    $game_screen.start_tone_change(tone, 0)
  end
      # &atilde;‚¹&atilde;&#402;—&atilde;&#402;&copy;&atilde;‚¤&atilde;&#402;&#710;&atilde;‚&raquo;&atilde;&#402;&#402;&atilde;&#402;&#710;&atilde;‚’&auml;½œæ&#710;?
  @spriteset = Spriteset_Map.new
  # &atilde;&#402;¡&atilde;&#402;&#402;&atilde;‚&raquo;&atilde;&#402;¼&atilde;‚¸&atilde;‚&brvbar;&atilde;‚&pound;&atilde;&#402;³&atilde;&#402;‰&atilde;‚&brvbar;&atilde;‚’&auml;½œ
æ&#710;?
  @message_window = Window_Message.new
  # &atilde;&#402;&#710;&atilde;&#402;&copy;&atilde;&#402;³&atilde;‚¸&atilde;‚·&atilde;&#402;§&atilde;&#402;³&aring;®&#376;&egrave;¡Œ
  Graphics.transition
  # &atilde;&#402;¡&atilde;‚¤&atilde;&#402;³&atilde;&#402;&laquo;&atilde;&#402;¼&atilde;&#402;—
  loop do
    $light_effects.refresh
    # &atilde;‚²&atilde;&#402;¼&atilde;&#402; &ccedil;”&raquo;&eacute;?&cent;&atilde;‚’æ›´æ–°
    Graphics.update
    # &aring;…&yen;&aring;&#352;›æ&#402;…&aring; ±&atilde;‚’æ›´æ–°
    Input.update
    # &atilde;&#402;•&atilde;&#402;&not;&atilde;&#402;¼&atilde;&#402; æ›´æ–°
    update
    # &ccedil;”&raquo;&eacute;?&cent;&atilde;?Œ&aring;&#710;‡&atilde;‚&#352;替&atilde;‚?&atilde;?&pound;&atilde;?&#376;&atilde;‚‰&atilde;&#402;&laquo;&atilde;&#402;¼&atilde;&#402;—&atilde;‚’&auml;¸­æ–­
    if $scene != self
      break
    end
  end
  # &atilde;&#402;&#710;&atilde;&#402;&copy;&atilde;&#402;³&atilde;‚¸&atilde;‚·&atilde;&#402;§&atilde;&#402;³æº–&aring;‚™
  Graphics.freeze
  # &atilde;‚¹&atilde;&#402;—&atilde;&#402;&copy;&atilde;‚¤&atilde;&#402;&#710;&atilde;‚&raquo;&atilde;&#402;&#402;&atilde;&#402;&#710;&atilde;‚’&egrave;§&pound;放
  @spriteset.dispose
  # &atilde;&#402;¡&atilde;&#402;&#402;&atilde;‚&raquo;&atilde;&#402;¼&atilde;‚¸&atilde;‚&brvbar;&atilde;‚&pound;&atilde;&#402;³&atilde;&#402;‰&atilde;‚&brvbar;&atilde;‚’&egrave;§&pound;
放
  @message_window.dispose
  # &atilde;‚¿&atilde;‚¤&atilde;&#402;&#710;&atilde;&#402;&laquo;&ccedil;”&raquo;&eacute;?&cent;&atilde;?&laquo;&aring;&#710;‡&atilde;‚&#352;替&atilde;?&#710;&auml;¸­&atilde;?®&aring; ´&aring;?&#710;
  if $scene.is_a?(Scene_Title)
    # &ccedil;”&raquo;&eacute;?&cent;&atilde;‚’&atilde;&#402;•&atilde;‚§&atilde;&#402;¼&atilde;&#402;‰&atilde;‚&cent;&atilde;‚&brvbar;&atilde;&#402;&#710;
    Graphics.transition
    Graphics.freeze
  end
  $light_effects.hide
end
#--------------------------------------------------------------------------
# &acirc;—? Update
#--------------------------------------------------------------------------
def update
  $game_time.get_time
  $light_effects.update
  conditional1 =$game_temp.outside_array[$game_map.map_id] and $game_time.minutess != @minute
  conditional2 =$game_temp.outside_array[$game_map.map_id] and @current_id != $game_map.map_id
  if  conditional1 or conditional2   
        tone=$game_time.get_tone
        $game_screen.start_tone_change(tone, 0)
        @minute = $game_time.minutess
        $game_map.need_refresh=true
        @current_id=$game_map.map_id
  end
  if $game_temp.outside_array[$game_map.map_id] == false and @current_id != $game_map.map_id
      $game_screen.start_tone_change(Tone.new(0,0,0,0),0)
      @current_id=$game_map.map_id
  end
  dns_scene_map_update
end
end

#======================================================
class Scene_Title
#--------------------------------------------------------------------------
# &acirc;—? Refer setup to Scene Map
#--------------------------------------------------------------------------
alias dns_scene_title_update update
#--------------------------------------------------------------------------
# &acirc;—? Refer setup to Scene Map
#--------------------------------------------------------------------------
def update
 $game_time=Game_Time.new
  #Dubealex Addition (from XRXS) to show Map Name on screen
 dns_scene_title_update
end
end

class Game_Map
#--------------------------------------------------------------------------
# &acirc;—? Refer the attr
#--------------------------------------------------------------------------
attr_reader  :outside
attr_reader  :map_id
#--------------------------------------------------------------------------
# &acirc;—? Outside
#--------------------------------------------------------------------------
def outside
  return $game_temp.outside_array[@map_id]
end
end

#==============================================================================
# &acirc;–&brvbar;nbsp; Light Effect System
#------------------------------------------------------------------------------
# &atilde;€€By: Near Fantastica
#  Date: 13/2/05
#
#  Addes light Effects to the DNS so objects glow and have ground effect lighting...
#==============================================================================

class Light_Effect_System
#--------------------------------------------------------------------------
# &acirc;—? Refer the attr
#--------------------------------------------------------------------------
attr_accessor    :picture_le
attr_accessor    :event_list
attr_accessor    :type_list
#--------------------------------------------------------------------------
# &acirc;—? Initialization
#--------------------------------------------------------------------------
def initialize
  @event_counter = 0
  @picture_le = Array.new
  @event_list = Array.new
  @type_list = Array.new
end
#--------------------------------------------------------------------------
# &acirc;—? Setup Light Effects on Map Change
#--------------------------------------------------------------------------
def setup
  # Setup Event Max
  @event_counter = 0
  for i in 1..999
    if $game_map.map.events[i].id > @event_counter
      @event_counter = $game_map.map.events[i].id
    end
  end
  #
  for i in 1..@event_counter
    if  $game_map.map.events[i] == nil
      next
    end
    case $game_map.map.events[i].name
    when "Ground"
      ground(i)
    when "Fire"
      fire(i)
    when "Lamp Post"
      lamp(i)
    when "Left Lantern"
      left_lantern(i)
    when "Right Lantern"
      right_lantern(i)
    end
  end
end
#--------------------------------------------------------------------------
# &acirc;—? Updates the Array based on time of day
#--------------------------------------------------------------------------
def update
  $game_time.get_time
  if $game_time.hours > 7 and $game_time.hours < 14
    hide
  else
    show
  end
end
#--------------------------------------------------------------------------
# &acirc;—? Updates the XY of the sprites
#--------------------------------------------------------------------------
def refresh
  for i in 0..$light_effects.picture_le.size - 1
    case $light_effects.type_list[i]
    when "Ground"
      $light_effects.picture_le[i].x = ($game_map.events[$light_effects.event_list[i]].real_x - 200 - $game_map.display_x) / 4
      $light_effects.picture_le[i].y = ($game_map.events[$light_effects.event_list[i]].real_y - 200 - $game_map.display_y) / 4
      $light_effects.picture_le[i].visible = true
    when "Fire"
      $light_effects.picture_le[i].x = ($game_map.events[$light_effects.event_list[i]].real_x - 300 - $game_map.display_x) / 4
      $light_effects.picture_le[i].y = ($game_map.events[$light_effects.event_list[i]].real_y - 300 - $game_map.display_y) / 4
      $light_effects.picture_le[i].visible = true
    when "Left Lamp Post"
      $light_effects.picture_le[i].x = (-0.25 * $game_map.display_x) + ($game_map.events[$light_effects.event_list[i]].x * 32) - 5
      $light_effects.picture_le[i].y = (-0.25 * $game_map.display_y) + ($game_map.events[$light_effects.event_list[i]].y * 32) - 15
    when "Right Lamp Post"
      $light_effects.picture_le[i].x = (-0.25 * $game_map.display_x) + ($game_map.events[$light_effects.event_list[i]].x * 32) - 25
      $light_effects.picture_le[i].y = (-0.25 * $game_map.display_y) + ($game_map.events[$light_effects.event_list[i]].y * 32) - 15
      $light_effects.picture_le[i].visible = true
    when "Left Lantern"
      $light_effects.picture_le[i].x = (-0.25 * $game_map.display_x) + ($game_map.events[$light_effects.event_list[i]].x * 32) - 20
        $light_effects.picture_le[i].y = (-0.25 * $game_map.display_y) + ($game_map.events[$light_effects.event_list[i]].y * 32) - 5
        $light_effects.picture_le[i].visible = true
    when "Right Lantern"
      $light_effects.picture_le[i].x = (-0.25 * $game_map.display_x) + ($game_map.events[$light_effects.event_list[i]].x * 32) - 10
      $light_effects.picture_le[i].y = (-0.25 * $game_map.display_y) + ($game_map.events[$light_effects.event_list[i]].y * 32) - 5
      $light_effects.picture_le[i].visible = true
    end
  end
end
#--------------------------------------------------------------------------
# &acirc;—? Redraws the Array
#--------------------------------------------------------------------------
def redraw
  if @picture_le != []
    for i in 0..@picture_le.size - 1
      @picture_le[i].bitmap.dispose
    end
    @picture_le = Array.new
    @event_list = Array.new
    @type_list = Array.new
  end
end
#--------------------------------------------------------------------------
# &acirc;—? Shows Array
#--------------------------------------------------------------------------
def show
  if @picture_le != []
    for i in 0..@picture_le.size - 1
      @picture_le[i].visible = true
    end
  end
end
#--------------------------------------------------------------------------
# &acirc;—? Hides Array
#--------------------------------------------------------------------------
def hide
  if @picture_le != []
    for i in 0..@picture_le.size - 1
      @picture_le[i].visible = false
    end
  end
end
#--------------------------------------------------------------------------
# &acirc;—? Setup Light Effects for Ground
#--------------------------------------------------------------------------
def ground(event_index)
  light_effects = Sprite.new
  light_effects.bitmap = RPG::Cache.picture("LE.PNG")
  light_effects.zoom_x = 200 / 100.0
  light_effects.zoom_y = 200 / 100.0
  light_effects.z = 1000
  light_effects.opacity = 50
  light_effects.visible = false
  @picture_le.push(light_effects)
  @event_list.push(event_index)
  @type_list.push("Ground")
end
#--------------------------------------------------------------------------
# &acirc;—? Setup Light Effects for Fire
#--------------------------------------------------------------------------
def fire(event_index)
  light_effects = Sprite.new
  light_effects.bitmap = RPG::Cache.picture("LE.PNG")
  light_effects.zoom_x = 300 / 100.0
  light_effects.zoom_y = 300 / 100.0
  light_effects.z = 1000
  light_effects.opacity = 100
  light_effects.visible = false
  @picture_le.push(light_effects)
  @event_list.push(event_index)
  @type_list.push("Fire")
end
#--------------------------------------------------------------------------
# &acirc;—? Setup Light Effects for Lamp
#--------------------------------------------------------------------------
def lamp(event_index)
  light_effects = Sprite.new
  light_effects.bitmap = RPG::Cache.picture("LE.PNG")
  light_effects.z = 1000
  light_effects.opacity = 100
  light_effects.visible = false
  @picture_le.push(light_effects)
  @event_list.push(event_index)
  @type_list.push("Left Lamp Post")
  light_effects = Sprite.new
  light_effects.bitmap = RPG::Cache.picture("LE.PNG")
  light_effects.z = 1000
  light_effects.opacity = 100
  light_effects.visible = false
  @picture_le.push(light_effects)
  @event_list.push(event_index)
  @type_list.push("Right Lamp Post")
end
#--------------------------------------------------------------------------
# &acirc;—? Setup Light Effects for Lantern
#--------------------------------------------------------------------------
def left_lantern(event_index)
  light_effects = Sprite.new
  light_effects.bitmap = RPG::Cache.picture("LE.PNG")
  light_effects.z = 1000
  light_effects.opacity = 150
  light_effects.visible = false
  @picture_le.push(light_effects)
  @event_list.push(event_index)
  @type_list.push("Left Lantern")
end
  #--------------------------------------------------------------------------
# &acirc;—? Setup Light Effects for Lantern
#--------------------------------------------------------------------------
def right_lantern(event_index)
  light_effects = Sprite.new
  light_effects.bitmap = RPG::Cache.picture("LE.PNG")
  light_effects.z = 1000
  light_effects.opacity = 150
  light_effects.visible = false
  @picture_le.push(light_effects)
  @event_list.push(event_index)
  @type_list.push("Right Lantern")
end
end

#==============================================================================
# &acirc;–&brvbar;nbsp; Game_Map
#------------------------------------------------------------------------------
# &atilde;€€Add defenision of the names to Game Map Class
#==============================================================================

class Game_Map
#--------------------------------------------------------------------------
# &acirc;—? Refer the attr
#--------------------------------------------------------------------------
attr_accessor :map
#--------------------------------------------------------------------------
# &acirc;—? Refer setup to Game Map
#--------------------------------------------------------------------------
alias les_game_map_setup setup
#--------------------------------------------------------------------------
# &acirc;—? Refers the Map Setup
#--------------------------------------------------------------------------
def setup(map_id)
  $light_effects.redraw
  les_game_map_setup(map_id)
  $light_effects.setup
end
end

#==============================================================================
# &acirc;–&brvbar;nbsp; Scene_Title
#------------------------------------------------------------------------------
# &atilde;€€It is the class which processes the title picture
#==============================================================================

class Scene_Title
#--------------------------------------------------------------------------
# &acirc;—? Refer setup to Scene Title
#--------------------------------------------------------------------------
alias les_scene_title_update update
#--------------------------------------------------------------------------
# &acirc;—? Sets up the ABS
#--------------------------------------------------------------------------
def update
 $light_effects = Light_Effect_System.new
 les_scene_title_update
end
end

Who's 백호

?

이상혁입니다.

http://elab.kr

Comment '3'
  • ?
    내로미 2010.05.09 01:07

    뭔 스크립트인진 설명을 해야죠!

  • ?
    Som Worker 2010.05.09 01:13

    내용상 시간하고 날짜를 관리하는 스크립트인것같은데..


    자세한건 모르겠네요

  • ?
    Som Worker 2010.05.09 01:13

    아 , 낮과 밤인것같습니다


    왠만하면 설명도 넣어주심이..


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
94 기타 ABS 몬스터 HP 게이지 바 11 백호 2009.02.22 2485
93 기타 다중 파노라마 사용 by Guillaume777 file 백호 2009.02.22 886
92 기타 Weather Script 1.02 by ccoa 1 file 백호 2009.02.22 809
91 기타 일시정지 스크립트 2 file 백호 2009.02.22 1796
90 기타 KGC 디버거 (최신 올라온 것에 비해 성능은 딸리지만) file 백호 2009.02.22 929
89 기타 아래 스크립트에 대한 Guillaume777님의 개량판입니다. 백호 2009.02.22 880
88 기타 Dynamic Stores by Astro_mech@rmxp.net 1 file 백호 2009.02.22 878
87 기타 KGC - RMXP 스크립트 개발용 프로젝트 1.01 4 file 백호 2009.02.22 1515
86 기타 Random Character Generator by SephirothSpawn (SDK호환) 1 백호 2009.02.22 1040
85 기타 Terrain Encounter Areas by SephirothSpawn 백호 2009.02.22 778
84 기타 Multiple Currencies(여러 개의 통화단위 사용) 2 백호 2009.02.22 1124
83 기타 Text Scroll by Dubealex (Release 3) 2 file 백호 2009.02.22 939
82 기타 Near Fantastica's SDK Test Bed 3 file 백호 2009.02.22 885
81 기타 멋진...제작자 정보를 그림으로 1 백호 2009.02.22 1233
» 기타 Real-Time Day Night 3 백호 2009.02.22 751
79 기타 AMS___Advanced_Message_Script 1 file 백호 2009.02.22 889
78 기타 강제 종료시키기 1 file 백호 2009.02.22 1015
77 기타 에어리어 설정 by RPG Advocate 백호 2009.02.22 709
76 기타 ↓ 날씨 자동설정 스크립트 3 백호 2009.02.22 1530
75 기타 Advanced Weather System (AWS) 3 file 백호 2009.02.22 1272
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 Next
/ 13