Project1

标题: 改密码锁脚本的小问题 [打印本页]

作者: Forever火    时间: 2014-8-20 12:45
标题: 改密码锁脚本的小问题
这个限时密码锁脚本目前只支持几个按键,窝自己改了下,加了几个按键,结果好像不行,本人只是初学脚本,窝绝不是伸手党,但是确实没看懂{:2_270:}
希望大大们能告诉我:1添加12以后的按键之后怎么搞;2时间限制怎么修改;
脚本来着恐怖解谜游戏集合脚本,原版如下:
RUBY 代码复制
  1. #===============================================================================
  2. # +++ MOG - Chain Commands (v1.4) +++
  3. #===============================================================================
  4. # By Moghunter                                                               
  5. # [url]http://www.atelier-rgss.com[/url]                     
  6. #===============================================================================
  7. # Sistema de sequência de botões para ativar switchs.
  8. #
  9. # Serão necessárias as seguintes imagens. (Graphics/System)
  10. #
  11. # Chain_Cursor.png
  12. # Chain_Command.png
  13. # Chain_Layout.png
  14. # Chain_Timer_Layout.png
  15. # Chain_Timer_Meter.png
  16. #
  17. #===============================================================================
  18. #
  19. # Para ativar o script use o comando abaixo.  (*Call Script)
  20. #
  21. # chain_commands(ID)
  22. #
  23. # ID - Id da switch.
  24. #
  25. #===============================================================================
  26.  
  27. #==============================================================================
  28. # ● Histórico (Version History)
  29. #==============================================================================
  30. # v 1.4 - Correção do crash aleatório.
  31. # v 1.3 - Melhoria no sistema de dispose
  32. # v 1.2 - Melhoria na codificação e correção de alguns glitches.
  33. # v 1.1 - Animação de fade ao sair da cena de chain.
  34. #       - Opção de definir a prioridade da hud na tela.
  35. #==============================================================================
  36.  
  37. module MOG_CHAIN_COMMANDS
  38. #==============================================================================
  39. # CHAIN_COMMAND = { SWITCH_ID => [COMMAND] }
  40. #
  41. # SWITCH_ID = ID da switch
  42. # COMMANDS = Defina aqui a sequência de botões.
  43. #            (Para fazer a sequência use os comandos abaixo)   
  44. #  
  45. # "Down" ,"Up" ,"Left" ,"Right" ,"Shift" ,"D" ,"S" ,"A" ,"Z" ,"X" ,"Q" ,"W"
  46. #
  47. # Exemplo de utilização
  48. #
  49. # CHAIN_SWITCH_COMMAND = {
  50. # 25=>["Down","D","S","Right"],
  51. # 59=>["Down","Up","Left","Right","Shift","D","S","A","Z","X","Q","W"],
  52. # 80=>["Shift","D"]
  53. # }
  54. #==============================================================================
  55. CHAIN_SWITCH_COMMAND = {
  56. 5=>["X","Right","Left","Z","Z"],
  57. 7=>["X","X","X","X","X"],
  58. 6=>["Left","Right","Left","Right","Left","Right","Q","Z","Up","A","S",
  59.       "Down","D","Z","Right","Up","Up","Z","W","Left","Down","D","A","W"],
  60. 8=>["Up","Down","Left","Right","Z"]}
  61. #Duração para colocar os comandos. (A duração é multiplicado pela quantidade
  62. #de comandos) *60 = 1 sec
  63. #上面的锁代表成功输入这些按键后会开启相应的开关
  64. CHAIN_INPUT_DURATION = 30
  65. #Som ao acertar.
  66. CHAIN_RIGHT_SE = "Chime1"
  67. #Som ao errar.
  68. CHAIN_WRONG_SE = "Buzzer1"
  69. #Switch que ativa o modo automático.
  70. CHAIN_AUTOMATIC_MODE_SWITCH_ID = 20
  71. #Definição da prioridade da hud na tela
  72. CHAIN_HUD_Z = 300
  73. end
  74.  
  75.  
  76. #===============================================================================
  77. # ■ Chain Commands
  78. #===============================================================================
  79. class Chain_Commands
  80.    include MOG_CHAIN_COMMANDS
  81. #--------------------------------------------------------------------------
  82. # ● Initialize
  83. #--------------------------------------------------------------------------      
  84.   def initialize
  85.       @action_id = $game_temp.chain_switch_id
  86.       @chain_command = CHAIN_SWITCH_COMMAND[@action_id]
  87.       @chain_command = ["?"] if @chain_command == nil  
  88.       duration = [[CHAIN_INPUT_DURATION, 1].max, 9999].min
  89.       @timer_max = duration * @chain_command.size
  90.       @timer = @timer_max
  91.       @slide_time = [[60 / duration, 10].max, 60].min
  92.       @change_time = 0
  93.       if $game_switches[CHAIN_AUTOMATIC_MODE_SWITCH_ID]
  94.          @auto = true
  95.       else
  96.          @auto = false
  97.       end
  98.       [url=home.php?mod=space&uid=10462]@Com[/url] = 0  
  99.   end   
  100.  
  101. #--------------------------------------------------------------------------
  102. # ● Main
  103. #--------------------------------------------------------------------------     
  104. def main
  105.      dispose
  106.      @background_sprite = Sprite.new
  107.      @background_sprite.bitmap = SceneManager.background_bitmap2
  108.      create_chain_command
  109.      create_cusrsor
  110.      create_layout
  111.      create_meter
  112.      create_text
  113.      create_number
  114.      Graphics.transition
  115.      loop do
  116.           Graphics.update
  117.            Input.update
  118.            update
  119.            break if SceneManager.scene != self
  120.      end
  121.      dispose
  122. end  
  123.  
  124. #--------------------------------------------------------------------------
  125. # ● Create Cursor
  126. #--------------------------------------------------------------------------            
  127. def create_cusrsor
  128.      @fy_time = 0
  129.      @fy = 0
  130.      @com_index = 0
  131.      @cursor = Sprite.new
  132.      @cursor.bitmap = Cache.system("Chain_Cursor")
  133.      @cursor.z = 4 + CHAIN_HUD_Z
  134.      @cursor_space = ((@bitmap_cw + 5) * @chain_command.size) / 2
  135.      if @chain_command.size <= 20
  136.         @cursor.x = (544 / 2) - @cursor_space + @cursor_space * @com_index
  137.      else   
  138.         @cursor.x = (544 / 2)
  139.      end  
  140.      @cursor.y = (416 / 2) + 30   
  141. end
  142.  
  143. #--------------------------------------------------------------------------
  144. # ● Create Chain Command
  145. #--------------------------------------------------------------------------      
  146. def create_chain_command
  147.      @image = Cache.system("Chain_Command")     
  148.      width_max = ((@image.width / 13) + 5) * @chain_command.size
  149.      @bitmap = Bitmap.new(width_max,@image.height * 2)
  150.      @bitmap_cw = @image.width / 13
  151.      @bitmap_ch = @image.height  
  152.      index = 0
  153.      for i in @chain_command
  154.          command_list_check(i)
  155.          bitmap_src_rect = Rect.new(@com * @bitmap_cw, 0, @bitmap_cw, @bitmap_ch)
  156.          if index == 0
  157.             @bitmap.blt(index * (@bitmap_cw + 5) , 0, @image, bitmap_src_rect)
  158.          else
  159.             @bitmap.blt(index * (@bitmap_cw + 5) , @bitmap_ch, @image, bitmap_src_rect)
  160.          end
  161.          index += 1
  162.      end
  163.      @sprite = Sprite.new
  164.      @sprite.bitmap = @bitmap
  165.      if @chain_command.size <= 15
  166.         @sprite.x = (544 / 2) - ((@bitmap_cw + 5) * @chain_command.size) / 2
  167.         @new_x = 0
  168.      else   
  169.         @sprite.x = (544 / 2)
  170.         @new_x = @sprite.x
  171.      end   
  172.      @sprite.y = (416 / 2) + 30  - @bitmap_ch  - 15
  173.      @sprite.z = 3 + CHAIN_HUD_Z
  174.      @sprite.zoom_x = 1.5
  175.      @sprite.zoom_y = 1.5
  176. end
  177.  
  178. #--------------------------------------------------------------------------
  179. # * create_layout
  180. #--------------------------------------------------------------------------  
  181. def create_layout
  182.      @back = Plane.new
  183.      @back.bitmap = Cache.system("Chain_Layout")
  184.      @back.z = 0
  185.      @layout = Sprite.new
  186.      @layout.bitmap = Cache.system("Chain_Timer_Layout")
  187.      @layout.z = 1 + CHAIN_HUD_Z
  188.      @layout.x = 160
  189.      @layout.y = 150
  190.   end
  191.  
  192. #--------------------------------------------------------------------------
  193. # * create_meter
  194. #--------------------------------------------------------------------------  
  195. def create_meter
  196.      @meter_flow = 0
  197.      @meter_image = Cache.system("Chain_Timer_Meter")
  198.      @meter_bitmap = Bitmap.new(@meter_image.width,@meter_image.height)
  199.      @meter_range = @meter_image.width / 3
  200.      @meter_width = @meter_range * @timer / @timer_max
  201.      @meter_height = @meter_image.height
  202.      @meter_src_rect = Rect.new(@meter_range, 0, @meter_width, @meter_height)
  203.      @meter_bitmap.blt(0,0, @meter_image, @meter_src_rect)
  204.      @meter_sprite = Sprite.new
  205.      @meter_sprite.bitmap = @meter_bitmap
  206.      @meter_sprite.z = 2 + CHAIN_HUD_Z
  207.      @meter_sprite.x = 220
  208.      @meter_sprite.y = 159
  209.      update_flow
  210. end  
  211.  
  212. #--------------------------------------------------------------------------
  213. # ● Create Text
  214. #--------------------------------------------------------------------------        
  215. def create_text
  216.      @text = Sprite.new
  217.      @text.bitmap = Bitmap.new(200,32)
  218.      @text.z = 2 + CHAIN_HUD_Z
  219.      @text.bitmap.font.name = "Georgia"
  220.      @text.bitmap.font.size = 25
  221.      @text.bitmap.font.bold = true
  222.      @text.bitmap.font.italic = true
  223.      @text.bitmap.font.color.set(255, 255, 255,220)
  224.      @text.x = 230
  225.      @text.y = 100
  226. end
  227.  
  228. #--------------------------------------------------------------------------
  229. # ● Create Number
  230. #--------------------------------------------------------------------------        
  231. def create_number
  232.      @combo = 0
  233.      @number = Sprite.new
  234.      @number.bitmap = Bitmap.new(200,64)
  235.      @number.z = 2 + CHAIN_HUD_Z
  236.      @number.bitmap.font.name = "Arial"
  237.      @number.bitmap.font.size = 24
  238.      @number.bitmap.font.bold = true
  239.      @number.bitmap.font.color.set(0, 255, 255,200)
  240.      @number.bitmap.draw_text(0, 0, 200, 32, "Ready",1)         
  241.      @number.x = 30
  242.      @number.y = 100
  243. end
  244.  
  245. #--------------------------------------------------------------------------
  246. # ● Pre Dispose
  247. #--------------------------------------------------------------------------      
  248. def exit
  249.      loop do
  250.          Graphics.update
  251.          @sprite.x += 5
  252.          @layout.x -= 5
  253.          @meter_sprite.x -= 5
  254.          @text.x -= 2
  255.          @text.opacity -= 5
  256.          @sprite.opacity -= 5
  257.          @layout.opacity -= 5
  258.          @meter_sprite.opacity -= 5
  259.          @number.opacity -= 5
  260.          @back.opacity -= 5
  261.          @cursor.visible = false   
  262.          break if @sprite.opacity == 0
  263.      end
  264.      SceneManager.call(Scene_Map)
  265. end
  266.  
  267. #--------------------------------------------------------------------------
  268. # ● Dispose
  269. #--------------------------------------------------------------------------      
  270. def dispose
  271.      return if @layout == nil
  272.      Graphics.freeze
  273.      @background_sprite.bitmap.dispose
  274.      @background_sprite.dispose
  275.      @bitmap.dispose
  276.      @sprite.bitmap.dispose
  277.      @sprite.dispose
  278.      @cursor.bitmap.dispose
  279.      @cursor.dispose  
  280.      @meter_image.dispose
  281.      @meter_bitmap.dispose
  282.      @meter_sprite.bitmap.dispose
  283.      @meter_sprite.dispose
  284.      @layout.bitmap.dispose  
  285.      @layout.dispose
  286.      @layout = nil
  287.      @back.bitmap.dispose
  288.      @back.dispose
  289.      @text.bitmap.dispose
  290.      @text.dispose
  291.      @number.bitmap.dispose
  292.      @number.dispose
  293.      @image.dispose
  294. end
  295.  
  296. #--------------------------------------------------------------------------
  297. # ● Update
  298. #--------------------------------------------------------------------------      
  299. def update
  300.      update_command
  301.      update_cursor_slide
  302.      update_flow
  303.      update_change_time
  304. end
  305.  
  306. #--------------------------------------------------------------------------
  307. # ● Change_Time
  308. #--------------------------------------------------------------------------        
  309. def update_change_time
  310.      return unless @auto
  311.      @change_time += 1
  312.      check_command(-1) if @change_time >= CHAIN_INPUT_DURATION - 1
  313. end
  314.  
  315. #--------------------------------------------------------------------------
  316. # ● Update Flow
  317. #--------------------------------------------------------------------------      
  318. def update_flow
  319.      @timer -= 1
  320.      @meter_sprite.bitmap.clear
  321.      @meter_width = @meter_range * @timer / @timer_max
  322.      @meter_src_rect = Rect.new(@meter_flow, 0, @meter_width, @meter_height)
  323.      @meter_bitmap.blt(0,0, @meter_image, @meter_src_rect)  
  324.      @meter_flow += 20
  325.      @meter_flow = 0 if @meter_flow >= @meter_image.width - @meter_range      
  326.      wrong_command if @timer == 0 and @auto == false
  327.   end  
  328.  
  329. #--------------------------------------------------------------------------
  330. # ● Update Command
  331. #--------------------------------------------------------------------------      
  332. def update_command
  333.      return if @auto
  334.      if Input.trigger?(Input::X)
  335.         check_command(0)
  336.      elsif Input.trigger?(Input::Z)  
  337.         check_command(1)
  338.      elsif Input.trigger?(Input::Y)  
  339.         check_command(2)
  340.      elsif Input.trigger?(Input::A)   
  341.         check_command(3)
  342.      elsif Input.trigger?(Input::C)           
  343.         check_command(4)
  344.      elsif Input.trigger?(Input::B)        
  345.         check_command(5)
  346.      elsif Input.trigger?(Input::L)        
  347.         check_command(6)
  348.      elsif Input.trigger?(Input::R)        
  349.         check_command(7)        
  350.      elsif Input.trigger?(Input::RIGHT)      
  351.         check_command(8)
  352.      elsif Input.trigger?(Input::LEFT)
  353.         check_command(9)
  354.      elsif Input.trigger?(Input::DOWN)
  355.         check_command(10)
  356.      elsif Input.trigger?(Input::UP)  
  357.         check_command(11)
  358.      end   
  359. end  
  360.  
  361. #--------------------------------------------------------------------------
  362. # ● command_list_check
  363. #--------------------------------------------------------------------------      
  364. def command_list_check(command)
  365.      case command
  366.          when "A"
  367.             @com = 0  
  368.          when "D"
  369.             @com = 1  
  370.          when "S"
  371.             @com = 2
  372.          when "Shift"
  373.             @com = 3
  374.          when "Z"
  375.             @com = 4
  376.          when "X"
  377.             @com = 5
  378.          when "Q"
  379.             @com = 6
  380.          when "W"
  381.             @com = 7            
  382.          when "Right"
  383.             @com = 8
  384.          when "Left"
  385.             @com = 9
  386.          when "Down"
  387.             @com = 10
  388.          when "Up"  
  389.             @com = 11
  390.          else   
  391.             @com = 12           
  392.      end
  393. end   
  394.  
  395. #--------------------------------------------------------------------------
  396. # ● check_command
  397. #--------------------------------------------------------------------------            
  398. def check_command(com)
  399.      index = 0
  400.      if com != -1
  401.         right_input = false
  402.         for i in @chain_command
  403.            if index == @com_index
  404.               command_list_check(i)
  405.               right_input = true if @com == com
  406.            end  
  407.           index += 1  
  408.        end  
  409.      else  
  410.        command_list_check(@com_index)
  411.        @change_time = 0
  412.        right_input = true
  413.      end  
  414.      if right_input
  415.         refresh_number
  416.         next_command
  417.      else  
  418.         wrong_command
  419.      end  
  420. end  
  421.  
  422. #--------------------------------------------------------------------------
  423. # ● Next Command
  424. #--------------------------------------------------------------------------            
  425. def next_command   
  426.      @com_index += 1   
  427.      Audio.se_play("Audio/SE/" + CHAIN_RIGHT_SE, 100, 100)
  428.      if @com_index == @chain_command.size
  429.         $game_switches[@action_id] = true
  430.         exit
  431.         $game_map.need_refresh = true
  432.      end  
  433.      refresh_command
  434.      refresh_text(0)
  435. end     
  436.  
  437. #--------------------------------------------------------------------------
  438. # ● wrong_command
  439. #--------------------------------------------------------------------------              
  440. def wrong_command
  441.      Audio.se_play("Audio/SE/" + CHAIN_WRONG_SE, 100, 100)
  442.      refresh_text(1)
  443.      exit
  444.      $game_player.jump(0,0)
  445. end
  446.  
  447. #--------------------------------------------------------------------------
  448. # ● Refresh Command
  449. #--------------------------------------------------------------------------               
  450. def refresh_command
  451.      @sprite.bitmap.clear
  452.      index = 0
  453.      for i in @chain_command
  454.          command_list_check(i)
  455.          bitmap_src_rect = Rect.new(@com * @bitmap_cw, 0, @bitmap_cw, @bitmap_ch)
  456.          if @com_index == index
  457.             @bitmap.blt(index * (@bitmap_cw + 5) , 0, @image, bitmap_src_rect)
  458.          else
  459.             @bitmap.blt(index * (@bitmap_cw + 5) , @bitmap_ch, @image, bitmap_src_rect)
  460.          end
  461.          index += 1
  462.        end
  463.      if @chain_command.size > 15  
  464.         @new_x = (544 / 2) - ((@bitmap_cw + 5) * @com_index)
  465.      else   
  466.         @cursor.x = (544 / 2) - @cursor_space + ((@bitmap_cw + 5) * @com_index)
  467.      end
  468. end  
  469.  
  470. #--------------------------------------------------------------------------
  471. # ● Refresh Text
  472. #--------------------------------------------------------------------------               
  473. def refresh_text(type)
  474.      @text.bitmap.clear
  475.      if type == 0
  476.         if @com_index == @chain_command.size
  477.            @text.bitmap.font.color.set(55, 255, 55,220)
  478.            @text.bitmap.draw_text(0, 0, 200, 32, "Perfect!",1)              
  479.         else  
  480.            @text.bitmap.font.color.set(55, 155, 255,220)
  481.            @text.bitmap.draw_text(0, 0, 200, 32, "Success!",1)              
  482.         end
  483.      else
  484.         @text.bitmap.font.color.set(255, 155, 55,220)
  485.         if @timer == 0
  486.            @text.bitmap.draw_text(0, 0, 200, 32, "Time Limit!",1)  
  487.         else  
  488.            @text.bitmap.draw_text(0, 0, 200, 32, "Fail!",1)   
  489.         end
  490.      end  
  491.      @text.x = 230   
  492.      @text.opacity = 255
  493. end
  494.  
  495. #--------------------------------------------------------------------------
  496. # ● Refresh Number
  497. #--------------------------------------------------------------------------               
  498. def refresh_number
  499.      @combo += 1
  500.      @number.bitmap.clear
  501.      @number.bitmap.font.size = 34
  502.      @number.bitmap.draw_text(0, 0, 200, 32, @combo.to_s,1)         
  503.      @number.opacity = 255
  504.      @number.zoom_x = 2
  505.      @number.zoom_y = 2
  506. end
  507.  
  508. #--------------------------------------------------------------------------
  509. # ● Update Cursor Slide
  510. #--------------------------------------------------------------------------           
  511. def update_cursor_slide   
  512.      @sprite.zoom_x -= 0.1 if @sprite.zoom_x > 1
  513.      @sprite.zoom_y -= 0.1 if @sprite.zoom_y > 1
  514.      @text.x -= 2 if @text.x > 210
  515.      @text.opacity -= 5 if @text.opacity > 0
  516.      @sprite.x -= @slide_time if @sprite.x > @new_x and @chain_command.size > 15
  517.      if @number.zoom_x > 1
  518.         @number.zoom_x -= 0.1
  519.         @number.zoom_y -= 0.1
  520.      end
  521.      if @fy_time > 15
  522.         @fy += 1
  523.      elsif @fy_time > 0
  524.         @fy -= 1
  525.      else   
  526.         @fy = 0
  527.         @fy_time = 30
  528.      end  
  529.      @fy_time -= 1
  530.      @cursor.oy = @fy     
  531. end  
  532. end
  533.  
  534. #==============================================================================
  535. # ■ Game Temp
  536. #==============================================================================
  537. class Game_Temp
  538.  
  539. attr_accessor :chain_switch_id
  540.  
  541. #--------------------------------------------------------------------------
  542. # ● Initialize
  543. #--------------------------------------------------------------------------         
  544.   alias mog_chain_commands_initialize initialize
  545.   def initialize
  546.       @chain_switch_id = 0
  547.       mog_chain_commands_initialize
  548.   end  
  549.  
  550. end
  551.  
  552. #==============================================================================
  553. # ■ Game_Interpreter
  554. #==============================================================================
  555. class Game_Interpreter
  556.  
  557. #--------------------------------------------------------------------------
  558. # ● Chain Commands
  559. #--------------------------------------------------------------------------           
  560.   def chain_commands(switch_id = 0)
  561.       return if switch_id <= 0
  562.       $game_temp.chain_switch_id = switch_id
  563.       SceneManager.call(Chain_Commands)
  564.       wait(1)
  565.   end
  566.  
  567. end
  568.  
  569. #===============================================================================
  570. # ■ SceneManager
  571. #===============================================================================
  572. class << SceneManager
  573.   @background_bitmap2 = nil
  574.  
  575.   #--------------------------------------------------------------------------
  576.   # ● Snapshot For Background2
  577.   #--------------------------------------------------------------------------
  578.   def snapshot_for_background2
  579.       @background_bitmap2.dispose if @background_bitmap2
  580.       @background_bitmap2 = Graphics.snap_to_bitmap
  581.   end
  582.  
  583.   #--------------------------------------------------------------------------
  584.   # ● Background Bitmap2
  585.   #--------------------------------------------------------------------------
  586.   def background_bitmap2
  587.       @background_bitmap2
  588.   end
  589.  
  590. end
  591.  
  592. #===============================================================================
  593. # ■ Scene Map
  594. #===============================================================================
  595. class Scene_Map < Scene_Base
  596.  
  597.   #--------------------------------------------------------------------------
  598.   # ● Terminate
  599.   #--------------------------------------------------------------------------  
  600.   alias mog_chain_commands_terminate terminate
  601.   def terminate
  602.       SceneManager.snapshot_for_background2
  603.       mog_chain_commands_terminate      
  604.   end
  605.  
  606. end  
  607.  
  608. $mog_rgss3_chain_commands = true

ps:该脚本来源与RPG制作大师吧的置顶帖
作者: 喵呜喵5    时间: 2014-8-20 13:08
1 按键添加完成后,在事件指令中的脚本里输入 chain_commands(喵呜喵5)
括号中的喵呜喵5换成你设置的ID

2 时间长短在脚本第64行

P.S 虽然没什么大影响,63行的注释,位置错了= =
作者: Forever火    时间: 2014-8-20 13:11
喵呜喵5 发表于 2014-8-20 13:08
1 按键添加完成后,在事件指令中的脚本里输入 chain_commands(喵呜喵5)
括号中的喵呜喵5换成你设置的ID

可是我实际测试时,12以后的按键出来都是“?”而且即便按对了也不显示正确,另外能解释一下elas后弟13个是什么用的?
作者: Forever火    时间: 2014-8-20 13:36
我设置了一个开关11来测试,修改了脚本中如下(2个)地方:


RUBY 代码复制
  1. #--------------------------------------------------------------------------
  2. # ● Update Command
  3. #--------------------------------------------------------------------------      
  4. def update_command
  5.      return if @auto
  6.      if Input.trigger?(Input::X)
  7.         check_command(0)
  8.      elsif Input.trigger?(Input::Z)  
  9.         check_command(1)
  10.      elsif Input.trigger?(Input::Y)  
  11.         check_command(2)
  12.      elsif Input.trigger?(Input::A)   
  13.         check_command(3)
  14.      elsif Input.trigger?(Input::C)           
  15.         check_command(4)
  16.      elsif Input.trigger?(Input::B)        
  17.         check_command(5)
  18.      elsif Input.trigger?(Input::L)        
  19.         check_command(6)
  20.      elsif Input.trigger?(Input::R)        
  21.         check_command(7)        
  22.      elsif Input.trigger?(Input::RIGHT)      
  23.         check_command(8)
  24.      elsif Input.trigger?(Input::LEFT)
  25.         check_command(9)
  26.      elsif Input.trigger?(Input::DOWN)
  27.         check_command(10)
  28.      elsif Input.trigger?(Input::UP)  
  29.         check_command(11)
  30.      elsif Input.trigger?(Input::B)  
  31.         check_command(12)
  32.      elsif Input.trigger?(Input::C)  
  33.         check_command(13)  
  34.      end   
  35. end


以上是我认为添加按键的地方,虽然标签是刷新按键
RUBY 代码复制
  1. #--------------------------------------------------------------------------
  2. # ● command_list_check
  3. #--------------------------------------------------------------------------      
  4. def command_list_check(command)
  5.      case command
  6.          when "A"
  7.             [url=home.php?mod=space&uid=10462]@Com[/url] = 0  
  8.          when "D"
  9.             @com = 1  
  10.          when "S"
  11.             @com = 2
  12.          when "Shift"
  13.             @com = 3
  14.          when "Z"
  15.             @com = 4
  16.          when "X"
  17.             @com = 5
  18.          when "Q"
  19.             @com = 6
  20.          when "W"
  21.             @com = 7            
  22.          when "Right"
  23.             @com = 8
  24.          when "Left"
  25.             @com = 9
  26.          when "Down"
  27.             @com = 10
  28.          when "Up"  
  29.             @com = 11
  30.          when "B"  
  31.             @com = 12
  32.          when "C"  
  33.             @com = 13
  34.          else   
  35.             @com = 14         
  36.      end
  37. end

之后测试就各种不正常了。。

QQ图片20140820133131.jpg (6.16 KB, 下载次数: 31)

QQ图片20140820133131.jpg

QQ图片20140820133048.jpg (5.27 KB, 下载次数: 29)

QQ图片20140820133048.jpg

QQ图片20140820133127.jpg (1.76 KB, 下载次数: 31)

QQ图片20140820133127.jpg

QQ图片20140820133531.jpg (42.15 KB, 下载次数: 28)

QQ图片20140820133531.jpg

作者: Forever火    时间: 2014-8-20 13:38
Forever火 发表于 2014-8-20 13:36
我设置了一个开关11来测试,修改了脚本中如下(2个)地方:

@余烬之中 已经发了
作者: 余烬之中    时间: 2014-8-20 13:48
噗 你这个错的太狠了
脚本的本意是让你设置这个:
RUBY 代码复制
  1. CHAIN_SWITCH_COMMAND = {
  2. 5=>["X","Right","Left","Z","Z"],
  3. 7=>["X","X","X","X","X"],
  4. 6=>["Left","Right","Left","Right","Left","Right","Q","Z","Up","A","S",
  5.       "Down","D","Z","Right","Up","Up","Z","W","Left","Down","D","A","W"],
  6. 8=>["Up","Down","Left","Right","Z"]}


通过有限的十二个键的不同组合组成不同的连击链条

然后 脚本调用特定的连击链条 让玩家去击打 成功的话就将该链条对应的开关打开
比如  7=>["X","X","X","X","X"]
玩家按下五次X 就打开七号开关
按错了什么都不发生


而你的第一处更改 在update_command那里的

我要先向你介绍 if - elsif - else - end
RUBY 代码复制
  1. if <条件A>
  2.   <执行的内容A>
  3. elsif <条件B>
  4.   <执行的内容B>
  5. ......
  6. else
  7.   <执行的内容X>
  8. end

满足条件A时,执行内容A
不满足条件A,但是满足条件B 则执行内容B
……
所有的条件都不满足 执行else对应的内容

现在再回来看你的更改
第14行 elsif Input.trigger?(Input::C)
你所加的 在第32行 elsif Input.trigger?(Input::C)
一模一样 这当然不行(为什么?自己想一想.我已经把语法告诉你了)



再看你的第二处更改

这是case - when - else - end
RUBY 代码复制
  1. case <A>
  2. when <C1>
  3.   <B1>
  4. when <C2>
  5.   <B2>
  6. ...
  7. else
  8.   <BB>
  9. end

依次将A与C1 C2 C3……比较
一旦发现两个相同
就执行所对应的语句
如果都不相同
执行else的语句
作者: Forever火    时间: 2014-8-20 14:09
余烬之中 发表于 2014-8-20 13:48
噗 你这个错的太狠了
脚本的本意是让你设置这个:
CHAIN_SWITCH_COMMAND = {

额。。。真没发现BC重复了{:2_270:},然后我刚刚又去改成D和E了,结果报错了,以我有限的英语水平看好像是没有定义input::D,然后我又找不到它在哪定义这玩意的。我想说12个按键有点少。。我想改成全26个字母

QQ图片20140820140549.jpg (13.96 KB, 下载次数: 25)

QQ图片20140820140549.jpg

QQ图片20140820140540.jpg (12.11 KB, 下载次数: 30)

QQ图片20140820140540.jpg

作者: 余烬之中    时间: 2014-8-20 14:21
你需要全键盘脚本+相应图片素材
作者: Forever火    时间: 2014-8-20 14:21
@VIPArcher 火狐浏览器不知为毛点评刷补出验证码,在这给您回了,我觉得如果挨个检测按键也不必要用ISA(其实我是看不懂然后觉得麻烦){:2_272:}
作者: Forever火    时间: 2014-8-20 14:52
本帖最后由 Forever火 于 2014-8-20 14:53 编辑

好吧我去看看全键盘脚本。。。
作者: 喵呜喵5    时间: 2014-8-20 14:56
Forever火 发表于 2014-8-20 14:52
好吧我去看看全键盘脚本。。。

因为dll中支持的按键只有那么几个,而RM默认判定玩家的按键是通过dll来的

比如,你在游戏进行过程中按F1调出系统菜单修改按键的时候能改的按键个数也只有那么点不是么

所以要判定其他按键就不能使用RM默认的判定的方法,必须通过其他方法来突破dll的限制
作者: Forever火    时间: 2014-8-20 15:09
喵呜喵5 发表于 2014-8-20 14:56
因为dll中支持的按键只有那么几个,而RM默认判定玩家的按键是通过dll来的

比如,你在游戏进行过程中按F1 ...

我大概能猜到,应该是通过某种方法突破dl的限制l,后面应该就和原来的一样的
作者: Forever火    时间: 2014-8-20 15:24
本帖最后由 Forever火 于 2014-8-20 15:26 编辑

@余烬之中 虽然看不太懂,大概就是把键盘上的东西全给指定了一个位置,后面好像是判断按键还是啥,大概就是和系统说XX键在什么位置,如果我按了XX建就干嘛干嘛。。。然后我想说。。怎么调用?我想里面一定讲得很清楚了,不过我没有看懂而已{:2_272:}{:2_272:}
作者: Forever火    时间: 2014-8-20 15:34
@喵呜喵5 你说的是按键的图片吗?那个的话我可以用ps改改看
作者: 余烬之中    时间: 2014-8-20 16:06
我的那个全键盘还在beta版 不要用它

怎么改的话 我给个提示

比如说 你已经安装了某个全键盘脚本 通过 Input.trigger?("G")可以判断玩家是否按下了G键

那么 你就在update里加上
elsif Input.trigger?("G")  
  check_command(13)

然后另一段
when "G"  
  @Com = 13

然后为图片加上第十三个按钮:G
作者: Forever火    时间: 2014-8-20 16:13
我在贴了一个夏娜改的全键盘脚本后做了如下修改,还是不行呐。。。大大们指条明路好不好{:2_272:}
@余烬之中   
if Kboard.press?($R_Key_X)
        check_command(0)
when "$R_Key_X"
            @Com = 5

作者: 余烬之中    时间: 2014-8-20 17:56
噗 那个 下面when里面不应该是 "$R_Key_X"
而是"X"
这个东西 与你上面CHAIN_SWITCH_COMMAND里填的是一致的
作者: Forever火    时间: 2014-8-20 18:44
恐怖解谜游戏1.rar (5.06 MB, 下载次数: 29)
好不容易改好了又出了个神奇的问题,判定奇快TAT
作者: Forever火    时间: 2014-8-20 21:15
标题: 看看这个工程,明明脚本没问题。。
加了全键盘脚本的限时密码锁脚本,但是怎么我按第一下连第二个都错了?不明白的把工程拿去试试就知道 恐怖解谜游戏1.rar (5.06 MB, 下载次数: 34)
作者: 余烬之中    时间: 2014-8-20 21:55
本帖最后由 余烬之中 于 2014-8-20 22:33 编辑

现在支持从A到Z的所有键 加上Shift 再加上四个方向键

安装方法

首先 删掉你原来的全键盘和连击键
然后把这个插进去
注意论坛代码
RUBY 代码复制
  1. #===============================================================================
  2. # +++ MOG - Chain Commands (v1.4) +++
  3. #===============================================================================
  4. # By Moghunter
  5. # [url]http://www.atelier-rgss.com[/url]
  6. #===============================================================================
  7. # 拓展 By 火灰
  8. # (位于 [url]https://rpg.blue[/url])
  9. # 添加了全键盘的支持
  10. #===============================================================================
  11. # Sistema de sequência de botões para ativar switchs.
  12. #
  13. # Serão necessárias as seguintes imagens. (Graphics/System)
  14. #
  15. # Chain_Cursor.png
  16. # Chain_Command.png
  17. # Chain_Layout.png
  18. # Chain_Timer_Layout.png
  19. # Chain_Timer_Meter.png
  20. #
  21. #===============================================================================
  22. #
  23. # Para ativar o script use o comando abaixo.  (*Call Script)
  24. #
  25. # chain_commands(ID)
  26. #
  27. # ID - Id da switch.
  28. #
  29. #===============================================================================
  30. #==============================================================================
  31. # ● Histórico (Version History)
  32. #==============================================================================
  33. # v 1.4 - Correção do crash aleatório.
  34. # v 1.3 - Melhoria no sistema de dispose
  35. # v 1.2 - Melhoria na codificação e correção de alguns glitches.
  36. # v 1.1 - Animação de fade ao sair da cena de chain.
  37. #       - Opção de definir a prioridade da hud na tela.
  38. #==============================================================================
  39. module MOG_CHAIN_COMMANDS
  40.   #============================================================================
  41.   # CHAIN_COMMAND = { SWITCH_ID => [COMMAND] }
  42.   #
  43.   # SWITCH_ID = ID da switch
  44.   # COMMANDS = Defina aqui a sequência de botões.
  45.   #            (Para fazer a sequência use os comandos abaixo)
  46.   #
  47.   # "Down" ,"Up" ,"Left" ,"Right" ,"Shift" ,以及所有其他的英文字母键
  48.   #
  49.   # Exemplo de utilização
  50.   #
  51.   # CHAIN_SWITCH_COMMAND = {
  52.   # 25=>["Down","D","S","Right"],
  53.   # 59=>["Down","Up","Left","Right","Shift","D","S","A","Z","X","Q","W"],
  54.   # 80=>["Shift","D"]
  55.   # }
  56.   #============================================================================
  57.   CHAIN_SWITCH_COMMAND = {
  58.     11 => ["A","X","A"],
  59.     12 => ("A".."Z").to_a + %w{Shift Right Left Down Up},
  60.     5  => ["X","Right","Left","Z","Z"],
  61.     7  => ["X","X","X","X","X"],
  62.     6  => ["Left","Right","Left","Right","Left","Right","Q","Z","Up","A","S",
  63.            "Down","D","Z","Right","Up","Up","Z","W","Left","Down","D","A","W"],
  64.     8  => ["Up","Down","Left","Right","Z"]
  65.   }
  66.   #Duração para colocar os comandos. (A duração é multiplicado pela quantidade
  67.   #de comandos) *60 = 1 sec
  68.   #上面的连击链代表成功输入这些按键后会开启相应的开关
  69.   CHAIN_INPUT_DURATION = 60
  70.   #Som ao acertar.
  71.   CHAIN_RIGHT_SE = "Chime1"
  72.   #Som ao errar.
  73.   CHAIN_WRONG_SE = "Buzzer1"
  74.   #Switch que ativa o modo automático.
  75.   CHAIN_AUTOMATIC_MODE_SWITCH_ID = 20
  76.   #Definição da prioridade da hud na tela
  77.   CHAIN_HUD_Z = 300
  78.   KEYS = {}
  79.   ("A".."Z").each_with_index{|k, i| KEYS[k] = i + 0x41}
  80.   KEYS["SHIFT"] = 0x10; KEYS["LEFT"]  = 0x25; KEYS["RIGHT"] = 0x27
  81.   KEYS["DOWN"]  = 0x28; KEYS["UP"]    = 0x26
  82. end
  83. #===============================================================================
  84. # ■ Chain Commands
  85. #===============================================================================
  86. class Chain_Commands
  87.   include MOG_CHAIN_COMMANDS
  88.   #--------------------------------------------------------------------------
  89.   # ● Initialize
  90.   #--------------------------------------------------------------------------
  91.   def initialize
  92.     @action_id = $game_temp.chain_switch_id
  93.     @chain_command = CHAIN_SWITCH_COMMAND[@action_id]
  94.     @chain_command = ["?"] if @chain_command == nil
  95.     duration = [[CHAIN_INPUT_DURATION, 1].max, 9999].min
  96.     @timer_max = duration * @chain_command.size
  97.     @timer = @timer_max
  98.     @slide_time = [[60 / duration, 10].max, 60].min
  99.     @change_time = 0
  100.     @auto = $game_switches[CHAIN_AUTOMATIC_MODE_SWITCH_ID]
  101.     [url=home.php?mod=space&uid=10462]@Com[/url] = 0
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # ● Main
  105.   #--------------------------------------------------------------------------
  106.   def main
  107.     dispose
  108.     @background_sprite = Sprite.new
  109.     @background_sprite.bitmap = SceneManager.background_bitmap2
  110.     create_chain_command
  111.     create_cusrsor
  112.     create_layout
  113.     create_meter
  114.     create_text
  115.     create_number
  116.     Graphics.transition
  117.     loop do
  118.       Graphics.update
  119.       Input.update
  120.       update
  121.       break if SceneManager.scene != self
  122.     end
  123.     dispose
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # ● Create Cursor
  127.   #--------------------------------------------------------------------------
  128.   def create_cusrsor
  129.     @fy_time = 0
  130.     @fy = 0
  131.     @com_index = 0
  132.     @cursor = Sprite.new
  133.     @cursor.bitmap = Cache.system("Chain_Cursor")
  134.     @cursor.z = 4 + CHAIN_HUD_Z
  135.     @cursor_space = ((@bitmap_cw + 5) * @chain_command.size) / 2
  136.     if @chain_command.size <= 20
  137.       @cursor.x = (544 / 2) - @cursor_space + @cursor_space * @com_index
  138.     else
  139.       @cursor.x = (544 / 2)
  140.     end
  141.     @cursor.y = (416 / 2) + 30
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ● Create Chain Command
  145.   #--------------------------------------------------------------------------
  146.   def create_chain_command
  147.     @image = Cache.system("Chain_Command")
  148.     width_max = ((@image.width / 32) + 5) * @chain_command.size
  149.     @bitmap = Bitmap.new(width_max,@image.height * 2)
  150.     @bitmap_cw = @image.width / 32
  151.     @bitmap_ch = @image.height
  152.     index = 0
  153.     for i in @chain_command
  154.       command_list_check(i)
  155.       bitmap_src_rect = Rect.new(@com * @bitmap_cw, 0, @bitmap_cw, @bitmap_ch)
  156.       if index == 0
  157.         @bitmap.blt(index * (@bitmap_cw + 5) , 0, @image, bitmap_src_rect)
  158.       else
  159.         @bitmap.blt(index * (@bitmap_cw + 5) , @bitmap_ch, @image,
  160.         bitmap_src_rect)
  161.       end
  162.       index += 1
  163.     end
  164.     @sprite = Sprite.new
  165.     @sprite.bitmap = @bitmap
  166.     if @chain_command.size <= 15
  167.       @sprite.x = (544 / 2) - ((@bitmap_cw + 5) * @chain_command.size) / 2
  168.       @new_x = 0
  169.     else
  170.       @sprite.x = (544 / 2)
  171.       @new_x = @sprite.x
  172.     end
  173.     @sprite.y = (416 / 2) + 30  - @bitmap_ch  - 15
  174.     @sprite.z = 3 + CHAIN_HUD_Z
  175.     @sprite.zoom_x = 1.5
  176.     @sprite.zoom_y = 1.5
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # * create_layout
  180.   #--------------------------------------------------------------------------
  181.   def create_layout
  182.     @back = Plane.new
  183.     @back.bitmap = Cache.system("Chain_Layout")
  184.     @back.z = 0
  185.     @layout = Sprite.new
  186.     @layout.bitmap = Cache.system("Chain_Timer_Layout")
  187.     @layout.z = 1 + CHAIN_HUD_Z
  188.     @layout.x = 160
  189.     @layout.y = 150
  190.   end
  191.   #--------------------------------------------------------------------------
  192.   # * create_meter
  193.   #--------------------------------------------------------------------------
  194.   def create_meter
  195.     @meter_flow = 0
  196.     @meter_image = Cache.system("Chain_Timer_Meter")
  197.     @meter_bitmap = Bitmap.new(@meter_image.width,@meter_image.height)
  198.     @meter_range = @meter_image.width / 3
  199.     @meter_width = @meter_range * @timer / @timer_max
  200.     @meter_height = @meter_image.height
  201.     @meter_src_rect = Rect.new(@meter_range, 0, @meter_width, @meter_height)
  202.     @meter_bitmap.blt(0,0, @meter_image, @meter_src_rect)
  203.     @meter_sprite = Sprite.new
  204.     @meter_sprite.bitmap = @meter_bitmap
  205.     @meter_sprite.z = 2 + CHAIN_HUD_Z
  206.     @meter_sprite.x = 220
  207.     @meter_sprite.y = 159
  208.     update_flow
  209.   end
  210.   #--------------------------------------------------------------------------
  211.   # ● Create Text
  212.   #--------------------------------------------------------------------------
  213.   def create_text
  214.     @text = Sprite.new
  215.     @text.bitmap = Bitmap.new(200,32)
  216.     @text.z = 2 + CHAIN_HUD_Z
  217.     @text.bitmap.font.name = "Georgia"
  218.     @text.bitmap.font.size = 25
  219.     @text.bitmap.font.bold = true
  220.     @text.bitmap.font.italic = true
  221.     @text.bitmap.font.color.set(255, 255, 255,220)
  222.     @text.x = 230
  223.     @text.y = 100
  224.   end
  225.   #--------------------------------------------------------------------------
  226.   # ● Create Number
  227.   #--------------------------------------------------------------------------
  228.   def create_number
  229.     @combo = 0
  230.     @number = Sprite.new
  231.     @number.bitmap = Bitmap.new(200,64)
  232.     @number.z = 2 + CHAIN_HUD_Z
  233.     @number.bitmap.font.name = "Arial"
  234.     @number.bitmap.font.size = 24
  235.     @number.bitmap.font.bold = true
  236.     @number.bitmap.font.color.set(0, 255, 255,200)
  237.     @number.bitmap.draw_text(0, 0, 200, 32, "Ready",1)
  238.     @number.x = 30
  239.     @number.y = 100
  240.   end
  241.   #--------------------------------------------------------------------------
  242.   # ● Pre Dispose
  243.   #--------------------------------------------------------------------------
  244.   def exit
  245.     loop do
  246.       Graphics.update
  247.       @sprite.x += 5
  248.       @layout.x -= 5
  249.       @meter_sprite.x -= 5
  250.       @text.x -= 2
  251.       @text.opacity -= 5
  252.       @sprite.opacity -= 5
  253.       @layout.opacity -= 5
  254.       @meter_sprite.opacity -= 5
  255.       @number.opacity -= 5
  256.       @back.opacity -= 5
  257.       @cursor.visible = false
  258.       break if @sprite.opacity == 0
  259.     end
  260.     SceneManager.call(Scene_Map)
  261.   end
  262.   #--------------------------------------------------------------------------
  263.   # ● Dispose
  264.   #--------------------------------------------------------------------------
  265.   def dispose
  266.     return if @layout == nil
  267.     Graphics.freeze
  268.     @background_sprite.bitmap.dispose
  269.     @background_sprite.dispose
  270.     @bitmap.dispose
  271.     @sprite.bitmap.dispose
  272.     @sprite.dispose
  273.     @cursor.bitmap.dispose
  274.     @cursor.dispose
  275.     @meter_image.dispose
  276.     @meter_bitmap.dispose
  277.     @meter_sprite.bitmap.dispose
  278.     @meter_sprite.dispose
  279.     @layout.bitmap.dispose
  280.     @layout.dispose
  281.     @layout = nil
  282.     @back.bitmap.dispose
  283.     @back.dispose
  284.     @text.bitmap.dispose
  285.     @text.dispose
  286.     @number.bitmap.dispose
  287.     @number.dispose
  288.     @image.dispose
  289.   end
  290.   #--------------------------------------------------------------------------
  291.   # ● Update
  292.   #--------------------------------------------------------------------------
  293.   def update
  294.     update_command
  295.     update_cursor_slide
  296.     update_flow
  297.     update_change_time
  298.   end
  299.   #--------------------------------------------------------------------------
  300.   # ● Change_Time
  301.   #--------------------------------------------------------------------------
  302.   def update_change_time
  303.     return unless @auto
  304.     @change_time += 1
  305.     check_command(-1) if @change_time >= CHAIN_INPUT_DURATION - 1
  306.   end
  307.   #--------------------------------------------------------------------------
  308.   # ● Update Flow
  309.   #--------------------------------------------------------------------------
  310.   def update_flow
  311.     @timer -= 1
  312.     @meter_sprite.bitmap.clear
  313.     @meter_width = @meter_range * @timer / @timer_max
  314.     @meter_src_rect = Rect.new(@meter_flow, 0, @meter_width, @meter_height)
  315.     @meter_bitmap.blt(0,0, @meter_image, @meter_src_rect)
  316.     @meter_flow += 20
  317.     @meter_flow = 0 if @meter_flow >= @meter_image.width - @meter_range
  318.     wrong_command if @timer == 0 and @auto == false
  319.   end
  320.   #--------------------------------------------------------------------------
  321.   # ● Update Command
  322.   #--------------------------------------------------------------------------
  323.   def update_command
  324.     return if @auto
  325.     KEYS.each{|key,value| check_command(key) if Kboard.trigger?(value)}
  326.   end
  327.   #--------------------------------------------------------------------------
  328.   # ● command_list_check
  329.   #--------------------------------------------------------------------------
  330.   def command_list_check(command)
  331.     command.upcase!
  332.     @com = ("A".."Z").to_a.index(command)
  333.     @com ||= 26 + (_ = %w{SHIFT RIGHT LEFT DOWN UP}.index(command)) ? _ : 5
  334.   end
  335.   #--------------------------------------------------------------------------
  336.   # ● check_command
  337.   #--------------------------------------------------------------------------
  338.   def check_command(com)
  339.     index = 0
  340.     if com != -1
  341.       right_input = false
  342.       for i in @chain_command
  343.         if index == @com_index
  344.           right_input = true if @chain_command[index] == com
  345.         end
  346.         index += 1
  347.       end
  348.     else
  349.       @change_time = 0
  350.       right_input = true
  351.     end
  352.     if right_input
  353.       refresh_number
  354.       next_command
  355.     else
  356.       wrong_command
  357.     end
  358.   end
  359.   #--------------------------------------------------------------------------
  360.   # ● Next Command
  361.   #--------------------------------------------------------------------------
  362.   def next_command
  363.     @com_index += 1
  364.     Audio.se_play("Audio/SE/" + CHAIN_RIGHT_SE, 100, 100)
  365.     if @com_index == @chain_command.size
  366.       $game_switches[@action_id] = true
  367.       exit
  368.       $game_map.need_refresh = true
  369.     end
  370.     refresh_command
  371.     refresh_text(0)
  372.   end
  373.   #--------------------------------------------------------------------------
  374.   # ● wrong_command
  375.   #--------------------------------------------------------------------------
  376.   def wrong_command
  377.     Audio.se_play("Audio/SE/" + CHAIN_WRONG_SE, 100, 100)
  378.     refresh_text(1)
  379.     exit
  380.     $game_player.jump(0,0)
  381.   end
  382.   #--------------------------------------------------------------------------
  383.   # ● Refresh Command
  384.   #--------------------------------------------------------------------------
  385.   def refresh_command
  386.     @sprite.bitmap.clear
  387.     index = 0
  388.     for i in @chain_command
  389.       command_list_check(i)
  390.       bitmap_src_rect = Rect.new(@com * @bitmap_cw, 0, @bitmap_cw, @bitmap_ch)
  391.       if @com_index == index
  392.         @bitmap.blt(index * (@bitmap_cw + 5) , 0, @image, bitmap_src_rect)
  393.       else
  394.         @bitmap.blt(index * (@bitmap_cw + 5) , @bitmap_ch,
  395.         @image, bitmap_src_rect)
  396.       end
  397.       index += 1
  398.     end
  399.     if @chain_command.size > 15
  400.       @new_x = (544 / 2) - ((@bitmap_cw + 5) * @com_index)
  401.     else
  402.       @cursor.x = (544 / 2) - @cursor_space + ((@bitmap_cw + 5) * @com_index)
  403.     end
  404.   end
  405.   #--------------------------------------------------------------------------
  406.   # ● Refresh Text
  407.   #--------------------------------------------------------------------------
  408.   def refresh_text(type)
  409.     @text.bitmap.clear
  410.     if type == 0
  411.       if @com_index == @chain_command.size
  412.         @text.bitmap.font.color.set(55, 255, 55,220)
  413.         @text.bitmap.draw_text(0, 0, 200, 32, "Perfect!",1)
  414.       else
  415.         @text.bitmap.font.color.set(55, 155, 255,220)
  416.         @text.bitmap.draw_text(0, 0, 200, 32, "Success!",1)
  417.       end
  418.     else
  419.       @text.bitmap.font.color.set(255, 155, 55,220)
  420.       if @timer == 0
  421.         @text.bitmap.draw_text(0, 0, 200, 32, "Time Limit!",1)
  422.       else
  423.         @text.bitmap.draw_text(0, 0, 200, 32, "Fail!",1)
  424.       end
  425.     end
  426.     @text.x = 230
  427.     @text.opacity = 255
  428.   end
  429.   #--------------------------------------------------------------------------
  430.   # ● Refresh Number
  431.   #--------------------------------------------------------------------------
  432.   def refresh_number
  433.     @combo += 1
  434.     @number.bitmap.clear
  435.     @number.bitmap.font.size = 34
  436.     @number.bitmap.draw_text(0, 0, 200, 32, @combo.to_s,1)
  437.     @number.opacity = 255
  438.     @number.zoom_x = 2
  439.     @number.zoom_y = 2
  440.   end
  441.   #--------------------------------------------------------------------------
  442.   # ● Update Cursor Slide
  443.   #--------------------------------------------------------------------------
  444.   def update_cursor_slide
  445.     @sprite.zoom_x -= 0.1 if @sprite.zoom_x > 1
  446.     @sprite.zoom_y -= 0.1 if @sprite.zoom_y > 1
  447.     @text.x -= 2 if @text.x > 210
  448.     @text.opacity -= 5 if @text.opacity > 0
  449.     @sprite.x -= @slide_time if @sprite.x > @new_x and @chain_command.size > 15
  450.     if @number.zoom_x > 1
  451.       @number.zoom_x -= 0.1
  452.       @number.zoom_y -= 0.1
  453.     end
  454.     if @fy_time > 15
  455.       @fy += 1
  456.     elsif @fy_time > 0
  457.       @fy -= 1
  458.     else
  459.       @fy = 0
  460.       @fy_time = 30
  461.     end
  462.     @fy_time -= 1
  463.     @cursor.oy = @fy
  464.   end
  465. end
  466. #==============================================================================
  467. # ■ Game Temp
  468. #==============================================================================
  469. class Game_Temp
  470.   attr_accessor :chain_switch_id
  471.   #--------------------------------------------------------------------------
  472.   # ● Initialize
  473.   #--------------------------------------------------------------------------
  474.   alias mog_chain_commands_initialize initialize
  475.   def initialize
  476.     @chain_switch_id = 0
  477.     mog_chain_commands_initialize
  478.   end
  479. end
  480. #==============================================================================
  481. # ■ Game_Interpreter
  482. #==============================================================================
  483. class Game_Interpreter
  484.   #--------------------------------------------------------------------------
  485.   # ● Chain Commands
  486.   #--------------------------------------------------------------------------
  487.   def chain_commands(switch_id = 0)
  488.     return if switch_id <= 0
  489.     $game_temp.chain_switch_id = switch_id
  490.     SceneManager.call(Chain_Commands)
  491.     wait(1)
  492.   end
  493. end
  494. #===============================================================================
  495. # ■ SceneManager
  496. #===============================================================================
  497. class << SceneManager
  498.   @background_bitmap2 = nil
  499.   #--------------------------------------------------------------------------
  500.   # ● Snapshot For Background2
  501.   #--------------------------------------------------------------------------
  502.   def snapshot_for_background2
  503.     @background_bitmap2.dispose if @background_bitmap2
  504.     @background_bitmap2 = Graphics.snap_to_bitmap
  505.   end
  506.   #--------------------------------------------------------------------------
  507.   # ● Background Bitmap2
  508.   #--------------------------------------------------------------------------
  509.   def background_bitmap2
  510.     @background_bitmap2
  511.   end
  512. end
  513. #===============================================================================
  514. # ■ Scene Map
  515. #===============================================================================
  516. class Scene_Map < Scene_Base
  517.   #--------------------------------------------------------------------------
  518.   # ● Terminate
  519.   #--------------------------------------------------------------------------
  520.   alias mog_chain_commands_terminate terminate
  521.   def terminate
  522.     SceneManager.snapshot_for_background2
  523.     mog_chain_commands_terminate
  524.   end
  525. end
  526. $mog_rgss3_chain_commands = true
  527. #============================================================================
  528. # ■ Keyboard Script
  529. #----------------------------------------------------------------------------
  530. #    By: 灼眼的夏娜
  531. #  整理: 火灰
  532. #----------------------------------------------------------------------------
  533. # 本脚本来自 rm.66RPG.com,使用和转载请保留此信息
  534. #==============================================================================
  535. module Kboard
  536.   module_function
  537.   @R_Key_Hash = {}
  538.   @R_Key_Repeat = {}
  539.   GetKeyState = Win32API.new("user32","GetAsyncKeyState",['I'],'I')
  540.   def press?(rkey)
  541.     return GetKeyState.call(rkey) != 0
  542.   end
  543.   def repeat?(rkey)
  544.     result = GetKeyState.call(rkey)
  545.     if result != 0
  546.       if @R_Key_Repeat[rkey].nil?
  547.         @R_Key_Repeat[rkey] = 0
  548.         return true
  549.       end
  550.       @R_Key_Repeat[rkey] += 1
  551.     else
  552.       @R_Key_Repeat[rkey] = nil
  553.       @R_Key_Hash[rkey] = 0
  554.     end
  555.     if !@R_Key_Repeat[rkey].nil? and @R_Key_Repeat[rkey] > 4
  556.       @R_Key_Repeat[rkey] = 0
  557.       return true
  558.     else
  559.       return false
  560.     end
  561.   end
  562.   def trigger?(rkey)
  563.     result = GetKeyState.call(rkey)
  564.     if @R_Key_Hash[rkey] == 1 and result != 0
  565.       return false
  566.     end
  567.     if result != 0
  568.       @R_Key_Hash[rkey] = 1
  569.       return true
  570.     else
  571.       @R_Key_Hash[rkey] = 0
  572.       return false
  573.     end
  574.   end
  575. end


最后 把这个图片代替你原来的Chain_Command.png 位于Graphics\System下





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