设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 3756|回复: 4
打印 上一主题 下一主题

[已经解决] 如何获取游戏进行时间,作事件发生?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
60 小时
注册时间
2013-1-21
帖子
53
跳转到指定楼层
1
 楼主| 发表于 2013-2-19 16:28:55 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 xixifilm 于 2013-2-22 15:36 编辑

已经插入一日夜脚本,如何提取指定时间,作为事件开关?
脚本转自66论坛内

RUBY 代码复制
  1. #Basic Game Time + Night/Day
  2. #----------#
  3. #Features: Provides a series of functions to set and recall current game time
  4. #   as well customizable tints based on current game time to give the
  5. #   appearance of night and day.
  6. #
  7. #Usage:   Script calls:
  8. #       GameTime::minute?   - returns the current minute返回当前分钟
  9. #       GameTime::hour?  - returns the current hour返回当前小时
  10. #       GameTime::set(time) - sets the game time to time, in frames设置游戏时,以每秒帧(max:1440)
  11. #       例子GameTime::set(360)是早上6点
  12. #       GameTime::change(time) - increments the game time! (can be negative)增加游戏时间可以负数
  13. #       GameTime::pause_time(set) - stops time for events and stuff, true or false真或假停止时间
  14. #       GameTime::pause_tint(set) - time runs, but tints do not update时间的运行,但色彩不更新
  15. #       GameTime::clock(set) - sets whether clock is visible or not设置时钟是否可见
  16. #
  17. #Customization: Set below, in comments.
  18. #
  19. #Examples: GameTime::set(360)
  20. #
  21. #----------#
  22. #-- Script by: V.M of D.T
  23. #--- Free to use in any project with credit given
  24.  
  25. #---Game Clock---#
  26. #USE_CLOCK to true to display game time clock
  27. #CLOCK_POSITION for position of clock
  28. #  1 = topleft, 2 = topright, 3 = bottomleft, 4 = bottomright
  29. #CLOCK_TOGGLE is any input button available, see the INPUT help file for options
  30. #------#
  31. USE_CLOCK       = true   #时钟显示,默认true,不显示为false
  32. CLOCK_POSITION  = 4      #时钟位置
  33. CLOCK_TOGGLE = :SHIFT
  34.  
  35. module GameTime
  36.   #---Game Time Details---#
  37.   #Number of frames in a game minute, 60 frames = 1 second 游戏分钟60帧为1秒
  38.   TIME_COUNT   = 6     # 6的倍数时间较为慢
  39.   #Sets whether to tint screen based on game time 色彩是否跟随时间
  40.   USE_TINT = true
  41.  
  42.   #True to pause time while not in map or while during a message
  43.   #真正的暂停时间,而不是在地图或同时在消息
  44.   PAUSE_IN_COMBAT  = false
  45.   PAUSE_NOT_IN_MAP = true
  46.   PAUSE_IN_MESSAGE = true
  47.  
  48.   #Sets time frames of tints by minute count, one day is 1440 minutes
  49.   # 0 = 12am, 360 = 6am, 720 = 12pm, 1080 = 6pm  etc...
  50.   PRESUNRISE_TIME = 240
  51.   SUNRISE_TIME = 360
  52.   NOONSTART_TIME  = 660
  53.   NOONEND_TIME = 900
  54.   PRESUNSET_TIME  = 1080
  55.   SUNSET_TIME  = 1260
  56.   MIDNIGHT_TIME   = 60  #Must be greater than 0
  57.  
  58.   #Sets custome tints
  59.   PRESUNRISE_TONE = Tone.new(-75,-75,0,50)
  60.   SUNRISE_TONE = Tone.new(0,0,0,0)
  61.   NOONSTART_TONE  = Tone.new(45,45,0,-25)
  62.   NOONEND_TONE = Tone.new(0,0,0,0)
  63.   PRESUNSET_TONE  = Tone.new(-50,-50,0,25)
  64.   SUNSET_TONE  = Tone.new(-75,-100,0,75)
  65.   MIDNIGHT_TONE   = Tone.new(-125,-125,0,125)
  66.  
  67.   #Include the ids of any maps not to be tinted based on time
  68.   #包括基于时间的ID不被着色的任何地图
  69.   # Usually reserved for indoor maps
  70.   # 通常是保留给室内地图
  71.   NOTINTMAPS = [2]
  72.   #---END---#
  73.  
  74.   def self.init
  75. $game_time = 0
  76. $game_time_pause_time = false
  77. $game_time_pause_tint = false
  78.   end
  79.   def self.update
  80. if $game_time_pause_time then return else end
  81. case SceneManager::scene_is?(Scene_Map)
  82. when true
  83. if $game_message.visible == true && PAUSE_IN_MESSAGE then else
  84. $game_time += 1 if Graphics.frame_count % TIME_COUNT == 0 end
  85. when false
  86. if SceneManager::scene_is?(Scene_Battle) && PAUSE_IN_COMBAT != true
  87. $game_time += 1 if Graphics.frame_count % TIME_COUNT == 0 end
  88. end
  89. if $game_time == 1440 then $game_time = 0 end
  90. GameTime::tint if $game_time_pause_tint != true
  91.   end
  92.   def self.hour?
  93. return $game_time / 60
  94.   end
  95.   def self.minute?
  96. return $game_time % 60
  97.   end
  98.   def self.time?
  99. meri = "AM"
  100. hour = GameTime::hour?
  101. minute = GameTime::minute?
  102. if hour > 11 then meri = "PM" end
  103. if hour == 0 then hour = 12; meri = "AM" end
  104. if hour > 12 then hour -= 12 end
  105. if hour < 10 then hour = " " + hour.to_s else hour.to_s end
  106. if minute < 10 then minute = "0" + minute.to_s else minute.to_s end
  107. return hour.to_s + ":" + minute.to_s + " " + meri
  108.   end
  109.   def self.set(number)
  110. $game_time = number if number < 1440
  111. GameTime::tint(0)
  112.   end
  113.   def self.change(number)
  114. $game_time += number
  115. $game_time -= 1440 if $game_time > 1440
  116. $game_time += 1440 if $game_time < 0
  117. GameTime::tint(0)
  118.   end
  119.   def self.tint(tint = 60)
  120. if USE_TINT != true then return end
  121. for i in NOTINTMAPS
  122. if $game_map.map_id == i
  123. $game_map.screen.start_tone_change(Tone.new(0,0,0,0),0)
  124. return
  125. end
  126. end
  127. if SceneManager::scene_is?(Scene_Map) then else return end
  128. case $game_time
  129. when PRESUNRISE_TIME .. SUNRISE_TIME
  130. $game_map.screen.start_tone_change(PRESUNRISE_TONE, tint)
  131. when SUNRISE_TIME .. NOONSTART_TIME
  132. $game_map.screen.start_tone_change(SUNRISE_TONE, tint)
  133. when NOONSTART_TIME .. NOONEND_TIME
  134. $game_map.screen.start_tone_change(NOONSTART_TONE, tint)
  135. when NOONEND_TIME .. PRESUNSET_TIME
  136. $game_map.screen.start_tone_change(NOONEND_TONE, tint)
  137. when PRESUNSET_TIME .. SUNSET_TIME
  138. $game_map.screen.start_tone_change(PRESUNSET_TONE, tint)
  139. when SUNSET_TIME .. 1440
  140. $game_map.screen.start_tone_change(SUNSET_TONE, tint)
  141. when 0 .. MIDNIGHT_TIME
  142. $game_map.screen.start_tone_change(SUNSET_TONE, tint)
  143. when MIDNIGHT_TIME .. PRESUNRISE_TIME
  144. $game_map.screen.start_tone_change(MIDNIGHT_TONE, tint)
  145. end
  146.   end
  147.   def self.pause_time(set)
  148. $game_time_pause_time = set
  149.   end
  150.   def self.pause_tint(set)
  151. $game_time_pause_tint = set
  152.   end
  153.   def self.clock(set)
  154. SceneManager.scene.clock_visible?(set)
  155.   end
  156.  
  157.   class Window_Clock < Window_Base
  158. def initialize
  159. case CLOCK_POSITION
  160. when 1
  161. super(0,0,115,56)
  162. when 2
  163. super(429,0,115,56)
  164. when 3
  165. super(0,360,115,56)
  166. when 4
  167. super(429,360,115,56)
  168. end
  169. end
  170. def update
  171. self.contents.clear
  172. self.contents.draw_text(0,0,100,24,GameTime::time?)
  173. end
  174.   end
  175.  
  176. end
  177.  
  178. module DataManager
  179.   class << self
  180.   alias gametime_msc make_save_contents
  181.   alias gametime_esc extract_save_contents
  182.   end
  183.   def self.make_save_contents
  184. contents = gametime_msc
  185. contents[:gametime] = $game_time
  186. contents
  187.   end
  188.   def self.extract_save_contents(contents)
  189. gametime_esc(contents)
  190. $game_time = contents[:gametime]
  191.   end
  192. end
  193.  
  194.  
  195. class Scene_Map < Scene_Base
  196.   alias gametime_post_transfer post_transfer
  197.   alias gametime_create_all_windows create_all_windows
  198.   alias gametime_update_map update
  199.   def post_transfer
  200. GameTime::tint(0)
  201. gametime_post_transfer
  202.   end
  203.   def create_all_windows
  204. gametime_create_all_windows
  205. @gametimeclock = GameTime::Window_Clock.new if USE_CLOCK
  206.   end
  207.   def update
  208. gametime_update_map
  209. @gametimeclock.update if @gametimeclock.nil? == false
  210. if Input.trigger?(CLOCK_TOGGLE) and @gametimeclock.nil? == false
  211. @gametimeclock.visible ? @gametimeclock.visible = false : @gametimeclock.visible = true
  212. end
  213.   end
  214.   def clock_visible?(set)
  215. @gametimeclock.visible = set
  216.   end
  217. end
  218.  
  219. class Scene_Base
  220.   alias gametime_update update
  221.   def update
  222. gametime_update
  223. GameTime::update
  224.   end
  225. end
  226.  
  227. GameTime::init

Lv1.梦旅人

梦石
0
星屑
50
在线时间
60 小时
注册时间
2013-1-21
帖子
53
2
 楼主| 发表于 2013-2-19 16:56:44 | 只看该作者
我是脚本小白, 只知道$game_time赋值于变量,后,再用变量控制发生 , 试了无数次,在地图中建一个空的自动事件执行赋值变量,跟着变量的事件是可以自动跟随时间发生了,但主角动不了(不能控制),是RMVA不能用这样操作吗
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
60 小时
注册时间
2013-1-21
帖子
53
3
 楼主| 发表于 2013-2-19 17:11:23 | 只看该作者
又试了几次,为何$game_time赋值于变量事件时需要 “并行处理”,否则角色不能动(不能操作游戏)? 真不明白
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
687 小时
注册时间
2012-10-29
帖子
1543
4
发表于 2013-2-19 22:08:29 | 只看该作者
设成自动如果在最后没有暂时取消事件,它是会不断重覆自动重新执行的,但这重覆不是与其它事件并行,所以角色动不了,自动的工作没有结束,角色还在等它结束呢,设成并行就不影响了,

您可以这么理解,就像显示图片后的移动图片,不是有个等待到移动结束的勾选项吗?如果勾选了,除非一张图移动完毕,后面的图不会有动作,但不勾选就可以同时几张图一起动作,这就和自动与并行的意思一样。
修改劇本中,仔細審查原來的劇情大綱,覺得有點不太滿意,嘗試編寫不同主角不同主線的劇情,希望能寫得出來。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
60 小时
注册时间
2013-1-21
帖子
53
5
 楼主| 发表于 2013-2-20 09:33:37 | 只看该作者
j433463 发表于 2013-2-19 22:08
设成自动如果在最后没有暂时取消事件,它是会不断重覆自动重新执行的,但这重覆不是与其它事件并行,所以角 ...

感谢感谢
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-6-6 04:13

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表