查看: 2374|回复: 3

[已经解决] 关于MOG战斗输入挑战脚本的使用问题(已解决)

[复制链接]
梦石
0
星屑
1014
在线时间
120 小时
注册时间
2018-4-7
回帖
13
发表于 2019-1-19 16:43:33 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 2573881970 于 2019-4-20 23:51 编辑

想用这个脚本。明明已经对技能备注了,但战斗测试的时候却没有效果,求解。
  1. #==============================================================================
  2. # +++ MOG - 战斗输入挑战 (v3.3) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # [url]https://atelierrgss.wordpress.com/[/url]
  6. #==============================================================================
  7. # 在技能发动之前可以设定一个输入挑战,全部输入正确后才能施放技能.
  8. #==============================================================================
  9. # 需要以下图片,放在 Graphics/System/
  10. #
  11. # Chain_Command.png
  12. # Chain_Battle_Layout.png
  13. # Chain_Battle_Meter.png
  14. #
  15. #==============================================================================
  16. # 使用方法
  17. #==============================================================================
  18. # 技能备注:
  19. #
  20. # <Chain Action = X>
  21. #
  22. # X - 技能ID
  23. #==============================================================================

  24. #==============================================================================
  25. # ● Histórico (Version History)
  26. #==============================================================================
  27. # v3.3 - Melhoria na compatibilidade com MOG Battle Camera
  28. # v3.2 - Compatibilidade com MOG Sprite Actor.
  29. # v3.1 - Compatibilidade com MOG Battle Camera.
  30. # v3.0 - Adição de comandos aleatórios.
  31. # v2.9 - Correção do bug de não ocultar a janela com MOG ATB.
  32. # v2.8 - Melhoria na codificação.
  33. #==============================================================================

  34. $imported = {} if $imported.nil?
  35. $imported[:mog_active_chain] = true

  36. module MOG_CHAIN_ACTIONS
  37. #=============================================================================
  38. # CHAIN_ACTIONS = { 技能ID => [按键顺序] }
  39. #
  40. # 技能ID = 数据库中的技能ID.
  41. # 按键顺序 = 设定按键顺序
  42. #        (以下为全部可用按键)   
  43. #  
  44. # "Down" ,"Up" ,"Left" ,"Right" ,"Shift" ,"D" ,"S" ,"A" ,"Z" ,"X" ,"Q" ,"W",
  45. # "Random"
  46. #
  47. # 例子:
  48. #
  49. # CHAIN_ACTIONS = {
  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_ACTIONS = {
  56. 29=>["Random","Random","Random","Random"],
  57. 52=>["Up","Down","Left","Right","Z"],
  58. 70=>["X","Right","Left","Z","Z"],
  59. 138=>["Random"],
  60. 139=>["Random","Random"],
  61. 140=>["Random","Random","Random"],
  62. #138=>["X"],
  63. #139=>["A","S"],
  64. #140=>["Z","D","X"],
  65. 141=>["Up","Down"],
  66. 142=>["Left","Right","Z"],
  67. 999=>["Left","Right","Left","Right","Left","Right","Q","Z","Up","A","S",
  68.       "Down","D","Z","Right","Up","Up","Z","W","Left","Down","D","A","W"]
  69. }  
  70. #设置随机指令.
  71. RANDOM_KEYS = ["Left","Right","Up","Down","D","S","A","Z","X"]
  72. #默认按键的等待时间(玩家需要正确按下的时间).
  73. CHAIN_DEFAULT_INPUT_DURATION = 60 #60帧 = 1s
  74. #指定按键的等待时间
  75. CHAIN_INPUT_DURATION = {
  76. 138=>60,
  77. 139=>40,
  78. 140=>30
  79. #141=>160,
  80. #240=>2000
  81. }

  82. #正确点击时的音效.
  83. CHAIN_RIGHT_SE = "Chime1"
  84. #错误点击时的音效.
  85. CHAIN_WRONG_SE = "Buzzer1"
  86. #输入挑战开始时播放的音效.
  87. CHAIN_START_SE = "Open1"
  88. #输入挑战精灵的位置.
  89. CHAIN_SPRITE_POSITION = [0,-15]
  90. #输入挑战图片的位置
  91. CHAIN_LAYOUT_POSITION = [1,-7]
  92. #进度条图片的位置
  93. CHAIN_METER_POSITION = [0,-6]
  94. #图标的位置
  95. CHAIN_ICON_POSITION = [0,-32]
  96. #输入挑战开始时显示的文字.
  97. CHAIN_COMMAND_WORD = "输入挑战!"
  98. #未命中和时间结束的文字
  99. CHAIN_MISSED_WORDS = ["未命中!", "时间结束"]
  100. #文字位置
  101. CHAIN_COMMAND_WORD_POSITION = [0,0]
  102. #文字大小
  103. CHAIN_WORD_FONT_SIZE = 20
  104. #文字颜色
  105. CHAIN_WORD_FONT_COLOR = Color.new(255,255,255)
  106. #文字Z坐标
  107. CHAIN_SPRITE_Z = 150
  108. end

  109. #==============================================================================
  110. # ■ Game Temp
  111. #==============================================================================
  112. class Game_Temp
  113.   attr_accessor :chain_actions
  114.   attr_accessor :active_chain
  115.   attr_accessor :chain_ot
  116.   attr_accessor :chain_action_phase
  117.   #--------------------------------------------------------------------------
  118.   # ● Initialize
  119.   #--------------------------------------------------------------------------      
  120.   alias mog_chain_actions_initialize initialize
  121.   def initialize
  122.       @chain_actions = [0,0,0,false] ; @active_chain = false
  123.       @chain_action_phase = false
  124.       mog_chain_actions_initialize
  125.   end
  126.   
  127. end

  128. #==============================================================================
  129. # ■ Scene_Battle
  130. #==============================================================================
  131. class Scene_Battle < Scene_Base
  132.   
  133.   #--------------------------------------------------------------------------
  134.   # ● Use Item
  135.   #--------------------------------------------------------------------------  
  136.   alias mog_chain_actions_use_item use_item
  137.   def use_item
  138.       prepare_chain_command if can_use_chain_commands?
  139.       mog_chain_actions_use_item
  140.       execute_chain_actions if can_use_chain_commands?
  141.   end  
  142.   
  143.   #--------------------------------------------------------------------------
  144.   # ● Can Use Chain Commands
  145.   #--------------------------------------------------------------------------  
  146.   def can_use_chain_commands?
  147.       return false if @subject == nil
  148.       return false if !@subject.is_a?(Game_Actor)
  149.       return false if @subject.restriction != 0
  150.       return true
  151.   end
  152.   
  153.   #--------------------------------------------------------------------------
  154.   # ● Prepare Chain Commands
  155.   #--------------------------------------------------------------------------  
  156.   def prepare_chain_command
  157.       @chain_skill_original = @subject.current_action.item rescue nil
  158.       if $game_temp.chain_ot == nil and @subject.is_a?(Game_Actor)
  159.          targets = @subject.current_action.make_targets.compact
  160.          $game_temp.chain_ot = targets[0]
  161.       end
  162.       check_chain_targets  
  163.   end
  164.       
  165.   #--------------------------------------------------------------------------
  166.   # ● Check Chain Command Position
  167.   #--------------------------------------------------------------------------      
  168.   def check_chain_command_position
  169.       scx = $game_temp.chain_ot.screen_x rescue nil
  170.       return if scx == nil
  171.       if $game_temp.chain_ot != nil and !$game_temp.chain_ot.dead?
  172.          $game_temp.chain_actions = [$game_temp.chain_ot.screen_x,$game_temp.chain_ot.screen_y,true]
  173.       end   
  174.   end
  175.       
  176.   #--------------------------------------------------------------------------
  177.   # ● Check Chain Targets
  178.   #--------------------------------------------------------------------------   
  179.   def check_chain_targets
  180.       return if @subject == nil or $game_temp.chain_ot == nil
  181.       if [1,7,9,10,11].include?(@subject.current_action.item.scope)
  182.          @pre_target = $game_temp.chain_ot ; @pre_target_hp = $game_temp.chain_ot.hp
  183.       else   
  184.          @pre_target = nil ; @pre_target_hp = nil
  185.       end  
  186.   end

  187.   #--------------------------------------------------------------------------
  188.   # ● Execute Chain Actions
  189.   #--------------------------------------------------------------------------  
  190.   def execute_chain_actions
  191.       $game_temp.active_chain = false
  192.       return if !can_execute_chain_actions_base?
  193.       check_chain_command_position
  194.       skill = @subject.current_action.item rescue nil
  195.       skill = @chain_skill_original rescue nil
  196.       action_id = skill.note =~ /<Chain Action = (\d+)>/i ? $1.to_i : nil rescue nil
  197.       return if action_id == nil or action_id < 1      
  198.       chain_command_sequence = MOG_CHAIN_ACTIONS::CHAIN_ACTIONS[action_id].dup rescue nil
  199.       $game_temp.chain_actions[2] = action_id   
  200.       if can_execute_chain_sequence?(chain_command_sequence,action_id)
  201.          chain_act_before_action if @chain_command == nil
  202.          chain_sq = Chain_Actions.new(chain_command_sequence,$game_temp.chain_actions)
  203.          loop do
  204.               $game_temp.chain_action_phase = true
  205.               (chain_sq.update($game_temp.chain_ot) ; Input.update) unless @spriteset.animation?
  206.               $game_temp.active_chain = true ; chain_sq.update_skill_name
  207.               @spriteset.update ; Graphics.update ; update_info_viewport
  208.               break if chain_sq.phase == 9
  209.          end
  210.          @subject.wp_animation = [true,chain_sq.success] if $imported[:mog_sprite_actor]
  211.          action_id = nil if !chain_sq.success or $game_temp.chain_ot.dead?
  212.          chain_sq.dispose ; set_chain_skill(action_id) if action_id != nil         
  213.       end
  214.       $game_temp.active_chain = false ; $game_temp.chain_ot = nil
  215.       $game_temp.chain_action_phase = false
  216.   end

  217.   #--------------------------------------------------------------------------
  218.   # ● Chain Act Before Action
  219.   #--------------------------------------------------------------------------  
  220.   def chain_act_before_action
  221.       @chain_command = true ; @bb_cursor
  222.       if $imported[:mog_battle_cursor]
  223.          @bb_cursor =  $game_temp.battle_cursor[2]
  224.          $game_temp.battle_cursor[2] = false
  225.       end
  226.       if $imported[:mog_menu_cursor]   
  227.          @chain_curor_x = $game_temp.menu_cursor[2]
  228.          $game_temp.menu_cursor[2] = -999
  229.          force_cursor_visible(false)
  230.       end
  231.       if $imported[:mog_atb_system]
  232.          record_window_data if @wd_rec.nil?
  233.          hide_base_window
  234.          @wd_rec = true
  235.       end      
  236.   end     
  237.   
  238.   #--------------------------------------------------------------------------
  239.   # ● Turn End
  240.   #--------------------------------------------------------------------------  
  241.   alias mog_chain_command_process_action_end process_action_end
  242.   def process_action_end
  243.       mog_chain_command_process_action_end
  244.       chain_act_after_action
  245.   end
  246.   
  247.   #--------------------------------------------------------------------------
  248.   # ● Chain Act After ACtion
  249.   #--------------------------------------------------------------------------  
  250.   def chain_act_after_action
  251.       @chain_skill_original = nil
  252.       $game_temp.chain_ot = nil
  253.       return if @chain_command == nil
  254.       restore_window_data if $imported[:mog_atb_system]
  255.       $game_temp.menu_cursor[2] = @chain_curor_x if $imported[:mog_menu_cursor]
  256.       $game_temp.battle_cursor[2] = @bb_cursor if @bb_cursor != nil
  257.       @chain_command = nil      
  258.   end   
  259.   
  260.   #--------------------------------------------------------------------------
  261.   # ● Set Chain Skill
  262.   #--------------------------------------------------------------------------  
  263.   def set_chain_skill(action_id)
  264.       return if action_id == nil
  265.       @subject.input.set_skill(action_id)
  266.       $game_temp.chain_actions = [0,0,0,false] ; execute_action   
  267.   end
  268.   
  269.   #--------------------------------------------------------------------------
  270.   # ● Can Execute Chain Sequence?
  271.   #--------------------------------------------------------------------------  
  272.   def can_execute_chain_sequence?(chain_command_sequence = nil,action_id = nil)
  273.       return false if chain_command_sequence == nil
  274.       skill = $data_skills[action_id] rescue nil
  275.       return false if skill == nil
  276.       return false if $game_temp.chain_ot == nil or $game_temp.chain_ot.dead?
  277.       if [9,10].include?(skill.scope)
  278.          $game_party.battle_members.each do |i| return true if i.dead? end
  279.          return false
  280.       end
  281.       return true
  282.   end

  283.   #--------------------------------------------------------------------------
  284.   # ● Can Execute Chain Actions Base
  285.   #--------------------------------------------------------------------------   
  286.   def can_execute_chain_actions_base?
  287.       return false if @subject == nil or @subject.dead?
  288.       return false if $game_temp.chain_ot == nil or $game_temp.chain_ot.dead?
  289.       return false if @subject.is_a?(Game_Enemy)
  290.       return false if @subject.current_action == nil
  291.       @subject.states.each do |i| return false if i.restriction > 0 end
  292.       return false if $game_party.members.empty?
  293.       return false if $game_party.all_dead?
  294.       return false if $game_troop.all_dead?
  295.       if @pre_target != nil and $game_temp.chain_ot.hp == @pre_target_hp
  296.          return false if $game_temp.chain_ot.result.missed
  297.          return false if $game_temp.chain_ot.result.evaded
  298.       end
  299.       return true
  300.   end
  301.    
  302.   #--------------------------------------------------------------------------
  303.   # ● Turn End
  304.   #--------------------------------------------------------------------------   
  305.   alias mog_chain_command_turn_end turn_end
  306.   def turn_end
  307.       mog_chain_command_turn_end
  308.       @wd_rec = nil
  309.   end
  310.    
  311. end
  312.   
  313. #==============================================================================
  314. # ■ Game Temp
  315. #==============================================================================
  316. class Game_Temp
  317.   
  318.   attr_accessor :cache_active_chain
  319.   
  320.   #--------------------------------------------------------------------------
  321.   # ● Initialize
  322.   #--------------------------------------------------------------------------   
  323.   alias mog_active_chain_initialize initialize
  324.   def initialize
  325.       mog_active_chain_initialize
  326.       cache_act_chain
  327.   end  
  328.   
  329.   #--------------------------------------------------------------------------
  330.   # ● Cache Act Chain
  331.   #--------------------------------------------------------------------------      
  332.   def cache_act_chain
  333.       @cache_active_chain = []
  334.       @cache_active_chain.push(Cache.system("IconSet"))
  335.       @cache_active_chain.push(Cache.system("Chain_Battle_Layout"))
  336.       @cache_active_chain.push(Cache.system("Chain_Battle_Meter"))
  337.       @cache_active_chain.push(Cache.system("Chain_Battle_Command"))
  338.   end
  339.   
  340. end

  341. #==============================================================================
  342. # ■ Spriteset Battle
  343. #==============================================================================
  344. class Spriteset_Battle
  345.    
  346.   #--------------------------------------------------------------------------
  347.   # ● Initialize
  348.   #--------------------------------------------------------------------------   
  349.   alias mog_active_chain_commands_initialize initialize
  350.   def initialize
  351.       $game_temp.cache_act_chain ; $game_temp.active_chain = false
  352.       $game_temp.chain_ot = nil
  353.       mog_active_chain_commands_initialize      
  354.   end
  355. end   

  356. #==============================================================================
  357. # ■ Chain Actions
  358. #==============================================================================
  359. class Chain_Actions
  360.   
  361.   include MOG_CHAIN_ACTIONS
  362.   
  363.   attr_accessor :phase
  364.   attr_accessor :success
  365.    
  366.   #--------------------------------------------------------------------------
  367.   # ● Initialize
  368.   #--------------------------------------------------------------------------   
  369.   def initialize(sequence,chain_temp)
  370.       $game_temp.chain_actions[3] = true
  371.       @chain_command_original = sequence.dup
  372.       @chain_command = sequence
  373.       random_sequence
  374.       @x = chain_temp[0] + CHAIN_SPRITE_POSITION[0]
  375.       @y = chain_temp[1] + CHAIN_SPRITE_POSITION[1]
  376.       @y = (Graphics.height - 36) if @y > (Graphics.height - 36)
  377.       @y = 0 if @y < 0
  378.       @skill = $data_skills[chain_temp[2]]
  379.       @skillname = @skill.name

  380.       if CHAIN_INPUT_DURATION[chain_temp[2]] != nil
  381.          @duration = [CHAIN_INPUT_DURATION[chain_temp[2]],CHAIN_INPUT_DURATION[chain_temp[2]]]
  382.       else   
  383.          @duration = [CHAIN_DEFAULT_INPUT_DURATION, CHAIN_DEFAULT_INPUT_DURATION]
  384.       end  
  385.       @phase = 0 ; @success = false ; @com = 0 ; @com_index = 0
  386.       @initial_wait = 1 ; @wrong_commnad = [false,0,0]
  387.       Audio.se_play("Audio/SE/" + CHAIN_START_SE, 100, 100) rescue nil
  388.       create_button_sprite ; create_skill_name ; create_icon ; create_meter
  389.       set_opacity(0)
  390.   end
  391.   
  392.   #--------------------------------------------------------------------------
  393.   # ● Random Sequence
  394.   #--------------------------------------------------------------------------   
  395.   def random_sequence
  396.       @chain_command_original.each_with_index do |c, i|
  397.       next if c != "Random"
  398.       k = rand(RANDOM_KEYS.size) ; @chain_command[i] = RANDOM_KEYS[k]
  399.       end
  400.   end

  401.   #--------------------------------------------------------------------------
  402.   # ● Create Icon
  403.   #--------------------------------------------------------------------------      
  404.   def create_icon
  405.       @icon_image = $game_temp.cache_active_chain[0]
  406.       @icon_sprite = Sprite.new ; @icon_sprite.bitmap = Bitmap.new(24,24)
  407.       @icon_sprite.z = CHAIN_SPRITE_Z + 1
  408.       @org_x2 = @x - 12 +  CHAIN_ICON_POSITION[0] - @center
  409.       @icon_sprite.x = @org_x2 - 50
  410.       @icon_sprite.y = @y +  CHAIN_ICON_POSITION[1]     
  411.       icon_rect = Rect.new(@skill.icon_index % 16 * 24, @skill.icon_index / 16 * 24, 24, 24)
  412.       @icon_sprite.bitmap.blt(0,0, @icon_image, icon_rect)
  413.   end

  414.   #--------------------------------------------------------------------------
  415.   # ● Create Meter
  416.   #--------------------------------------------------------------------------        
  417.   def create_meter
  418.       @meter_layout = Sprite.new
  419.       @meter_layout.bitmap = $game_temp.cache_active_chain[1]
  420.       @meter_layout.z = CHAIN_SPRITE_Z
  421.       @meter_layout.x = @x - (@meter_layout.width / 2) + CHAIN_LAYOUT_POSITION[0]
  422.       @meter_layout.y = @y + CHAIN_LAYOUT_POSITION[1]
  423.       @meter_image = $game_temp.cache_active_chain[2]
  424.       @meter_cw = @meter_image.width ; @meter_ch = @meter_image.height
  425.       @meter = Sprite.new
  426.       @meter.bitmap = Bitmap.new(@meter_image.width, @meter_image.height)
  427.       @meter.z = CHAIN_SPRITE_Z + 1
  428.       @meter.x = @x - (@meter_image.width / 2) + CHAIN_METER_POSITION[0]
  429.       @meter.y = @y + CHAIN_METER_POSITION[1]
  430.       @meter.visible = false ; @meter_layout.visible = false ; update_meter
  431.   end
  432.   
  433.   #--------------------------------------------------------------------------
  434.   # ● Update Meter
  435.   #--------------------------------------------------------------------------         
  436.   def update_meter
  437.       return if @meter == nil
  438.       @meter.bitmap.clear ; range = @meter_cw * @duration[0] / @duration[1]
  439.       m_scr = Rect.new(0,0,range,@meter_ch )
  440.       @meter.bitmap.blt(0,0, @meter_image ,m_scr)
  441.   end
  442.   
  443.   #--------------------------------------------------------------------------
  444.   # ● Initialize
  445.   #--------------------------------------------------------------------------      
  446.   def create_skill_name
  447.       @skill_name = Sprite.new ; @skill_name.bitmap = Bitmap.new(200,32)
  448.       @skill_name.bitmap.font.size = CHAIN_WORD_FONT_SIZE
  449.       @skill_name.bitmap.font.color = CHAIN_WORD_FONT_COLOR
  450.       @skill_name.z = CHAIN_SPRITE_Z
  451.       @skill_name.y = @y - 32 + CHAIN_COMMAND_WORD_POSITION[1]
  452.       refresh_skill_name
  453.   end
  454.   
  455.   #--------------------------------------------------------------------------
  456.   # ● Refresh Skill Name
  457.   #--------------------------------------------------------------------------        
  458.   def refresh_skill_name
  459.       cm = @skillname.to_s.split(//).size
  460.       @center = ((200 / @skill_name.bitmap.font.size) * cm / 2) + 5
  461.       @org_x = @x - (@button_cw / 2) - 85 + CHAIN_COMMAND_WORD_POSITION[0]
  462.       @skill_name.x = @org_x - 50
  463.       @skill_name.bitmap.draw_text(0,0,200,32,@skillname.to_s,1)  
  464.   end
  465.       
  466.   #--------------------------------------------------------------------------
  467.   # ● Create Button Sprite
  468.   #--------------------------------------------------------------------------      
  469.   def create_button_sprite
  470.       @button_image = $game_temp.cache_active_chain[3]
  471.       @button_cw = @button_image.width / 13 ; @button_ch = @button_image.height
  472.       @button_sprite = Sprite.new
  473.       @button_sprite.bitmap = Bitmap.new(@button_cw,@button_ch)
  474.       @button_sprite.z = CHAIN_SPRITE_Z + 1
  475.       @button_sprite.ox = @button_cw / 2 ; @button_sprite.oy = @button_ch / 2
  476.       @button_sprite_oxy = [@button_sprite.ox,@button_sprite.oy]
  477.       @button_sprite.x = @x + @button_sprite.ox - (@button_cw / 2)
  478.       @button_sprite.y = @y + @button_sprite.oy      
  479.   end

  480.   #--------------------------------------------------------------------------
  481.   # ● Refresh Button Command
  482.   #--------------------------------------------------------------------------        
  483.   def refresh_button_command
  484.       return if @button_sprite == nil
  485.       @duration[0] = @duration[1]
  486.       command_list_check(@chain_command[@com_index])  
  487.       @button_sprite.bitmap.clear
  488.       button_scr = Rect.new(@com * @button_cw , 0,@button_cw,@button_ch)
  489.       @button_sprite.bitmap.blt(0,0,@button_image,button_scr)
  490.       @button_sprite.zoom_x = 1.3 ; @button_sprite.zoom_y = 1.3   
  491.       @button_sprite.opacity = 255
  492.   end
  493.   
  494.   #--------------------------------------------------------------------------
  495.   # ● Dispose
  496.   #--------------------------------------------------------------------------      
  497.   def dispose
  498.       dispose_button ; dispose_meter ; dispose_name ; dispose_icon_sprite
  499.       $game_temp.chain_actions[3] = false ; $game_temp.active_chain = false
  500.   end
  501.   
  502.   #--------------------------------------------------------------------------
  503.   # ● Dispose Icon Sprite
  504.   #--------------------------------------------------------------------------        
  505.   def dispose_icon_sprite
  506.       return if @icon_sprite == nil
  507.       @icon_sprite.bitmap.dispose ; @icon_sprite.dispose ; @icon_sprite = nil
  508.   end  
  509.   
  510.   #--------------------------------------------------------------------------
  511.   # ● Dispose Name
  512.   #--------------------------------------------------------------------------        
  513.   def dispose_name
  514.       return if @skill_name == nil
  515.       @skill_name.bitmap.dispose ; @skill_name.dispose ; @skill_name = nil
  516.   end
  517.   
  518.   #--------------------------------------------------------------------------
  519.   # ● Dispose Button
  520.   #--------------------------------------------------------------------------        
  521.   def dispose_button
  522.       return if @button_sprite == nil
  523.       @button_sprite.bitmap.dispose ; @button_sprite.dispose ; @button_sprite = nil
  524.   end
  525.   
  526.   #--------------------------------------------------------------------------
  527.   # ● Dispose Meter
  528.   #--------------------------------------------------------------------------         
  529.   def dispose_meter
  530.       return if @meter_layout == nil
  531.       @meter_layout.dispose ; @meter_layout = nil
  532.       @meter.bitmap.dispose ; @meter.dispose
  533.   end  
  534.   
  535.   #--------------------------------------------------------------------------
  536.   # ● Update
  537.   #--------------------------------------------------------------------------      
  538.   def update(battler)
  539.       if @initial_wait > 0
  540.          @initial_wait -= 1
  541.          if @initial_wait == 0
  542.             refresh_button_command ; @meter.visible = true
  543.             @meter_layout.visible = true        
  544.             set_opacity(0)
  545.          end
  546.          return  
  547.       end
  548.       if @wrong_commnad[0]
  549.          update_fade_command
  550.          return
  551.       else   
  552.          update_opacity         
  553.       end      
  554.       update_command ; update_sprite_button ; update_time ; update_meter
  555.       update_battle_camera if oxy_camera?(battler)
  556.   end

  557.   #--------------------------------------------------------------------------
  558.   # ● OXY_CAMERA
  559.   #--------------------------------------------------------------------------               
  560.   def oxy_camera?(battler)
  561.       return false if battler == nil
  562.       return false if $imported[:mog_battle_camera] == nil
  563.       if battler.is_a?(Game_Actor)
  564.          return false if $imported[:mog_battle_hud_ex] and SceneManager.face_battler?
  565.       end
  566.       return true
  567.   end  
  568.   
  569.   #--------------------------------------------------------------------------
  570.   # ● Update Battle Camera
  571.   #--------------------------------------------------------------------------               
  572.   def update_battle_camera
  573.       @meter_layout.ox = $game_temp.viewport_oxy[0]
  574.       @meter_layout.oy = $game_temp.viewport_oxy[1]
  575.       @meter.ox = $game_temp.viewport_oxy[0]
  576.       @meter.oy = $game_temp.viewport_oxy[1]
  577.       @skill_name.ox = $game_temp.viewport_oxy[0]
  578.       @skill_name.oy = $game_temp.viewport_oxy[1]
  579.       @button_sprite.ox = $game_temp.viewport_oxy[0] + @button_sprite_oxy[0]
  580.       @button_sprite.oy = $game_temp.viewport_oxy[1] + @button_sprite_oxy[1]
  581.       @icon_sprite.ox = $game_temp.viewport_oxy[0]
  582.       @icon_sprite.oy = $game_temp.viewport_oxy[1]
  583.   end  
  584.   
  585.   #--------------------------------------------------------------------------
  586.   # ● Set Opacity
  587.   #--------------------------------------------------------------------------         
  588.   def set_opacity(opc)
  589.       @meter_layout.opacity = opc
  590.       @meter.opacity = opc
  591.       @skill_name.opacity = opc
  592.       @button_sprite.opacity = opc
  593.       @icon_sprite.opacity = opc
  594.   end      
  595.   
  596.   #--------------------------------------------------------------------------
  597.   # ● Update Opacity
  598.   #--------------------------------------------------------------------------         
  599.   def update_opacity
  600.       @meter_layout.opacity += 75
  601.       @meter.opacity += 75
  602.       @skill_name.opacity += 75
  603.       @button_sprite.opacity += 75
  604.       @icon_sprite.opacity += 75
  605.   end   
  606.    
  607.   
  608.   #--------------------------------------------------------------------------
  609.   # ● Update Skill Name
  610.   #--------------------------------------------------------------------------         
  611.   def update_fade_command
  612.       fade_speed = 6
  613.       @skill_name.opacity -= fade_speed ; @meter.opacity -= fade_speed
  614.       @meter_layout.opacity -= fade_speed ; @icon_sprite.opacity -= fade_speed
  615.       @button_sprite.opacity -= fade_speed * 2 ; missed if @meter.opacity == 0
  616.   end
  617.   
  618.   #--------------------------------------------------------------------------
  619.   # ● Update Skill Name
  620.   #--------------------------------------------------------------------------        
  621.   def update_skill_name
  622.       return if @skill_name == nil
  623.       if @skill_name.x < @org_x
  624.          @skill_name.x += 3 ; @icon_sprite.x += 3
  625.          if @skill_name.x > @org_x
  626.             @skill_name.x = @org_x ; @icon_sprite.x = @org_x2
  627.          end   
  628.       end
  629.   end
  630.   
  631.   #--------------------------------------------------------------------------
  632.   # ● Update Time
  633.   #--------------------------------------------------------------------------
  634.   def update_time
  635.       return if @button_sprite == nil
  636.       @duration[0] -= 1 if @duration[0] > 0
  637.       wrong_command(1) if @duration[0] == 0
  638.   end
  639.   
  640.   #--------------------------------------------------------------------------
  641.   # ● Update Sprite Button
  642.   #--------------------------------------------------------------------------        
  643.   def update_sprite_button
  644.       return if @button_sprite == nil
  645.       if @button_sprite.zoom_x > 1.00
  646.          @button_sprite.zoom_x -= 0.05
  647.          @button_sprite.zoom_x = 1.00 if @button_sprite.zoom_x < 1.00
  648.       end
  649.       @button_sprite.zoom_y = @button_sprite.zoom_x
  650.   end  

  651. #--------------------------------------------------------------------------
  652. # ● Update Command
  653. #--------------------------------------------------------------------------      
  654. def update_command
  655.      if Input.trigger?(:X) ; check_command(0)
  656.      elsif Input.trigger?(:Z) ; check_command(1)
  657.      elsif Input.trigger?(:Y) ; check_command(2)
  658.      elsif Input.trigger?(:A) ; check_command(3)
  659.      elsif Input.trigger?(:C) ; check_command(4)
  660.      elsif Input.trigger?(:B) ; check_command(5)
  661.      elsif Input.trigger?(:L) ; check_command(6)
  662.      elsif Input.trigger?(:R) ; check_command(7)        
  663.      elsif Input.trigger?(:RIGHT) ; check_command(8)
  664.      elsif Input.trigger?(:LEFT) ; check_command(9)
  665.      elsif Input.trigger?(:DOWN) ; check_command(10)
  666.      elsif Input.trigger?(:UP) ; check_command(11)
  667.      end   
  668. end  
  669.    
  670. #--------------------------------------------------------------------------
  671. # ● command_list_check
  672. #--------------------------------------------------------------------------      
  673. def command_list_check(command)
  674.      case command
  675.          when "A" ; @com = 0  
  676.          when "D" ; @com = 1  
  677.          when "S" ; @com = 2
  678.          when "Shift" ; @com = 3
  679.          when "Z" ; @com = 4
  680.          when "X" ; @com = 5
  681.          when "Q" ; @com = 6
  682.          when "W" ; @com = 7            
  683.          when "Right" ; @com = 8
  684.          when "Left" ;  @com = 9
  685.          when "Down" ;  @com = 10
  686.          when "Up"  ;   @com = 11         
  687.          else ; @com = 12           
  688.      end
  689. end   

  690. #--------------------------------------------------------------------------
  691. # ● check_command
  692. #--------------------------------------------------------------------------            
  693. def check_command(com)
  694.      if com != -1
  695.         right_input = false
  696.         @chain_command.each_with_index do |i, index|
  697.            if index == @com_index
  698.               command_list_check(i) ; right_input = true if @com == com
  699.            end         
  700.         end
  701.      else  
  702.        command_list_check(@com_index) ; right_input = true
  703.      end  
  704.      if right_input
  705.         next_command
  706.      else  
  707.         wrong_command(0)
  708.      end  
  709. end  
  710.    
  711. #--------------------------------------------------------------------------
  712. # ● Next Command
  713. #--------------------------------------------------------------------------            
  714. def next_command
  715.      @com_index += 1   
  716.      Audio.se_play("Audio/SE/" + CHAIN_RIGHT_SE, 100, 100)
  717.      if @com_index == @chain_command.size
  718.         @phase = 9 ; @success = true
  719.         return
  720.      end  
  721.      refresh_button_command
  722. end     

  723. #--------------------------------------------------------------------------
  724. # ● wrong_command
  725. #--------------------------------------------------------------------------              
  726. def wrong_command(type = 0)
  727.      @wrong_commnad[0] = true ; @wrong_commnad[1] = type
  728.      @skill_name.bitmap.clear
  729.      Audio.se_play("Audio/SE/" + CHAIN_WRONG_SE, 100, 100)        
  730.      wname = type == 0 ? CHAIN_MISSED_WORDS[0] : CHAIN_MISSED_WORDS[1]
  731.      @skill_name.bitmap.draw_text(0,0,200,32,wname.to_s,1)
  732. end     
  733.   
  734. #--------------------------------------------------------------------------
  735. # ● missed
  736. #--------------------------------------------------------------------------               
  737. def missed
  738.      @success = false  ; @phase = 9  
  739. end

  740. end
复制代码
梦石
0
星屑
1736
在线时间
761 小时
注册时间
2013-9-23
回帖
180

开拓者

发表于 2019-1-20 05:32:04 | 显示全部楼层
仅仅备注了还不够,脚本内也需要设置。
技能ID => [上下左右之类的按键],
具体参考脚本中类似的部分,比如59至71行。
设置请在58行的 CHAIN_ACTIONS = {  和72行的  } 之间进行,技能id别重复了。
回复

使用道具 举报

梦石
10
星屑
39550
在线时间
1919 小时
注册时间
2010-11-14
回帖
3214

R考场第七期纪念奖

发表于 2019-1-20 11:35:57 | 显示全部楼层
Chain Action看英文就知道是技能一招连一招,所以技能中要设置好下一招是什么
除此之外,还要在脚本中设置某一招被连上时要求的输入。

上面的中文解释应该是和MOG的另一个脚本Blitz_Command弄混了。

评分

参与人数 1星屑 +20 收起 理由
VIPArcher + 20 认可答案

查看全部评分

用头画头像,用脚写脚本
回复 1 0

使用道具 举报

梦石
0
星屑
1014
在线时间
120 小时
注册时间
2018-4-7
回帖
13
 楼主| 发表于 2019-1-22 19:59:20 | 显示全部楼层
KB.Driver 发表于 2019-1-20 11:35
Chain Action看英文就知道是技能一招连一招,所以技能中要设置好下一招是什么
除此之外,还要在脚本中设置 ...

啊,感谢大大,怪不得我用另一个出现的是这个脚本的效果。
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部