Project1

标题: VX限时选项 [打印本页]

作者: 空の翼    时间: 2011-11-2 17:24
标题: VX限时选项
之前看到XP的限时选项(纯事件),要配合图片非常麻烦。而且也不符合我想要的效果。
然后我在VX把事件都弄卡死机了(一堆并行>M<),都还是实现不了选项限时(不用图片)。
求个大大给个脚本,要能时间到了就会选择错误的选择,
可以不用有像樱花大战那样的时间条也行的。要配合使用VX里面那个计时表的半脚本也可以的dsu_plus_rewardpost_czw
作者: 皮卡星    时间: 2011-11-2 21:36
那个,请问选项是用按键判定还是选择项判定
如果是按键判定的话纯事件就可以了,选择项判定的话……
有这个脚本的0 0

作者: 空の翼    时间: 2011-11-2 21:45
皮卡星 发表于 2011-11-2 21:36
那个,请问选项是用按键判定还是选择项判定
如果是按键判定的话纯事件就可以了,选择项判定的话……
有这个 ...

是选项判定,如果安静判定的话我自己也能弄出来。但是选项就算把事件都关掉还是存在呢OTL
作者: 皮卡星    时间: 2011-11-2 22:01
本帖最后由 皮卡星 于 2011-11-2 22:04 编辑
空の翼 发表于 2011-11-2 21:45
是选项判定,如果安静判定的话我自己也能弄出来。但是选项就算把事件都关掉还是存在呢OTL ...
  1. # ------------------------------------------------------------------------------
  2. # ------------------------------------------------------------------------------
  3. # ======================== XIV's Timed Choices v1.6 ============================
  4. # ------------------------------------------------------------------------------
  5. # ------------------------------------------------------------------------------

  6. # Author: XIV
  7. # Version: 1.6
  8. # Date: 26.9.2011.

  9. # Features:
  10. # - set a timer on player's choices with a variable
  11. # - running an additional timer in the background is possible
  12. # - set a random choice when the timer reaches 00:00 or use your own choice from
  13. #   the event command
  14. # - disable the timer in certain choices with a switch

  15. # How to use:
  16. # 1. Paste this script above Main in your project.
  17. # 2. Setup the switch and variable IDs below.
  18. # 3. Use and enjoy!

  19. # NOTE!
  20. # If you plan on using this with a custom message system, it WILL work fine as
  21. # long as you don't mess with the "choice-box positioning"!
  22. # If you want to make this script compatible with any custom message system's
  23. # choice-box positioning, contact me either in the thread where you found this or
  24. # via PM on rpgmakervx.net.

  25. # For Ultimate Timer users:
  26. # This script does NOT function properly with the count-up  timer or the
  27. # variable timer on, although it works perfectly with other features of the
  28. # Ultimate Timer!

  29. module XIV
  30.   module TimedChoice
  31.   # This switch enables(OFF) or disables(ON) the choice timer.
  32.   CHOICE_ON = 4
  33.    
  34.   # This variable determines the wait time before the choices close.  
  35.   CHOICE_TIME = 5
  36.   
  37.   # This switch enables(ON) or disables(OFF) the randomness of the choice when
  38.   # the choice timer reaches 00:00
  39.   RANDOM_CHOICE = 5
  40.   
  41.   # Set this to true if you want the choice timer to be directly above the message
  42.   # box.
  43.   ABOVE_MSG = true
  44.   end
  45. end
  46. #-------------------------------------------------------------------------------
  47. # * END CUSTOMIZATION
  48. #-------------------------------------------------------------------------------
  49. class Game_System
  50.   attr_accessor :choice_on
  51. end # Game_System

  52. class Sprite_Timer < Sprite

  53.   alias xiv_timedchoices_up update unless $@
  54.   def update
  55.     xiv_timedchoices_up
  56.     if $game_system.choice_on and XIV::TimedChoice::ABOVE_MSG
  57.       self.x = 120
  58.       self.y = 240
  59.     else
  60.       self.x = Graphics.width-self.bitmap.width
  61.       self.y = 0
  62.     end
  63.   end # update
  64. end # Sprite_Timer

  65. class Window_Timer < Window_Base
  66.   def initialize
  67.     super(120, 240, 88, 50)
  68.     self.z = 0
  69.   end
  70. end
  71.    
  72. class Window_Message < Window_Selectable
  73.   #-----------------------------------------------------------------------------
  74.   # * start_choice alias
  75.   #-----------------------------------------------------------------------------
  76.   alias new_start_choice_XTC start_choice unless $@
  77.   def start_choice
  78.     new_start_choice_XTC
  79.     if !$game_switches[XIV::TimedChoice::CHOICE_ON]
  80.       $game_system.choice_on = true
  81.       @win = Window_Timer.new if XIV::TimedChoice::ABOVE_MSG
  82.       if $game_system.timer_working
  83.         @timer_worked = true
  84.         @old_time = $game_system.timer
  85.       end
  86.       $game_system.timer = $game_variables[XIV::TimedChoice::CHOICE_TIME] * Graphics.frame_rate   
  87.       $game_system.timer_working = true
  88.     end
  89.   end # start_choice
  90.   
  91.   #-----------------------------------------------------------------------------
  92.   # * input_choice alias
  93.   #-----------------------------------------------------------------------------
  94.   alias new_input_choice_XTC input_choice unless $@
  95.   def input_choice
  96.     new_input_choice_XTC
  97.     if $game_system.timer == 0 and !$game_switches[XIV::TimedChoice::CHOICE_ON]
  98.       rand_choice
  99.       Sound.play_cancel
  100.       terminate_message
  101.       $game_system.choice_on = false
  102.       if XIV::TimedChoice::ABOVE_MSG
  103.         @win.dispose
  104.       end
  105.       return_timer
  106.     end
  107.     if Input.trigger?(Input::C)
  108.       if !$game_switches[XIV::TimedChoice::CHOICE_ON]
  109.         $game_system.timer_working = false
  110.         if XIV::TimedChoice::ABOVE_MSG
  111.           @win.dispose
  112.         end
  113.         return_timer
  114.       end
  115.       $game_system.choice_on = false
  116.     end
  117.   end # input_choice
  118.   
  119.   #-----------------------------------------------------------------------------
  120.   # * new method determines the random choice
  121.   #-----------------------------------------------------------------------------
  122.   def rand_choice
  123.     if $game_switches[XIV::TimedChoice::RANDOM_CHOICE]
  124.       random_choice = rand(6)
  125.       while random_choice == 0 or (random_choice != 5 and random_choice > $game_message.choice_max) or ($game_message.choice_cancel_type < 5 and random_choice == 5) do
  126.         random_choice = rand(6)
  127.       end
  128.     else
  129.       random_choice = $game_message.choice_cancel_type
  130.     end
  131.     $game_message.choice_proc.call(random_choice - 1)
  132.   end # rand_choice
  133.   
  134.   #-----------------------------------------------------------------------------
  135.   # * new_method returns the timer if it ran before choice processing
  136.   #-----------------------------------------------------------------------------
  137.   def return_timer
  138.     if @timer_worked
  139.       @diff = ($game_variables[XIV::TimedChoice::CHOICE_TIME] * Graphics.frame_rate) - $game_system.timer - Graphics.frame_rate
  140.       timing = @old_time - @diff
  141.       $game_system.timer = timing
  142.       if $game_system.timer <= 0
  143.         $game_system.timer = 0
  144.       end
  145.         $game_system.timer_working = true
  146.     end
  147.   end # return_timer  
  148. end # Window_Message
复制代码
来源:http://www.rpgmakervx.net/index.php?showtopic=35335
作者: 空の翼    时间: 2011-11-2 22:13
皮卡星 发表于 2011-11-2 22:01
来源:http://www.rpgmakervx.net/index.php?showtopic=35335

日语还好,英语实在有点苦手呢,试验过没效果呢。能给个范例工程来参考一下吗
作者: 皮卡星    时间: 2011-11-2 22:59
空の翼 发表于 2011-11-2 22:13
日语还好,英语实在有点苦手呢,试验过没效果呢。能给个范例工程来参考一下吗 ...

啊,范例终于完成了……抱歉啊,本人速度比较慢……
限时选择项范例.rar (243.3 KB, 下载次数: 101)
作者: 空の翼    时间: 2011-11-2 23:29
本帖最后由 空の翼 于 2011-11-2 23:38 编辑
皮卡星 发表于 2011-11-2 22:59
啊,范例终于完成了……抱歉啊,本人速度比较慢……


你的范例也真够奇特的,选择了之后就结束游戏了,而且还是用脚本来结束- -b。不过还是非常感谢你,总算弄懂了。
P.S.发现RANDOM_CHOICE其实是有用的,是选项取消时候选择哪一选项有关。




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1