查看: 2830|回复: 7

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

[复制链接]

虚空人形

梦石
0
星屑
4866
在线时间
2037 小时
注册时间
2011-8-11
回帖
3260

贵宾

发表于 2012-3-6 12:20:07 | 显示全部楼层 |阅读模式

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

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

×
        RT,假设我一个战斗中发动一个指定技能,这个技能发动结束后自动发动另一个指定技能,
本来我使用公共事件,但发现这样会有时间间隔,我想让两个技能连发该怎么做?
梦石
0
星屑
194
在线时间
667 小时
注册时间
2011-9-25
回帖
216
发表于 2012-3-7 12:02:20 | 显示全部楼层
[pre lang="php" line="1"]#==============================================================================
#
# ▼ Yanfly Engine Ace - Active Chain Skills v1.01
# -- Last Updated: 2011.12.22
# -- Level: Hard
# -- Requires: n/a
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YEA-ActiveChainSkills"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2011.12.22 - Better updating speed for window.
# 2011.12.18 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script enables the usage of Active Chain Skills. When a skill with any
# potential chain skill occurs, potentially chainable skills will be listed on
# the side of the screen and if the player presses the right button to trigger
# that chain skill, the battler's next action will lead into the next chain
# skill. Chain skills can only be used by actors and can be endlessly chained
# until either the actor runs out of skill cost resources or until the actor
# performs a chained skill without any skills to chain off of.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Skill Notetags - These notetags go in the skill notebox in the database.
# -----------------------------------------------------------------------------
# <chain skill L: x>
# <chain skill R: x>
# <chain skill X: x>
# <chain skill Y: x>
# <chain skill Z: x>
# Makes the skill with these notetags to become potentially chainable. Replace
# x with the ID of the skill you want the button to cause the skill to chain.
# Note that if the actor has not learned the chain skill, the chain skill will
# not be listed. If the actor has learned the chain skill but lacks resources
# to use it, it will be greyed out.
#
# <chain only>
# This makes the skill usable only if it's used in a chain. This effect does
# not affect monsters. Chain only skills can still be unusable if the user does
# not meet the skill's other requirements. This means that the skill will be
# disabled in the skill window when you try to actively use it from the window.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
# While this script doesn't interfere with Input Combo Skills, it will most
# likely be unable to used in conjunction with Input Combo Skills. I will not
# provide support for any errors that may occur from this, nor will I be
# responsible for any damage doing this may cause your game.
#
#==============================================================================

module YEA
  module ACTIVE_CHAIN
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Chain Skill Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # Adjust general settings here. These settings adjust the sound effect
    # played when an active skill is selected and what the minimum time window
    # is for an active chain skill.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # This will be the sound effect played whenever an active chain skill has
    # been selected for chaining.
    ACTIVE_SKILL_SOUND = RPG::SE.new("Skill2", 80, 100)
   
    # How many frames minimum for chain allowance. Sometimes the battlelog
    # window will move too fast for the player to be able to chain. This sets
    # a minimum timer for how long the chain window will stay open.
    MINIMUM_TIME = 120
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Chain Skill Text -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # This section adjusts the text that appears for the chain skills. Adjust
    # the text to appear as you see fit. Note that the vocab other than the
    # title can use text codes.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    CHAIN_TITLE  = "Active Chain Skills"
    TITLE_SIZE   = 20
    L_SKILL_ON   = "\eC[17]Q\eC[0]Chain: "
    L_SKILL_OFF  = "\eC[7]QChain: "
    L_SKILL_ACT  = "\eC[17]QChain: "
    R_SKILL_ON   = "\eC[17]W\eC[0]Chain: "
    R_SKILL_OFF  = "\eC[7]WChain: "
    R_SKILL_ACT  = "\eC[17]WChain: "
    X_SKILL_ON   = "\eC[17]A\eC[0]ttack: "
    X_SKILL_OFF  = "\eC[7]Attack: "
    X_SKILL_ACT  = "\eC[17]Attack: "
    Y_SKILL_ON   = "\eC[17]S\eC[0]trike: "
    Y_SKILL_OFF  = "\eC[7]Strike: "
    Y_SKILL_ACT  = "\eC[17]Strike: "
    Z_SKILL_ON   = "\eC[17]D\eC[0]efend: "
    Z_SKILL_OFF  = "\eC[7]Defend: "
    Z_SKILL_ACT  = "\eC[17]Defend: "
   
  end # ACTIVE_CHAIN
end # YEA

#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================

module YEA
  module REGEXP
  module SKILL
   
    CHAIN_ONLY  = /<(?:CHAIN_ONLY|chain only)>/i
    CHAIN_SKILL = /<(?:CHAIN_SKILL|chain skill)[ ]([LRXYZ]):[ ](\d+)>/i
   
  end # SKILL
  end # REGEXP
end # YEA

#==============================================================================
# ■ DataManager
#==============================================================================

module DataManager
  
  #--------------------------------------------------------------------------
  # alias method: load_database
  #--------------------------------------------------------------------------
  class <<self; alias load_database_acs load_database; end
  def self.load_database
    load_database_acs
    load_notetags_acs
  end
  
  #--------------------------------------------------------------------------
  # new method: load_notetags_acs
  #--------------------------------------------------------------------------
  def self.load_notetags_acs
    for skill in $data_skills
      next if skill.nil?
      skill.load_notetags_acs
    end
  end
  
end # DataManager

#==============================================================================
# ■ RPG::Skill
#==============================================================================

class RPG::Skill < RPG::UsableItem
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :chain_only
  attr_accessor :chain_skill
  
  #--------------------------------------------------------------------------
  # common cache: load_notetags_acs
  #--------------------------------------------------------------------------
  def load_notetags_acs
    @chain_only = false
    @chain_skill = {}
    #---
    self.note.split(/[\r\n]+/).each { |line|
      case line
      #---
      when YEA::REGEXP::SKILL::CHAIN_ONLY
        @chain_only = true
      when YEA::REGEXP::SKILL::CHAIN_SKILL
        case $1.upcase
        when "L"; @chain_skill[:L] = $2.to_i
        when "R"; @chain_skill[:R] = $2.to_i
        when "X"; @chain_skill[:X] = $2.to_i
        when "Y"; @chain_skill[:Y] = $2.to_i
        when "Z"; @chain_skill[:Z] = $2.to_i
        else; next
        end
      #---
      end
    } # self.note.split
    #---
  end
  
end # RPG::UsableItem

#==============================================================================
# ■ Game_Action
#==============================================================================

class Game_Action
  
  #--------------------------------------------------------------------------
  # new method: set_active_chain_skill
  #--------------------------------------------------------------------------
  def set_active_chain_skill(skill_id)
    set_skill(skill_id)
    @target_index = subject.current_action.target_index
    @active_chain_skill = true
  end
  
  #--------------------------------------------------------------------------
  # alias method: valid?
  #--------------------------------------------------------------------------
  alias game_action_valid_acs valid?
  def valid?
    subject.enable_active_chain(true) if @active_chain_skill
    result = game_action_valid_acs
    subject.enable_active_chain(false) if @active_chain_skill
    return result
  end
  
end # Game_Action

#==============================================================================
# ■ Game_BattlerBase
#==============================================================================

class Game_BattlerBase
  
  #--------------------------------------------------------------------------
  # alias method: skill_conditions_met?
  #--------------------------------------------------------------------------
  alias game_battlerbase_skill_conditions_met_acs skill_conditions_met?
  def skill_conditions_met?(skill)
    return false if chain_skill_restriction?(skill)
    return game_battlerbase_skill_conditions_met_acs(skill)
  end
  
  #--------------------------------------------------------------------------
  # new method: chain_skill_restriction?
  #--------------------------------------------------------------------------
  def chain_skill_restriction?(skill)
    return false unless actor?
    return false unless $game_party.in_battle
    return false unless skill.chain_only
    return !@active_chain_enabled
  end
  
  #--------------------------------------------------------------------------
  # alias method: hp=
  #--------------------------------------------------------------------------
  alias game_battlerbase_hpequals_acs hp=
  def hp=(value)
    game_battlerbase_hpequals_acs(value)
    return unless SceneManager.scene_is?(Scene_Battle)
    return unless actor?
    return if value == 0
    SceneManager.scene.refresh_active_chain_skill_window(self)
  end
  
  #--------------------------------------------------------------------------
  # alias method: mp=
  #--------------------------------------------------------------------------
  alias game_battlerbase_mpequals_acs mp=
  def mp=(value)
    game_battlerbase_mpequals_acs(value)
    return unless SceneManager.scene_is?(Scene_Battle)
    return unless actor?
    return if value == 0
    SceneManager.scene.refresh_active_chain_skill_window(self)
  end
  
  #--------------------------------------------------------------------------
  # alias method: tp=
  #--------------------------------------------------------------------------
  alias game_battlerbase_tpequals_acs tp=
  def tp=(value)
    game_battlerbase_tpequals_acs(value)
    return unless SceneManager.scene_is?(Scene_Battle)
    return unless actor?
    return if value == 0
    SceneManager.scene.refresh_active_chain_skill_window(self)
  end
  
end # Game_BattlerBase

#==============================================================================
# ■ Game_Battler
#==============================================================================

class Game_Battler < Game_BattlerBase
  
  #--------------------------------------------------------------------------
  # alias method: on_battle_start
  #--------------------------------------------------------------------------
  alias game_battler_on_battle_start_acs on_battle_start
  def on_battle_start
    game_battler_on_battle_start_acs
    @active_chain_enabled = false
  end
  
  #--------------------------------------------------------------------------
  # alias method: on_battle_end
  #--------------------------------------------------------------------------
  alias game_battler_on_battle_end_acs on_battle_end
  def on_battle_end
    game_battler_on_battle_end_acs
    @active_chain_enabled = false
  end
  
  #--------------------------------------------------------------------------
  # new method: enable_active_chain
  #--------------------------------------------------------------------------
  def enable_active_chain(active)
    return unless actor?
    @active_chain_enabled = active
  end
  
  #--------------------------------------------------------------------------
  # new method: add_active_skill_chain
  #--------------------------------------------------------------------------
  def add_active_skill_chain(skill_id)
    chain_skill = Game_Action.new(self)
    chain_skill.set_active_chain_skill(skill_id)
    @actions.insert(1, chain_skill)
  end
  
end # Game_Battler

#==============================================================================
# ■ Window_ChainSkillList
#==============================================================================

class Window_ChainSkillList < Window_Base
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize
    dw = [Graphics.width/2, 320].max
    super(-standard_padding, 0, dw, fitting_height(6))
    self.z = 200
    self.opacity = 0
    hide
  end
  
  #--------------------------------------------------------------------------
  # reveal
  #--------------------------------------------------------------------------
  def reveal(battler, skill)
    @battler = battler
    @skill = skill
    @chain_skills = []
    for key in skill.chain_skill
      next if key[1].nil?
      next if $data_skills[key[1]].nil?
      next unless @battler.skills.include?($data_skills[key[1]])
      @chain_skills.push($data_skills[key[1]])
    end
    return if @chain_skills == []
    self.y = Graphics.height - fitting_height(4)
    self.y -= fitting_height(@chain_skills.size + 1)
    show
    activate
    @enabled = true
    refresh
  end
  
  #--------------------------------------------------------------------------
  # button=
  #--------------------------------------------------------------------------
  def button=(button)
    @button = button
    @enabled = false
    refresh unless @button.nil?
  end
  
  #--------------------------------------------------------------------------
  # refresh_check
  #--------------------------------------------------------------------------
  def refresh_check(battler)
    return if @battler != battler
    refresh
  end
  
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    @button = nil if @enabled
    contents.clear
    draw_background_colour
    draw_horz_line(0)
    draw_combo_title
    draw_chain_skills
  end
  
  #--------------------------------------------------------------------------
  # draw_background_colour
  #--------------------------------------------------------------------------
  def draw_background_colour
    dh = line_height * (@chain_skills.size + 1)
    rect = Rect.new(0, 0, contents.width, dh)
    back_colour1 = Color.new(0, 0, 0, 192)
    back_colour2 = Color.new(0, 0, 0, 0)
    contents.gradient_fill_rect(rect, back_colour1, back_colour2)
  end
  
  #--------------------------------------------------------------------------
  # draw_horz_line
  #--------------------------------------------------------------------------
  def draw_horz_line(dy)
    line_y = dy + line_height - 2
    line_colour = normal_color
    line_colour.alpha = 48
    contents.fill_rect(0, line_y, contents.width, 2, line_colour)
  end
  
  #--------------------------------------------------------------------------
  # draw_combo_title
  #--------------------------------------------------------------------------
  def draw_combo_title
    reset_font_settings
    text = YEA::ACTIVE_CHAIN::CHAIN_TITLE
    contents.font.size = YEA::ACTIVE_CHAIN::TITLE_SIZE
    contents.font.bold = true
    contents.font.italic = true
    draw_text(12, 0, contents.width - 12, line_height, text)
    reset_font_settings
  end
  
  #--------------------------------------------------------------------------
  # draw_chain_skills
  #--------------------------------------------------------------------------
  def draw_chain_skills
    button_array = [:L, :R, :X, :Y, :Z]
    dx = 24
    dy = line_height
    for button in button_array
      next if @skill.chain_skill[button].nil?
      chain_skill = $data_skills[@skill.chain_skill[button]]
      next unless @battler.skills.include?(chain_skill)
      text = text_setting(button, chain_skill)
      text += sprintf("\eI[%d]", chain_skill.icon_index)
      text += chain_skill.name
      draw_text_ex(dx, dy, text)
      dy += line_height
    end
  end
  
  #--------------------------------------------------------------------------
  # text_setting
  #--------------------------------------------------------------------------
  def text_setting(button, skill)
    active = button == @button
    text = ""
    case button
    when :L
      if @enabled && @battler.usable?(skill)
        text = YEA::ACTIVE_CHAIN::L_SKILL_ON
      elsif !@enabled && active
        text = YEA::ACTIVE_CHAIN::L_SKILL_ACT
      else
        text = YEA::ACTIVE_CHAIN::L_SKILL_OFF
      end
    when :R
      if @enabled && @battler.usable?(skill)
        text = YEA::ACTIVE_CHAIN::R_SKILL_ON
      elsif !@enabled && active
        text = YEA::ACTIVE_CHAIN::R_SKILL_ACT
      else
        text = YEA::ACTIVE_CHAIN::R_SKILL_OFF
      end
    when :X
      if @enabled && @battler.usable?(skill)
        text = YEA::ACTIVE_CHAIN::X_SKILL_ON
      elsif !@enabled && active
        text = YEA::ACTIVE_CHAIN::X_SKILL_ACT
      else
        text = YEA::ACTIVE_CHAIN::X_SKILL_OFF
      end
    when :Y
      if @enabled && @battler.usable?(skill)
        text = YEA::ACTIVE_CHAIN::Y_SKILL_ON
      elsif !@enabled && active
        text = YEA::ACTIVE_CHAIN::Y_SKILL_ACT
      else
        text = YEA::ACTIVE_CHAIN::Y_SKILL_OFF
      end
    when :Z
      if @enabled && @battler.usable?(skill)
        text = YEA::ACTIVE_CHAIN::Z_SKILL_ON
      elsif !@enabled && active
        text = YEA::ACTIVE_CHAIN::Z_SKILL_ACT
      else
        text = YEA::ACTIVE_CHAIN::Z_SKILL_OFF
      end
    end
    return text
  end
  
end # Window_ChainSkillList

#==============================================================================
# ■ Scene_Battle
#==============================================================================

class Scene_Battle < Scene_Base
  
  #--------------------------------------------------------------------------
  # alias method: create_all_windows
  #--------------------------------------------------------------------------
  alias scene_battle_create_all_windows_acs create_all_windows
  def create_all_windows
    scene_battle_create_all_windows_acs
    create_chain_skill_window
  end
  
  #--------------------------------------------------------------------------
  # new method: create_chain_skill_window
  #--------------------------------------------------------------------------
  def create_chain_skill_window
    @active_chain_skill_window = Window_ChainSkillList.new
    @active_chain_skill_counter = 0
  end
  
  #--------------------------------------------------------------------------
  # alias method: use_item
  #--------------------------------------------------------------------------
  alias scene_battle_use_item_acs use_item
  def use_item
    @subject.enable_active_chain(true)
    item = @subject.current_action.item
    chain_skill_list_appear(true, item)
    start_active_skill_counter(item)
    scene_battle_use_item_acs
    wait_active_skill_counter
    chain_skill_list_appear(false, item)
    @subject.enable_active_chain(false)
  end
  
  #--------------------------------------------------------------------------
  # new method: chain_skill_list_appear
  #--------------------------------------------------------------------------
  def chain_skill_list_appear(visible, skill)
    return if @subject.nil?
    return unless @subject.actor?
    return unless skill.is_a?(RPG::Skill)
    @active_chain_skill = 0
    @current_chain_skill = skill
    @active_chain_skill_window.reveal(@subject, skill) if visible
    @active_chain_skill_window.hide unless visible
  end
  
  #--------------------------------------------------------------------------
  # new method: refresh_active_chain_skill_window
  #--------------------------------------------------------------------------
  def refresh_active_chain_skill_window(battler)
    return unless @active_chain_skill_window.visible
    @active_chain_skill_window.refresh_check(battler)
  end
  
  #--------------------------------------------------------------------------
  # new method: start_active_skill_counter
  #--------------------------------------------------------------------------
  def start_active_skill_counter(skill)
    return unless @active_chain_skill_window.visible
    @active_chain_skill_counter = YEA::ACTIVE_CHAIN::MINIMUM_TIME
  end
  
  #--------------------------------------------------------------------------
  # new method: wait_active_skill_counter
  #--------------------------------------------------------------------------
  def wait_active_skill_counter
    return unless @active_chain_skill_window.visible
    wait(@active_chain_skill_counter)
  end
  
  #--------------------------------------------------------------------------
  # new method: update_active_chain_skill_counter
  #--------------------------------------------------------------------------
  def update_active_chain_skill_counter
    return if @active_chain_skill_counter == 0
    @active_chain_skill_counter -= 1
  end
  
  #--------------------------------------------------------------------------
  # alias method: update_basic
  #--------------------------------------------------------------------------
  alias scene_battle_update_basic_acs update_basic
  def update_basic
    scene_battle_update_basic_acs
    update_active_chain_skill_counter
    update_active_chain_skill_select
  end
  
  #--------------------------------------------------------------------------
  # new method: update_active_chain_skill_select
  #--------------------------------------------------------------------------
  def update_active_chain_skill_select
    return unless @active_chain_skill_window.visible
    return if @active_chain_skill > 0
    if Input.press?(:L)
      check_active_chain_skill(:L)
    elsif Input.press?(:R)
      check_active_chain_skill(:R)
    elsif Input.press?(:X)
      check_active_chain_skill(:X)
    elsif Input.press?(:Y)
      check_active_chain_skill(:Y)
    elsif Input.press?(:Z)
      check_active_chain_skill(:Z)
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: check_active_chain_skill
  #--------------------------------------------------------------------------
  def check_active_chain_skill(button)
    skill_id = @current_chain_skill.chain_skill[button]
    return if skill_id.nil?
    return if $data_skills[skill_id].nil?
    chain_skill = $data_skills[skill_id]
    return unless @subject.usable?(chain_skill)
    return unless @subject.skills.include?(chain_skill)
    @active_chain_skill_counter = 12
    @active_chain_skill = skill_id
    @active_chain_skill_window.button = button
    YEA::ACTIVE_CHAIN::ACTIVE_SKILL_SOUND.play
    @subject.add_active_skill_chain(skill_id)
  end
  
end # Scene_Battle

#==============================================================================
#
# ▼ End of File
#
#==============================================================================[/pre]
回复

使用道具 举报

虚空人形

梦石
0
星屑
4866
在线时间
2037 小时
注册时间
2011-8-11
回帖
3260

贵宾

 楼主| 发表于 2012-3-7 12:11:28 | 显示全部楼层
xuzhengchi 发表于 2012-3-7 12:02
#==============================================================================
#
# ▼ Yanfly Engin ...

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

使用道具 举报

梦石
0
星屑
194
在线时间
667 小时
注册时间
2011-9-25
回帖
216
发表于 2012-3-7 13:13:42 | 显示全部楼层
本帖最后由 xuzhengchi 于 2012-3-7 13:17 编辑
hcm 发表于 2012-3-7 12:11
脚本注释翻译后我基本看了,但还不明白怎么用。


[pre lang="php" line="1"]#==============================================================================
#
# ▼ Yanfly Engine Ace - Follow-Up Skill v1.01
# -- Last Updated: 2012.02.12
# -- Level: Normal
# -- Requires: n/a
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YEA-FollowUpSkill"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.02.12 - Bug Fixed: Follow Up skills do not stack with multi-hits.
# 2012.02.05 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script allows for follow-up skills when the skill lands a successful hit
# (ie. no misses or evades). The script provides a chance to proceed with a
# follow-up skill or a guaranteed follow-up skill provided that the prior skill
# has successfully connected.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Skill Notetags - These notetags go in the skill notebox in the database.
# -----------------------------------------------------------------------------
# <follow up x>
# This causes the skill x to have a 100% chance of a follow-up upon usage of
# the current skill and the current skill landing a successful hit.
#
# <follow up x: y%>
# This causes the skill x to have y% chance of a follow-up upon usage of the
# current skill and the current skill landing a successful hit.
#
# <follow up state: x>
# <follow up all states: x, x>
# This causes the follow-up skill to require all of the states x to follow-up.
# If one state is missing, the follow-up skill will not occur. To add in more
# states required, insert multiples of this notetag.
#
# <follow up any states: x, x>
# This causes the follow-up skill to require at least one of the listed states
# x to follow-up. If all states are missing, the follow-up skill will not
# occur. To add in more states required, insert multiples of this notetag.
#
# <follow up switch: x>
# <follow up all switch: x, x>
# This causes the follow-up skill to require all switches x to be ON before the
# skill will follow-up. If one switch is OFF, the follow-up skill will not
# occur. To add in more switches required, insert multiples of this notetag.
#
# <follow up any switch: x, x>
# This causes the follow-up skill to require at least one of the listed
# switches to be ON before the the follow-up skill will occur. If all switches
# are off, the follow-up skill will not occur. To add in more switches required
# insert multiples of this notetag.
#
# <follow up eval>
#  string
#  string
# </follow up eval>
# For the more advanced users, replace string with code to determine whether
# or not the skill will follow-up. If multiple lines are used, they are all
# considered part of the same line.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================

module YEA
  module REGEXP
  module SKILL
   
    FOLLOWUP = /<(?:FOLLOW_UP|follow up)[ ](\d+)>/i
    FOLLOWUP_CHANCE = /<(?:FOLLOW_UP|follow up)[ ](\d+):[ ](\d+)([%%])>/i
    FOLLOWUP_STATES =
      /<(?:FOLLOW_UP_STATE|follow up state):[ ](\d+(?:\s*,\s*\d+)*)>/i
    FOLLOWUP_ALL_STATES =
      /<(?:FOLLOW_UP_ALL_STATES|follow up all states):[ ](\d+(?:\s*,\s*\d+)*)>/i
    FOLLOWUP_ANY_STATES =
      /<(?:FOLLOW_UP_ANY_STATES|follow up any states):[ ](\d+(?:\s*,\s*\d+)*)>/i
    FOLLOWUP_SWITCH =
      /<(?:FOLLOW_UP_SWITCH|follow up switch):[ ](\d+(?:\s*,\s*\d+)*)>/i
    FOLLOWUP_ALL_SWITCH =
      /<(?:FOLLOW_UP_ALL_SWITCH|follow up all switch):[ ](\d+(?:\s*,\s*\d+)*)>/i
    FOLLOWUP_ANY_SWITCH =
      /<(?:FOLLOW_UP_ANY_SWITCH|follow up any switch):[ ](\d+(?:\s*,\s*\d+)*)>/i
    FOLLOWUP_EVAL_ON = /<(?:FOLLOW_UP_EVAL|follow up eval)>/i
    FOLLOWUP_EVAL_OFF = /<\/(?:FOLLOW_UP_EVAL|follow up eval)>/i
   
  end # SKILL
  end # REGEXP
end # YEA

#==============================================================================
# ■ DataManager
#==============================================================================

module DataManager
  
  #--------------------------------------------------------------------------
  # alias method: load_database
  #--------------------------------------------------------------------------
  class <<self; alias load_database_fus load_database; end
  def self.load_database
    load_database_fus
    load_notetags_fus
  end
  
  #--------------------------------------------------------------------------
  # new method: load_notetags_fus
  #--------------------------------------------------------------------------
  def self.load_notetags_fus
    for obj in $data_skills
      next if obj.nil?
      obj.load_notetags_fus
    end
  end
  
end # DataManager

#==============================================================================
# ■ RPG::BaseItem
#==============================================================================

class RPG::Skill < RPG::UsableItem
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :follow_up
  attr_accessor :follow_chance
  attr_accessor :follow_states_all
  attr_accessor :follow_states_any
  attr_accessor :follow_switch_all
  attr_accessor :follow_switch_any
  attr_accessor :follow_eval
  
  #--------------------------------------------------------------------------
  # common cache: load_notetags_fus
  #--------------------------------------------------------------------------
  def load_notetags_fus
    @follow_up = 0
    @follow_chance = 1.0
    @follow_states_all = []
    @follow_states_any = []
    @follow_switch_all = []
    @follow_switch_any = []
    @follow_eval = ""
    @follow_eval_on = false
    #---
    self.note.split(/[\r\n]+/).each { |line|
      case line
      #---
      when YEA::REGEXP::SKILL::FOLLOWUP
        @follow_up = $1.to_i
        @follow_chance = 1.0
      when YEA::REGEXP::SKILL::FOLLOWUP_CHANCE
        @follow_up = $1.to_i
        @follow_chance = $2.to_i * 0.01
      #---
      when YEA::REGEXP::SKILL::FOLLOWUP_STATES
        $1.scan(/\d+/).each { |num|
        @follow_states_all.push(num.to_i) if num.to_i > 0 }
      when YEA::REGEXP::SKILL::FOLLOWUP_ALL_STATES
        $1.scan(/\d+/).each { |num|
        @follow_states_all.push(num.to_i) if num.to_i > 0 }
      when YEA::REGEXP::SKILL::FOLLOWUP_ANY_STATES
        $1.scan(/\d+/).each { |num|
        @follow_states_any.push(num.to_i) if num.to_i > 0 }
      #---
      when YEA::REGEXP::SKILL::FOLLOWUP_SWITCH
        $1.scan(/\d+/).each { |num|
        @follow_switch_all.push(num.to_i) if num.to_i > 0 }
      when YEA::REGEXP::SKILL::FOLLOWUP_ALL_SWITCH
        $1.scan(/\d+/).each { |num|
        @follow_switch_all.push(num.to_i) if num.to_i > 0 }
      when YEA::REGEXP::SKILL::FOLLOWUP_ANY_SWITCH
        $1.scan(/\d+/).each { |num|
        @follow_switch_any.push(num.to_i) if num.to_i > 0 }
      #---
      when YEA::REGEXP::SKILL::FOLLOWUP_EVAL_ON
        @follow_eval_on = true
      when YEA::REGEXP::SKILL::FOLLOWUP_EVAL_OFF
        @follow_eval_off = false
      #---
      else
        @follow_eval += line.to_s if @follow_eval_on
      end
    } # self.note.split
    #---
  end
  
end # RPG::Skill

#==============================================================================
# ■ Game_Action
#==============================================================================

class Game_Action
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :follow_up
  
end # Game_Action

#==============================================================================
# ■ Game_Battler
#==============================================================================

class Game_Battler < Game_BattlerBase
  
  #--------------------------------------------------------------------------
  # alias method: item_user_effect
  #--------------------------------------------------------------------------
  alias game_battler_item_user_effect_fus item_user_effect
  def item_user_effect(user, item)
    game_battler_item_user_effect_fus(user, item)
    user.process_follow_up_skill(item)
  end
  
  #--------------------------------------------------------------------------
  # new method: process_follow_up_skill
  #--------------------------------------------------------------------------
  def process_follow_up_skill(item)
    return unless meet_follow_up_requirements?(item)
    action = Game_Action.new(self)
    action.set_skill(item.follow_up)
    if current_action.nil?
      action.decide_random_target
    else
      action.target_index = current_action.target_index
    end
    @actions.insert(1, action)
    @actions[1].follow_up = true
  end
  
  #--------------------------------------------------------------------------
  # new method: meet_follow_up_requirements?
  #--------------------------------------------------------------------------
  def meet_follow_up_requirements?(item)
    return false if item.nil?
    return false unless item.is_a?(RPG::Skill)
    return false if @actions[1] != nil && @actions[1].follow_up
    return false if $data_skills[item.follow_up].nil?
    return false unless follow_up_all_states?(item)
    return false unless follow_up_any_states?(item)
    return false unless follow_up_all_switch?(item)
    return false unless follow_up_any_switch?(item)
    return false unless follow_up_eval?(item)
    return rand < item.follow_chance
  end
  
  #--------------------------------------------------------------------------
  # new method: follow_up_all_states?
  #--------------------------------------------------------------------------
  def follow_up_all_states?(item)
    for state_id in item.follow_states_all
      next if $data_states[state_id].nil?
      return false unless state?(state_id)
    end
    return true
  end
  
  #--------------------------------------------------------------------------
  # new method: follow_up_any_states?
  #--------------------------------------------------------------------------
  def follow_up_any_states?(item)
    return true if item.follow_states_any == []
    for state_id in item.follow_states_any
      next if $data_states[state_id].nil?
      return true if state?(state_id)
    end
    return false
  end
  
  #--------------------------------------------------------------------------
  # new method: follow_up_all_switch?
  #--------------------------------------------------------------------------
  def follow_up_all_switch?(item)
    for switch_id in item.follow_switch_all
      return false unless $game_switches[switch_id]
    end
    return true
  end
  
  #--------------------------------------------------------------------------
  # new method: follow_up_any_switch?
  #--------------------------------------------------------------------------
  def follow_up_any_switch?(item)
    return true if item.follow_switch_all == []
    for switch_id in item.follow_switch_all
      return true if $game_switches[switch_id]
    end
    return false
  end
  
  #--------------------------------------------------------------------------
  # new method: follow_up_eval?
  #--------------------------------------------------------------------------
  def follow_up_eval?(item)
    return true if item.follow_eval == ""
    return eval(item.follow_eval)
  end
  
end # Game_Battler

#==============================================================================
#
# ▼ End of File
#
#==============================================================================[/pre]不好意思看错了。这个脚本才是伴随技能,前面那个是连锁技能,要战斗中手动按的。
用法:在技能备注里写<follow up x>,X是技能编号。
<follow up x: y%>可以设置伴随技能触发的概率。
还可以设置伴随状态、开关什么的,在脚本开头那里都有说明的
回复

使用道具 举报

梦石
0
星屑
49
在线时间
7 小时
注册时间
2012-3-7
回帖
78
发表于 2012-3-7 13:21:25 | 显示全部楼层
哎……话说技能页面应该本身就能把

点评

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

使用道具 举报

虚空人形

梦石
0
星屑
4866
在线时间
2037 小时
注册时间
2011-8-11
回帖
3260

贵宾

 楼主| 发表于 2012-3-7 14:03:19 | 显示全部楼层
xuzhengchi 发表于 2012-3-7 13:13
#==============================================================================
#
# ▼ Yanfly Eng ...

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

使用道具 举报

梦石
0
星屑
67
在线时间
140 小时
注册时间
2012-2-6
回帖
351
发表于 2012-3-8 17:35:16 | 显示全部楼层
hcm 发表于 2012-3-7 18:03
确实是连发技能的,但和公共事件有一样的时间间隔。

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

使用道具 举报

虚空人形

梦石
0
星屑
4866
在线时间
2037 小时
注册时间
2011-8-11
回帖
3260

贵宾

 楼主| 发表于 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
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部