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

Project1

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

[已经解决] 如何设置连发技能。

[复制链接]

Lv3.寻梦者

虚空人形

梦石
0
星屑
4604
在线时间
2037 小时
注册时间
2011-8-11
帖子
3398

贵宾

跳转到指定楼层
1
发表于 2012-3-6 12:20:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
        RT,假设我一个战斗中发动一个指定技能,这个技能发动结束后自动发动另一个指定技能,
本来我使用公共事件,但发现这样会有时间间隔,我想让两个技能连发该怎么做?

Lv1.梦旅人

梦石
0
星屑
154
在线时间
664 小时
注册时间
2011-9-25
帖子
241
2
发表于 2012-3-7 12:02:20 | 只看该作者
PHP 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Active Chain Skills v1.01
  4. # -- Last Updated: 2011.12.22
  5. # -- Level: Hard
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-ActiveChainSkills"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2011.12.22 - Better updating speed for window.
  17. # 2011.12.18 - Started Script and Finished.
  18. #
  19. #==============================================================================
  20. # ▼ Introduction
  21. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  22. # This script enables the usage of Active Chain Skills. When a skill with any
  23. # potential chain skill occurs, potentially chainable skills will be listed on
  24. # the side of the screen and if the player presses the right button to trigger
  25. # that chain skill, the battler's next action will lead into the next chain
  26. # skill. Chain skills can only be used by actors and can be endlessly chained
  27. # until either the actor runs out of skill cost resources or until the actor
  28. # performs a chained skill without any skills to chain off of.
  29. #
  30. #==============================================================================
  31. # ▼ Instructions
  32. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  33. # To install this script, open up your script editor and copy/paste this script
  34. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  35. #
  36. # -----------------------------------------------------------------------------
  37. # Skill Notetags - These notetags go in the skill notebox in the database.
  38. # -----------------------------------------------------------------------------
  39. # <chain skill L: x>
  40. # <chain skill R: x>
  41. # <chain skill X: x>
  42. # <chain skill Y: x>
  43. # <chain skill Z: x>
  44. # Makes the skill with these notetags to become potentially chainable. Replace
  45. # x with the ID of the skill you want the button to cause the skill to chain.
  46. # Note that if the actor has not learned the chain skill, the chain skill will
  47. # not be listed. If the actor has learned the chain skill but lacks resources
  48. # to use it, it will be greyed out.
  49. #
  50. # <chain only>
  51. # This makes the skill usable only if it's used in a chain. This effect does
  52. # not affect monsters. Chain only skills can still be unusable if the user does
  53. # not meet the skill's other requirements. This means that the skill will be
  54. # disabled in the skill window when you try to actively use it from the window.
  55. #
  56. #==============================================================================
  57. # ▼ Compatibility
  58. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  59. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  60. # it will run with RPG Maker VX without adjusting.
  61. #
  62. # While this script doesn't interfere with Input Combo Skills, it will most
  63. # likely be unable to used in conjunction with Input Combo Skills. I will not
  64. # provide support for any errors that may occur from this, nor will I be
  65. # responsible for any damage doing this may cause your game.
  66. #
  67. #==============================================================================
  68.  
  69. module YEA
  70.   module ACTIVE_CHAIN
  71.  
  72.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  73.     # - Chain Skill Settings -
  74.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  75.     # Adjust general settings here. These settings adjust the sound effect
  76.     # played when an active skill is selected and what the minimum time window
  77.     # is for an active chain skill.
  78.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  79.     # This will be the sound effect played whenever an active chain skill has
  80.     # been selected for chaining.
  81.     ACTIVE_SKILL_SOUND = RPG::SE.new("Skill2", 80, 100)
  82.  
  83.     # How many frames minimum for chain allowance. Sometimes the battlelog
  84.     # window will move too fast for the player to be able to chain. This sets
  85.     # a minimum timer for how long the chain window will stay open.
  86.     MINIMUM_TIME = 120
  87.  
  88.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  89.     # - Chain Skill Text -
  90.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  91.     # This section adjusts the text that appears for the chain skills. Adjust
  92.     # the text to appear as you see fit. Note that the vocab other than the
  93.     # title can use text codes.
  94.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  95.     CHAIN_TITLE  = "Active Chain Skills"
  96.     TITLE_SIZE   = 20
  97.     L_SKILL_ON   = "\eC[17]Q\eC[0]Chain: "
  98.     L_SKILL_OFF  = "\eC[7]QChain: "
  99.     L_SKILL_ACT  = "\eC[17]QChain: "
  100.     R_SKILL_ON   = "\eC[17]W\eC[0]Chain: "
  101.     R_SKILL_OFF  = "\eC[7]WChain: "
  102.     R_SKILL_ACT  = "\eC[17]WChain: "
  103.     X_SKILL_ON   = "\eC[17]A\eC[0]ttack: "
  104.     X_SKILL_OFF  = "\eC[7]Attack: "
  105.     X_SKILL_ACT  = "\eC[17]Attack: "
  106.     Y_SKILL_ON   = "\eC[17]S\eC[0]trike: "
  107.     Y_SKILL_OFF  = "\eC[7]Strike: "
  108.     Y_SKILL_ACT  = "\eC[17]Strike: "
  109.     Z_SKILL_ON   = "\eC[17]D\eC[0]efend: "
  110.     Z_SKILL_OFF  = "\eC[7]Defend: "
  111.     Z_SKILL_ACT  = "\eC[17]Defend: "
  112.  
  113.   end # ACTIVE_CHAIN
  114. end # YEA
  115.  
  116. #==============================================================================
  117. # ▼ Editting anything past this point may potentially result in causing
  118. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  119. # halitosis so edit at your own risk.
  120. #==============================================================================
  121.  
  122. module YEA
  123.   module REGEXP
  124.   module SKILL
  125.  
  126.     CHAIN_ONLY  = /<(?:CHAIN_ONLY|chain only)>/i
  127.     CHAIN_SKILL = /<(?:CHAIN_SKILL|chain skill)[ ]([LRXYZ]):[ ](\d+)>/i
  128.  
  129.   end # SKILL
  130.   end # REGEXP
  131. end # YEA
  132.  
  133. #==============================================================================
  134. # ■ DataManager
  135. #==============================================================================
  136.  
  137. module DataManager
  138.  
  139.   #--------------------------------------------------------------------------
  140.   # alias method: load_database
  141.   #--------------------------------------------------------------------------
  142.   class <<self; alias load_database_acs load_database; end
  143.   def self.load_database
  144.     load_database_acs
  145.     load_notetags_acs
  146.   end
  147.  
  148.   #--------------------------------------------------------------------------
  149.   # new method: load_notetags_acs
  150.   #--------------------------------------------------------------------------
  151.   def self.load_notetags_acs
  152.     for skill in $data_skills
  153.       next if skill.nil?
  154.       skill.load_notetags_acs
  155.     end
  156.   end
  157.   
  158. end # DataManager
  159.  
  160. #==============================================================================
  161. # ■ RPG::Skill
  162. #==============================================================================
  163.  
  164. class RPG::Skill < RPG::UsableItem
  165.  
  166.   #--------------------------------------------------------------------------
  167.   # public instance variables
  168.   #--------------------------------------------------------------------------
  169.   attr_accessor :chain_only
  170.   attr_accessor :chain_skill
  171.  
  172.   #--------------------------------------------------------------------------
  173.   # common cache: load_notetags_acs
  174.   #--------------------------------------------------------------------------
  175.   def load_notetags_acs
  176.     @chain_only = false
  177.     @chain_skill = {}
  178.     #---
  179.     self.note.split(/[\r\n]+/).each { |line|
  180.       case line
  181.       #---
  182.       when YEA::REGEXP::SKILL::CHAIN_ONLY
  183.         @chain_only = true
  184.       when YEA::REGEXP::SKILL::CHAIN_SKILL
  185.         case $1.upcase
  186.         when "L"; @chain_skill[:L] = $2.to_i
  187.         when "R"; @chain_skill[:R] = $2.to_i
  188.         when "X"; @chain_skill[:X] = $2.to_i
  189.         when "Y"; @chain_skill[:Y] = $2.to_i
  190.         when "Z"; @chain_skill[:Z] = $2.to_i
  191.         else; next
  192.         end
  193.       #---
  194.       end
  195.     } # self.note.split
  196.     #---
  197.   end
  198.  
  199. end # RPG::UsableItem
  200.  
  201. #==============================================================================
  202. # ■ Game_Action
  203. #==============================================================================
  204.  
  205. class Game_Action
  206.  
  207.   #--------------------------------------------------------------------------
  208.   # new method: set_active_chain_skill
  209.   #--------------------------------------------------------------------------
  210.   def set_active_chain_skill(skill_id)
  211.     set_skill(skill_id)
  212.     @target_index = subject.current_action.target_index
  213.     @active_chain_skill = true
  214.   end
  215.  
  216.   #--------------------------------------------------------------------------
  217.   # alias method: valid?
  218.   #--------------------------------------------------------------------------
  219.   alias game_action_valid_acs valid?
  220.   def valid?
  221.     subject.enable_active_chain(true) if @active_chain_skill
  222.     result = game_action_valid_acs
  223.     subject.enable_active_chain(false) if @active_chain_skill
  224.     return result
  225.   end
  226.  
  227. end # Game_Action
  228.  
  229. #==============================================================================
  230. # ■ Game_BattlerBase
  231. #==============================================================================
  232.  
  233. class Game_BattlerBase
  234.  
  235.   #--------------------------------------------------------------------------
  236.   # alias method: skill_conditions_met?
  237.   #--------------------------------------------------------------------------
  238.   alias game_battlerbase_skill_conditions_met_acs skill_conditions_met?
  239.   def skill_conditions_met?(skill)
  240.     return false if chain_skill_restriction?(skill)
  241.     return game_battlerbase_skill_conditions_met_acs(skill)
  242.   end
  243.  
  244.   #--------------------------------------------------------------------------
  245.   # new method: chain_skill_restriction?
  246.   #--------------------------------------------------------------------------
  247.   def chain_skill_restriction?(skill)
  248.     return false unless actor?
  249.     return false unless $game_party.in_battle
  250.     return false unless skill.chain_only
  251.     return !@active_chain_enabled
  252.   end
  253.  
  254.   #--------------------------------------------------------------------------
  255.   # alias method: hp=
  256.   #--------------------------------------------------------------------------
  257.   alias game_battlerbase_hpequals_acs hp=
  258.   def hp=(value)
  259.     game_battlerbase_hpequals_acs(value)
  260.     return unless SceneManager.scene_is?(Scene_Battle)
  261.     return unless actor?
  262.     return if value == 0
  263.     SceneManager.scene.refresh_active_chain_skill_window(self)
  264.   end
  265.  
  266.   #--------------------------------------------------------------------------
  267.   # alias method: mp=
  268.   #--------------------------------------------------------------------------
  269.   alias game_battlerbase_mpequals_acs mp=
  270.   def mp=(value)
  271.     game_battlerbase_mpequals_acs(value)
  272.     return unless SceneManager.scene_is?(Scene_Battle)
  273.     return unless actor?
  274.     return if value == 0
  275.     SceneManager.scene.refresh_active_chain_skill_window(self)
  276.   end
  277.  
  278.   #--------------------------------------------------------------------------
  279.   # alias method: tp=
  280.   #--------------------------------------------------------------------------
  281.   alias game_battlerbase_tpequals_acs tp=
  282.   def tp=(value)
  283.     game_battlerbase_tpequals_acs(value)
  284.     return unless SceneManager.scene_is?(Scene_Battle)
  285.     return unless actor?
  286.     return if value == 0
  287.     SceneManager.scene.refresh_active_chain_skill_window(self)
  288.   end
  289.  
  290. end # Game_BattlerBase
  291.  
  292. #==============================================================================
  293. # ■ Game_Battler
  294. #==============================================================================
  295.  
  296. class Game_Battler < Game_BattlerBase
  297.  
  298.   #--------------------------------------------------------------------------
  299.   # alias method: on_battle_start
  300.   #--------------------------------------------------------------------------
  301.   alias game_battler_on_battle_start_acs on_battle_start
  302.   def on_battle_start
  303.     game_battler_on_battle_start_acs
  304.     @active_chain_enabled = false
  305.   end
  306.  
  307.   #--------------------------------------------------------------------------
  308.   # alias method: on_battle_end
  309.   #--------------------------------------------------------------------------
  310.   alias game_battler_on_battle_end_acs on_battle_end
  311.   def on_battle_end
  312.     game_battler_on_battle_end_acs
  313.     @active_chain_enabled = false
  314.   end
  315.  
  316.   #--------------------------------------------------------------------------
  317.   # new method: enable_active_chain
  318.   #--------------------------------------------------------------------------
  319.   def enable_active_chain(active)
  320.     return unless actor?
  321.     @active_chain_enabled = active
  322.   end
  323.  
  324.   #--------------------------------------------------------------------------
  325.   # new method: add_active_skill_chain
  326.   #--------------------------------------------------------------------------
  327.   def add_active_skill_chain(skill_id)
  328.     chain_skill = Game_Action.new(self)
  329.     chain_skill.set_active_chain_skill(skill_id)
  330.     @actions.insert(1, chain_skill)
  331.   end
  332.  
  333. end # Game_Battler
  334.  
  335. #==============================================================================
  336. # ■ Window_ChainSkillList
  337. #==============================================================================
  338.  
  339. class Window_ChainSkillList < Window_Base
  340.  
  341.   #--------------------------------------------------------------------------
  342.   # initialize
  343.   #--------------------------------------------------------------------------
  344.   def initialize
  345.     dw = [Graphics.width/2, 320].max
  346.     super(-standard_padding, 0, dw, fitting_height(6))
  347.     self.z = 200
  348.     self.opacity = 0
  349.     hide
  350.   end
  351.  
  352.   #--------------------------------------------------------------------------
  353.   # reveal
  354.   #--------------------------------------------------------------------------
  355.   def reveal(battler, skill)
  356.     @battler = battler
  357.     @skill = skill
  358.     @chain_skills = []
  359.     for key in skill.chain_skill
  360.       next if key[1].nil?
  361.       next if $data_skills[key[1]].nil?
  362.       next unless @battler.skills.include?($data_skills[key[1]])
  363.       @chain_skills.push($data_skills[key[1]])
  364.     end
  365.     return if @chain_skills == []
  366.     self.y = Graphics.height - fitting_height(4)
  367.     self.y -= fitting_height(@chain_skills.size + 1)
  368.     show
  369.     activate
  370.     @enabled = true
  371.     refresh
  372.   end
  373.  
  374.   #--------------------------------------------------------------------------
  375.   # button=
  376.   #--------------------------------------------------------------------------
  377.   def button=(button)
  378.     @button = button
  379.     @enabled = false
  380.     refresh unless @button.nil?
  381.   end
  382.  
  383.   #--------------------------------------------------------------------------
  384.   # refresh_check
  385.   #--------------------------------------------------------------------------
  386.   def refresh_check(battler)
  387.     return if @battler != battler
  388.     refresh
  389.   end
  390.  
  391.   #--------------------------------------------------------------------------
  392.   # refresh
  393.   #--------------------------------------------------------------------------
  394.   def refresh
  395.     @button = nil if @enabled
  396.     contents.clear
  397.     draw_background_colour
  398.     draw_horz_line(0)
  399.     draw_combo_title
  400.     draw_chain_skills
  401.   end
  402.  
  403.   #--------------------------------------------------------------------------
  404.   # draw_background_colour
  405.   #--------------------------------------------------------------------------
  406.   def draw_background_colour
  407.     dh = line_height * (@chain_skills.size + 1)
  408.     rect = Rect.new(0, 0, contents.width, dh)
  409.     back_colour1 = Color.new(0, 0, 0, 192)
  410.     back_colour2 = Color.new(0, 0, 0, 0)
  411.     contents.gradient_fill_rect(rect, back_colour1, back_colour2)
  412.   end
  413.  
  414.   #--------------------------------------------------------------------------
  415.   # draw_horz_line
  416.   #--------------------------------------------------------------------------
  417.   def draw_horz_line(dy)
  418.     line_y = dy + line_height - 2
  419.     line_colour = normal_color
  420.     line_colour.alpha = 48
  421.     contents.fill_rect(0, line_y, contents.width, 2, line_colour)
  422.   end
  423.  
  424.   #--------------------------------------------------------------------------
  425.   # draw_combo_title
  426.   #--------------------------------------------------------------------------
  427.   def draw_combo_title
  428.     reset_font_settings
  429.     text = YEA::ACTIVE_CHAIN::CHAIN_TITLE
  430.     contents.font.size = YEA::ACTIVE_CHAIN::TITLE_SIZE
  431.     contents.font.bold = true
  432.     contents.font.italic = true
  433.     draw_text(12, 0, contents.width - 12, line_height, text)
  434.     reset_font_settings
  435.   end
  436.  
  437.   #--------------------------------------------------------------------------
  438.   # draw_chain_skills
  439.   #--------------------------------------------------------------------------
  440.   def draw_chain_skills
  441.     button_array = [:L, :R, :X, :Y, :Z]
  442.     dx = 24
  443.     dy = line_height
  444.     for button in button_array
  445.       next if @skill.chain_skill[button].nil?
  446.       chain_skill = $data_skills[@skill.chain_skill[button]]
  447.       next unless @battler.skills.include?(chain_skill)
  448.       text = text_setting(button, chain_skill)
  449.       text += sprintf("\eI[%d]", chain_skill.icon_index)
  450.       text += chain_skill.name
  451.       draw_text_ex(dx, dy, text)
  452.       dy += line_height
  453.     end
  454.   end
  455.  
  456.   #--------------------------------------------------------------------------
  457.   # text_setting
  458.   #--------------------------------------------------------------------------
  459.   def text_setting(button, skill)
  460.     active = button == @button
  461.     text = ""
  462.     case button
  463.     when :L
  464.       if @enabled && @battler.usable?(skill)
  465.         text = YEA::ACTIVE_CHAIN::L_SKILL_ON
  466.       elsif !@enabled && active
  467.         text = YEA::ACTIVE_CHAIN::L_SKILL_ACT
  468.       else
  469.         text = YEA::ACTIVE_CHAIN::L_SKILL_OFF
  470.       end
  471.     when :R
  472.       if @enabled && @battler.usable?(skill)
  473.         text = YEA::ACTIVE_CHAIN::R_SKILL_ON
  474.       elsif !@enabled && active
  475.         text = YEA::ACTIVE_CHAIN::R_SKILL_ACT
  476.       else
  477.         text = YEA::ACTIVE_CHAIN::R_SKILL_OFF
  478.       end
  479.     when :X
  480.       if @enabled && @battler.usable?(skill)
  481.         text = YEA::ACTIVE_CHAIN::X_SKILL_ON
  482.       elsif !@enabled && active
  483.         text = YEA::ACTIVE_CHAIN::X_SKILL_ACT
  484.       else
  485.         text = YEA::ACTIVE_CHAIN::X_SKILL_OFF
  486.       end
  487.     when :Y
  488.       if @enabled && @battler.usable?(skill)
  489.         text = YEA::ACTIVE_CHAIN::Y_SKILL_ON
  490.       elsif !@enabled && active
  491.         text = YEA::ACTIVE_CHAIN::Y_SKILL_ACT
  492.       else
  493.         text = YEA::ACTIVE_CHAIN::Y_SKILL_OFF
  494.       end
  495.     when :Z
  496.       if @enabled && @battler.usable?(skill)
  497.         text = YEA::ACTIVE_CHAIN::Z_SKILL_ON
  498.       elsif !@enabled && active
  499.         text = YEA::ACTIVE_CHAIN::Z_SKILL_ACT
  500.       else
  501.         text = YEA::ACTIVE_CHAIN::Z_SKILL_OFF
  502.       end
  503.     end
  504.     return text
  505.   end
  506.   
  507. end # Window_ChainSkillList
  508.  
  509. #==============================================================================
  510. # ■ Scene_Battle
  511. #==============================================================================
  512.  
  513. class Scene_Battle < Scene_Base
  514.  
  515.   #--------------------------------------------------------------------------
  516.   # alias method: create_all_windows
  517.   #--------------------------------------------------------------------------
  518.   alias scene_battle_create_all_windows_acs create_all_windows
  519.   def create_all_windows
  520.     scene_battle_create_all_windows_acs
  521.     create_chain_skill_window
  522.   end
  523.  
  524.   #--------------------------------------------------------------------------
  525.   # new method: create_chain_skill_window
  526.   #--------------------------------------------------------------------------
  527.   def create_chain_skill_window
  528.     @active_chain_skill_window = Window_ChainSkillList.new
  529.     @active_chain_skill_counter = 0
  530.   end
  531.  
  532.   #--------------------------------------------------------------------------
  533.   # alias method: use_item
  534.   #--------------------------------------------------------------------------
  535.   alias scene_battle_use_item_acs use_item
  536.   def use_item
  537.     @subject.enable_active_chain(true)
  538.     item = @subject.current_action.item
  539.     chain_skill_list_appear(true, item)
  540.     start_active_skill_counter(item)
  541.     scene_battle_use_item_acs
  542.     wait_active_skill_counter
  543.     chain_skill_list_appear(false, item)
  544.     @subject.enable_active_chain(false)
  545.   end
  546.  
  547.   #--------------------------------------------------------------------------
  548.   # new method: chain_skill_list_appear
  549.   #--------------------------------------------------------------------------
  550.   def chain_skill_list_appear(visible, skill)
  551.     return if @subject.nil?
  552.     return unless @subject.actor?
  553.     return unless skill.is_a?(RPG::Skill)
  554.     @active_chain_skill = 0
  555.     @current_chain_skill = skill
  556.     @active_chain_skill_window.reveal(@subject, skill) if visible
  557.     @active_chain_skill_window.hide unless visible
  558.   end
  559.  
  560.   #--------------------------------------------------------------------------
  561.   # new method: refresh_active_chain_skill_window
  562.   #--------------------------------------------------------------------------
  563.   def refresh_active_chain_skill_window(battler)
  564.     return unless @active_chain_skill_window.visible
  565.     @active_chain_skill_window.refresh_check(battler)
  566.   end
  567.  
  568.   #--------------------------------------------------------------------------
  569.   # new method: start_active_skill_counter
  570.   #--------------------------------------------------------------------------
  571.   def start_active_skill_counter(skill)
  572.     return unless @active_chain_skill_window.visible
  573.     @active_chain_skill_counter = YEA::ACTIVE_CHAIN::MINIMUM_TIME
  574.   end
  575.  
  576.   #--------------------------------------------------------------------------
  577.   # new method: wait_active_skill_counter
  578.   #--------------------------------------------------------------------------
  579.   def wait_active_skill_counter
  580.     return unless @active_chain_skill_window.visible
  581.     wait(@active_chain_skill_counter)
  582.   end
  583.  
  584.   #--------------------------------------------------------------------------
  585.   # new method: update_active_chain_skill_counter
  586.   #--------------------------------------------------------------------------
  587.   def update_active_chain_skill_counter
  588.     return if @active_chain_skill_counter == 0
  589.     @active_chain_skill_counter -= 1
  590.   end
  591.  
  592.   #--------------------------------------------------------------------------
  593.   # alias method: update_basic
  594.   #--------------------------------------------------------------------------
  595.   alias scene_battle_update_basic_acs update_basic
  596.   def update_basic
  597.     scene_battle_update_basic_acs
  598.     update_active_chain_skill_counter
  599.     update_active_chain_skill_select
  600.   end
  601.  
  602.   #--------------------------------------------------------------------------
  603.   # new method: update_active_chain_skill_select
  604.   #--------------------------------------------------------------------------
  605.   def update_active_chain_skill_select
  606.     return unless @active_chain_skill_window.visible
  607.     return if @active_chain_skill > 0
  608.     if Input.press?(:L)
  609.       check_active_chain_skill(:L)
  610.     elsif Input.press?(:R)
  611.       check_active_chain_skill(:R)
  612.     elsif Input.press?(:X)
  613.       check_active_chain_skill(:X)
  614.     elsif Input.press?(:Y)
  615.       check_active_chain_skill(:Y)
  616.     elsif Input.press?(:Z)
  617.       check_active_chain_skill(:Z)
  618.     end
  619.   end
  620.  
  621.   #--------------------------------------------------------------------------
  622.   # new method: check_active_chain_skill
  623.   #--------------------------------------------------------------------------
  624.   def check_active_chain_skill(button)
  625.     skill_id = @current_chain_skill.chain_skill[button]
  626.     return if skill_id.nil?
  627.     return if $data_skills[skill_id].nil?
  628.     chain_skill = $data_skills[skill_id]
  629.     return unless @subject.usable?(chain_skill)
  630.     return unless @subject.skills.include?(chain_skill)
  631.     @active_chain_skill_counter = 12
  632.     @active_chain_skill = skill_id
  633.     @active_chain_skill_window.button = button
  634.     YEA::ACTIVE_CHAIN::ACTIVE_SKILL_SOUND.play
  635.     @subject.add_active_skill_chain(skill_id)
  636.   end
  637.  
  638. end # Scene_Battle
  639.  
  640. #==============================================================================
  641. #
  642. # ▼ End of File
  643. #
  644. #==============================================================================
回复

使用道具 举报

Lv3.寻梦者

虚空人形

梦石
0
星屑
4604
在线时间
2037 小时
注册时间
2011-8-11
帖子
3398

贵宾

3
 楼主| 发表于 2012-3-7 12:11:28 | 只看该作者
xuzhengchi 发表于 2012-3-7 12:02
#==============================================================================
#
# ▼ Yanfly Engin ...

脚本注释翻译后我基本看了,但还不明白怎么用。
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
154
在线时间
664 小时
注册时间
2011-9-25
帖子
241
4
发表于 2012-3-7 13:13:42 | 只看该作者
本帖最后由 xuzhengchi 于 2012-3-7 13:17 编辑
hcm 发表于 2012-3-7 12:11
脚本注释翻译后我基本看了,但还不明白怎么用。


PHP 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Follow-Up Skill v1.01
  4. # -- Last Updated: 2012.02.12
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-FollowUpSkill"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.02.12 - Bug Fixed: Follow Up skills do not stack with multi-hits.
  17. # 2012.02.05 - Started Script and Finished.
  18. #
  19. #==============================================================================
  20. # ▼ Introduction
  21. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  22. # This script allows for follow-up skills when the skill lands a successful hit
  23. # (ie. no misses or evades). The script provides a chance to proceed with a
  24. # follow-up skill or a guaranteed follow-up skill provided that the prior skill
  25. # has successfully connected.
  26. #
  27. #==============================================================================
  28. # ▼ Instructions
  29. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  30. # To install this script, open up your script editor and copy/paste this script
  31. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  32. #
  33. # -----------------------------------------------------------------------------
  34. # Skill Notetags - These notetags go in the skill notebox in the database.
  35. # -----------------------------------------------------------------------------
  36. # <follow up x>
  37. # This causes the skill x to have a 100% chance of a follow-up upon usage of
  38. # the current skill and the current skill landing a successful hit.
  39. #
  40. # <follow up x: y%>
  41. # This causes the skill x to have y% chance of a follow-up upon usage of the
  42. # current skill and the current skill landing a successful hit.
  43. #
  44. # <follow up state: x>
  45. # <follow up all states: x, x>
  46. # This causes the follow-up skill to require all of the states x to follow-up.
  47. # If one state is missing, the follow-up skill will not occur. To add in more
  48. # states required, insert multiples of this notetag.
  49. #
  50. # <follow up any states: x, x>
  51. # This causes the follow-up skill to require at least one of the listed states
  52. # x to follow-up. If all states are missing, the follow-up skill will not
  53. # occur. To add in more states required, insert multiples of this notetag.
  54. #
  55. # <follow up switch: x>
  56. # <follow up all switch: x, x>
  57. # This causes the follow-up skill to require all switches x to be ON before the
  58. # skill will follow-up. If one switch is OFF, the follow-up skill will not
  59. # occur. To add in more switches required, insert multiples of this notetag.
  60. #
  61. # <follow up any switch: x, x>
  62. # This causes the follow-up skill to require at least one of the listed
  63. # switches to be ON before the the follow-up skill will occur. If all switches
  64. # are off, the follow-up skill will not occur. To add in more switches required
  65. # insert multiples of this notetag.
  66. #
  67. # <follow up eval>
  68. #  string
  69. #  string
  70. # </follow up eval>
  71. # For the more advanced users, replace string with code to determine whether
  72. # or not the skill will follow-up. If multiple lines are used, they are all
  73. # considered part of the same line.
  74. #
  75. #==============================================================================
  76. # ▼ Compatibility
  77. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  78. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  79. # it will run with RPG Maker VX without adjusting.
  80. #
  81. #==============================================================================
  82. # ▼ Editting anything past this point may potentially result in causing
  83. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  84. # halitosis so edit at your own risk.
  85. #==============================================================================
  86.  
  87. module YEA
  88.   module REGEXP
  89.   module SKILL
  90.  
  91.     FOLLOWUP = /<(?:FOLLOW_UP|follow up)[ ](\d+)>/i
  92.     FOLLOWUP_CHANCE = /<(?:FOLLOW_UP|follow up)[ ](\d+):[ ](\d+)([%%])>/i
  93.     FOLLOWUP_STATES =
  94.       /<(?:FOLLOW_UP_STATE|follow up state):[ ](\d+(?:\s*,\s*\d+)*)>/i
  95.     FOLLOWUP_ALL_STATES =
  96.       /<(?:FOLLOW_UP_ALL_STATES|follow up all states):[ ](\d+(?:\s*,\s*\d+)*)>/i
  97.     FOLLOWUP_ANY_STATES =
  98.       /<(?:FOLLOW_UP_ANY_STATES|follow up any states):[ ](\d+(?:\s*,\s*\d+)*)>/i
  99.     FOLLOWUP_SWITCH =
  100.       /<(?:FOLLOW_UP_SWITCH|follow up switch):[ ](\d+(?:\s*,\s*\d+)*)>/i
  101.     FOLLOWUP_ALL_SWITCH =
  102.       /<(?:FOLLOW_UP_ALL_SWITCH|follow up all switch):[ ](\d+(?:\s*,\s*\d+)*)>/i
  103.     FOLLOWUP_ANY_SWITCH =
  104.       /<(?:FOLLOW_UP_ANY_SWITCH|follow up any switch):[ ](\d+(?:\s*,\s*\d+)*)>/i
  105.     FOLLOWUP_EVAL_ON = /<(?:FOLLOW_UP_EVAL|follow up eval)>/i
  106.     FOLLOWUP_EVAL_OFF = /<\/(?:FOLLOW_UP_EVAL|follow up eval)>/i
  107.  
  108.   end # SKILL
  109.   end # REGEXP
  110. end # YEA
  111.  
  112. #==============================================================================
  113. # ■ DataManager
  114. #==============================================================================
  115.  
  116. module DataManager
  117.  
  118.   #--------------------------------------------------------------------------
  119.   # alias method: load_database
  120.   #--------------------------------------------------------------------------
  121.   class <<self; alias load_database_fus load_database; end
  122.   def self.load_database
  123.     load_database_fus
  124.     load_notetags_fus
  125.   end
  126.  
  127.   #--------------------------------------------------------------------------
  128.   # new method: load_notetags_fus
  129.   #--------------------------------------------------------------------------
  130.   def self.load_notetags_fus
  131.     for obj in $data_skills
  132.       next if obj.nil?
  133.       obj.load_notetags_fus
  134.     end
  135.   end
  136.   
  137. end # DataManager
  138.  
  139. #==============================================================================
  140. # ■ RPG::BaseItem
  141. #==============================================================================
  142.  
  143. class RPG::Skill < RPG::UsableItem
  144.  
  145.   #--------------------------------------------------------------------------
  146.   # public instance variables
  147.   #--------------------------------------------------------------------------
  148.   attr_accessor :follow_up
  149.   attr_accessor :follow_chance
  150.   attr_accessor :follow_states_all
  151.   attr_accessor :follow_states_any
  152.   attr_accessor :follow_switch_all
  153.   attr_accessor :follow_switch_any
  154.   attr_accessor :follow_eval
  155.  
  156.   #--------------------------------------------------------------------------
  157.   # common cache: load_notetags_fus
  158.   #--------------------------------------------------------------------------
  159.   def load_notetags_fus
  160.     @follow_up = 0
  161.     @follow_chance = 1.0
  162.     @follow_states_all = []
  163.     @follow_states_any = []
  164.     @follow_switch_all = []
  165.     @follow_switch_any = []
  166.     @follow_eval = ""
  167.     @follow_eval_on = false
  168.     #---
  169.     self.note.split(/[\r\n]+/).each { |line|
  170.       case line
  171.       #---
  172.       when YEA::REGEXP::SKILL::FOLLOWUP
  173.         @follow_up = $1.to_i
  174.         @follow_chance = 1.0
  175.       when YEA::REGEXP::SKILL::FOLLOWUP_CHANCE
  176.         @follow_up = $1.to_i
  177.         @follow_chance = $2.to_i * 0.01
  178.       #---
  179.       when YEA::REGEXP::SKILL::FOLLOWUP_STATES
  180.         $1.scan(/\d+/).each { |num|
  181.         @follow_states_all.push(num.to_i) if num.to_i > 0 }
  182.       when YEA::REGEXP::SKILL::FOLLOWUP_ALL_STATES
  183.         $1.scan(/\d+/).each { |num|
  184.         @follow_states_all.push(num.to_i) if num.to_i > 0 }
  185.       when YEA::REGEXP::SKILL::FOLLOWUP_ANY_STATES
  186.         $1.scan(/\d+/).each { |num|
  187.         @follow_states_any.push(num.to_i) if num.to_i > 0 }
  188.       #---
  189.       when YEA::REGEXP::SKILL::FOLLOWUP_SWITCH
  190.         $1.scan(/\d+/).each { |num|
  191.         @follow_switch_all.push(num.to_i) if num.to_i > 0 }
  192.       when YEA::REGEXP::SKILL::FOLLOWUP_ALL_SWITCH
  193.         $1.scan(/\d+/).each { |num|
  194.         @follow_switch_all.push(num.to_i) if num.to_i > 0 }
  195.       when YEA::REGEXP::SKILL::FOLLOWUP_ANY_SWITCH
  196.         $1.scan(/\d+/).each { |num|
  197.         @follow_switch_any.push(num.to_i) if num.to_i > 0 }
  198.       #---
  199.       when YEA::REGEXP::SKILL::FOLLOWUP_EVAL_ON
  200.         @follow_eval_on = true
  201.       when YEA::REGEXP::SKILL::FOLLOWUP_EVAL_OFF
  202.         @follow_eval_off = false
  203.       #---
  204.       else
  205.         @follow_eval += line.to_s if @follow_eval_on
  206.       end
  207.     } # self.note.split
  208.     #---
  209.   end
  210.  
  211. end # RPG::Skill
  212.  
  213. #==============================================================================
  214. # ■ Game_Action
  215. #==============================================================================
  216.  
  217. class Game_Action
  218.  
  219.   #--------------------------------------------------------------------------
  220.   # public instance variables
  221.   #--------------------------------------------------------------------------
  222.   attr_accessor :follow_up
  223.  
  224. end # Game_Action
  225.  
  226. #==============================================================================
  227. # ■ Game_Battler
  228. #==============================================================================
  229.  
  230. class Game_Battler < Game_BattlerBase
  231.  
  232.   #--------------------------------------------------------------------------
  233.   # alias method: item_user_effect
  234.   #--------------------------------------------------------------------------
  235.   alias game_battler_item_user_effect_fus item_user_effect
  236.   def item_user_effect(user, item)
  237.     game_battler_item_user_effect_fus(user, item)
  238.     user.process_follow_up_skill(item)
  239.   end
  240.  
  241.   #--------------------------------------------------------------------------
  242.   # new method: process_follow_up_skill
  243.   #--------------------------------------------------------------------------
  244.   def process_follow_up_skill(item)
  245.     return unless meet_follow_up_requirements?(item)
  246.     action = Game_Action.new(self)
  247.     action.set_skill(item.follow_up)
  248.     if current_action.nil?
  249.       action.decide_random_target
  250.     else
  251.       action.target_index = current_action.target_index
  252.     end
  253.     @actions.insert(1, action)
  254.     @actions[1].follow_up = true
  255.   end
  256.  
  257.   #--------------------------------------------------------------------------
  258.   # new method: meet_follow_up_requirements?
  259.   #--------------------------------------------------------------------------
  260.   def meet_follow_up_requirements?(item)
  261.     return false if item.nil?
  262.     return false unless item.is_a?(RPG::Skill)
  263.     return false if @actions[1] != nil && @actions[1].follow_up
  264.     return false if $data_skills[item.follow_up].nil?
  265.     return false unless follow_up_all_states?(item)
  266.     return false unless follow_up_any_states?(item)
  267.     return false unless follow_up_all_switch?(item)
  268.     return false unless follow_up_any_switch?(item)
  269.     return false unless follow_up_eval?(item)
  270.     return rand < item.follow_chance
  271.   end
  272.  
  273.   #--------------------------------------------------------------------------
  274.   # new method: follow_up_all_states?
  275.   #--------------------------------------------------------------------------
  276.   def follow_up_all_states?(item)
  277.     for state_id in item.follow_states_all
  278.       next if $data_states[state_id].nil?
  279.       return false unless state?(state_id)
  280.     end
  281.     return true
  282.   end
  283.  
  284.   #--------------------------------------------------------------------------
  285.   # new method: follow_up_any_states?
  286.   #--------------------------------------------------------------------------
  287.   def follow_up_any_states?(item)
  288.     return true if item.follow_states_any == []
  289.     for state_id in item.follow_states_any
  290.       next if $data_states[state_id].nil?
  291.       return true if state?(state_id)
  292.     end
  293.     return false
  294.   end
  295.  
  296.   #--------------------------------------------------------------------------
  297.   # new method: follow_up_all_switch?
  298.   #--------------------------------------------------------------------------
  299.   def follow_up_all_switch?(item)
  300.     for switch_id in item.follow_switch_all
  301.       return false unless $game_switches[switch_id]
  302.     end
  303.     return true
  304.   end
  305.  
  306.   #--------------------------------------------------------------------------
  307.   # new method: follow_up_any_switch?
  308.   #--------------------------------------------------------------------------
  309.   def follow_up_any_switch?(item)
  310.     return true if item.follow_switch_all == []
  311.     for switch_id in item.follow_switch_all
  312.       return true if $game_switches[switch_id]
  313.     end
  314.     return false
  315.   end
  316.  
  317.   #--------------------------------------------------------------------------
  318.   # new method: follow_up_eval?
  319.   #--------------------------------------------------------------------------
  320.   def follow_up_eval?(item)
  321.     return true if item.follow_eval == ""
  322.     return eval(item.follow_eval)
  323.   end
  324.  
  325. end # Game_Battler
  326.  
  327. #==============================================================================
  328. #
  329. # ▼ End of File
  330. #
  331. #==============================================================================
不好意思看错了。这个脚本才是伴随技能,前面那个是连锁技能,要战斗中手动按的。
用法:在技能备注里写<follow up x>,X是技能编号。
<follow up x: y%>可以设置伴随技能触发的概率。
还可以设置伴随状态、开关什么的,在脚本开头那里都有说明的
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
49
在线时间
7 小时
注册时间
2012-3-7
帖子
81
5
发表于 2012-3-7 13:21:25 | 只看该作者
哎……话说技能页面应该本身就能把

点评

哦  发表于 2012-3-7 18:23
hcm
那也是有间隔时间的。  发表于 2012-3-7 13:25
回复

使用道具 举报

Lv3.寻梦者

虚空人形

梦石
0
星屑
4604
在线时间
2037 小时
注册时间
2011-8-11
帖子
3398

贵宾

6
 楼主| 发表于 2012-3-7 14:03:19 | 只看该作者
xuzhengchi 发表于 2012-3-7 13:13
#==============================================================================
#
# ▼ Yanfly Eng ...

确实是连发技能的,但和公共事件有一样的时间间隔。
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
66
在线时间
140 小时
注册时间
2012-2-6
帖子
384
7
发表于 2012-3-8 17:35:16 | 只看该作者
hcm 发表于 2012-3-7 18:03
确实是连发技能的,但和公共事件有一样的时间间隔。

什么叫做时间间隔呢?YeAFollowUp应当没问题吧
签名是什么?可以吃么?
回复

使用道具 举报

Lv3.寻梦者

虚空人形

梦石
0
星屑
4604
在线时间
2037 小时
注册时间
2011-8-11
帖子
3398

贵宾

8
 楼主| 发表于 2012-3-8 22:00:00 | 只看该作者
杂兵天下 发表于 2012-3-8 17:35
什么叫做时间间隔呢?YeAFollowUp应当没问题吧

就是两次技能动画播放(对象方的动画)之间有时间间隔。
对了,忘记说我还用了Sideview的脚本,好像和这个有关。

点评

hcm
拜托,一个动画只能用两组素材,别告诉我要把一堆动画的素材放在一个文件吧。  发表于 2012-3-9 11:59
要两个技能同时发动还不如把伤害加起来,然后动画叠起来做一个新技能呢 Sideview貌似有问题啊哇哈哈哈哈(雾)  发表于 2012-3-9 11:30
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-15 02:13

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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