VX 스크립트

Ok. Basically I want to create an overdrive bar that is visible and actually progresses as you attack an enemy or getting attacked.

I've tried both DerVVulfman and KGC's scripts and the overdrive won't appear and neither do they work.
If you don't know what scripts I'm talk about, they're shown below.

DerVVulfman
시작!!!!!!!!!!!!!!!!!!!!!!!!!!

#==============================================================================
# ** Limit Break VX (DVV's)
#------------------------------------------------------------------------------
#    by DerVVulfman
#    version 2.1
#    05-20-2008
#    RGSS2
#------------------------------------------------------------------------------
#
# INTRODUCTION:
#
#   This system is a revised & enhanced version of my Limit Break (DVV) script.
#   and the feature it performs should be apparent  to users new and old alike.
#   Limit Break VX disables skills  until the hero's limit break bar is filled.
#   And once the 'limit break' skill is used, the skill becomes disabled again.
#  
#   Like before, the system has been designed 'menuless' by intent, and this is
#   to prevent any possible conflicts with any custom menu system.  As such, it
#   is ready for plug-n-play use.
#
#   The system, by itself, does not change the 'ATTACK' option  in the Actor's
#   command window either.   Instead, this system  enables/disables the skills
#   in the skill menu  for you to select.
#
#   Unlike its RPGMaker XP counterpart,  'Limit Break VX (DVV)'  does include a
#   bar drawing system of its own. It still includes the 'flexible' positioning
#   system as before  as well as its own ringer system.   For your convenience,
#   the bar color schemes are editable in the system's configuration system. If
#   you wish to create your own custom bars, please look towards replacing or
#   overwriting the 'draw_actor_lb' method in Game_Actor.
#
#------------------------------------------------------------------------------
#
#  SCRIPT CALLS:
#
#  While you may set the constants in your configuration system (and I did try
#  to explain each one in detail),  it is possible  to change a number  of key
#  values while the game is running.    Please allow me to show you which ones
#  may be altered:
#
#
#  Limitbreak:
#     The 'limitbreak' value is the variable that holds the points for each
#     actor and is used to display the bar growth  and signal when a limit-
#     break skill is ready for use.   Through script calls,  you can obtain
#     the total limitbreak points an actor has,or you can increase/decrease
#     their limitbreak score.
#
#     EX:  $game_party.members[6].limitbreak += 20
#          (Adds 20 points to the 6th actor in your database.)
#
#     EX:  print $game_party.members[3].limitbreak
#          (Retrieves and prints the limitbreak total for the 3rd actor.)
#
#
#  Limitbreak Type:
#     The 'limitbreak type' value defines how any actor's gauge  is filled.  
#     By default,  the value  starts off  as configured  with the  LB_START
#     value.  But it can be changed in a script call so each actor's limit-
#     break bar can fill in different ways.   Please see 'Limitbreak Rates'
#     further down for explanations of each gauge filling method.
#
#     EX:  $game_party.members[5].lb_type = 8
#          (Sets the 5th actor to use the 8th fill type:  Feared Enemy)
#
#
#  Limitbreak Element Weakness:
#     A requested feature was to have some way to have the limitbreak gauge
#     increase if an attack used a special element or if an actor was to be
#     succeptable to damage  from an elemental attack.   The result was the
#     creation of the 'Element Weakness' value.  Like the 'limitbreak type'
#     value, it too starts off with a value set in the configuration system,
#     that value  being LB_WEAKNESS.   But it too  can be changed through a
#     script call for each actor.  Please note that this value only makes a
#     difference if the actor's Limitbreak type (lb_type) is set to '5', or
#     'Hero takes Element Damage'.   An example  of the  script call  is as
#     follows:
#
#     EX:  $game_party.members[2].lb_weakness = 11
#          (Sets the 2nd actor to be weak against the 11th element: Thunder.)
#
#
#  Limitbreak Feared Enemy:
#     A little nuance I made is the 'Feared Enemy' value for limitbreak.   I
#     felt it balances out the system. If the limitbreak gauge can be filled
#     by killing certain enemies,  you may as well be able to fill the gauge
#     by being struck by a certain enemy as well.   Like the last two,  this
#     value starts off  with a value in the configuration system, LB_FEARED,
#     but it can be changed with a simple script call:
#
#     EX:  $game_party.members[8].lb_weakness = 5
#          (Sets the 8th actor to gain more points if hit by the 5th enemy.)
#
#    +--------------------------------------------------------------------+
#    | It is important to note that after every one of these calls, it is |
#    | recommended to use the $game_party.refresh call to ensure that the |
#    | methods I have just described take effect.                         |
#    +--------------------------------------------------------------------+
#
#
#  Limitbreak Menu Bars:
#     Not everyone wants their limitbreak gauges visible in their menus.  As
#     such,  I made this switch  so you can hide  or reveal the bars at your
#     whim.  By default, it is set by the LB_BARS_ON value in the configura-
#     tion section:
#
#     EX:  $game_system.lb_menu = true
#          (This prevents the limit break bars from showing in the menu.)
#
#
#  Flexible Positioning System:  Menu & Battle Bar Positions
#     Not every menu or battlestatus window is made the same. As such, I de-
#     veloped the Flexible positioning system for both menu and battle bars.
#     It allows you to move the bars where you want them to show.  Linked to
#     the 'actor name' method  in Window_Base,  the position of the bars are
#     drawn based on the X & Y position of the Actor's name.   And since the
#     Actor's name is  'typically'  the first method called in any menu, the
#     bars will be drawn below/behind any other text on the screen.
#
#     The menu and battle bar positions  are controlled  by an array that is
#     configured with the LB_MENU_POS and LB_BATTLE_POS arrays in the confi-
#     guration section.  But they can be changed in-game as shown in the ex-
#     ample below. Please note that the arrays have 3 arguments (x-position,
#     y-position, and bar width):
#
#     EX:  $game_system.lb_menu_pos = [-5, 2, 20]
#          (The bar is shown 5px higher, 2px to the right & with a 20px width.)
#
#
#  Limitbreak Hidden Actors:
#     The last little nuance I made is the 'Hidden Actor' array.   It allows
#     you to identify any actor or actors you want that do not display their
#     limitbreak bars.   It's very simple, and starts off as configured with
#     the LB_HIDDEN_ACTORS array.   To change the  actors being hidden,  you
#     merely need to use a script call like the one below:
#
#     EX:  $game_system.lb_hidden_actors = [2, 7]
#          (This makes the 2nd and 7th actor's bars invisible)
#
#
#------------------------------------------------------------------------------
#
#  LIMITBREAK RATES:
#
#     The last little nuance I made is the 'Hidden Actor' array.   It allows
#     Rather than go into a long diatribe for each and every limitbreak fill
#     rate,  I will merely present a chart with a small summary of the rates
#     available and how they fill the actor's limitbreak gauges:
#  
#  Rate   Name        Manner the Limitbreak Gauge is Filled
#    0)   Attack      ... when the hero 'hits' an enemy.
#    1)   Critical    ... when the hero performs a 'critical hit' on an enemy.
#    2)   Damage      ... when the hero is struck by an enemy.
#    3)   MP Attack   ... when the hero hurts an enemy's mp score.
#    4)   MP Damage   ... when an enemy damage's/drains the hero's mp score.
#    5)   Element     ... when the hero is hurt by an element-based attack.   *
#    6)   Status      ... when the hero is inflicted a status ailment.
#    7)   Restore     ... when the hero restores an ally's health.
#    8)   Feared      ... when the hero is hurt by a 'feared' enemy          **
#    9)   Enemy       ... when the hero lands the killing blow on an enemy.
#   10)   Boss        ... when the hero lands the killing blow on a boss.   ***
#   11)   Killed      ... when the hero is killed.                         ****
#   12)   Victory     ... when the party wins.
#   13)   Escape      ... when the party runs from combat.
#   14)   Defending   ... when the hero performs a defense/guard maneuver.
#   15)   Lone Member ... when the hero is the only surviving member.
#   16)   Action      ... when any action is performed.
#   17)   Crit Health ... when the hero has 25% or less health and in action.
#
#
#    *  The element must be specified by the LB_WEAKNESS value or subsequent
#       script call explained earlier.
#
#   **  The feared enemy must be specified by the LB_FEARED value or by the
#       subsequent script call explained earlier.
#
#  ***  Bosses are defined in the LB_BOSSES array in the configuration section.
#
# ****  While this allows you to gain limitbreak points on a character's death,
#       the 'Death Wipe' feature erases all points for actors upon death if the
#       LB_D_WIPE value is set to true.
#
#
#------------------------------------------------------------------------------
#
#  CREDITS AND THANKS:
#
#   Thanks still goes to Jaide for recommending the 'Death Wipe' feature.
#
#==============================================================================


   #=======================================================================#
   #  **  C  O  N  F  I  G  U  R  A  T  I  O  N      S  Y  S  T  E  M  **  #
   #=======================================================================#

  #=================#
  #  GAUGE CONTROL  #
  #=================#
  
  # Limit Break Note
  # ================
  # This is the text you enter into the 'Note' box for any skill that is to be
  # a limit break skill.
  #
  LB_NAME = "LimitBreak"

  
  # Limit Break Max Value
  # =====================
  # From 1 on up, this value is what you define as the highest value in your
  # limit break gauge.
  #
  LB_MAX      = 1000

  
  # Limit Break Fill Rates
  # ======================
  # This array defines the points gained in the limit break system.  It defines
  # the flat rate,  minimum and maximum point settings.   Please note  that the
  # maximum value settings should not exceed the value defined in LB_MAX.
  #
  LB_RATE     = [  10,  10,  200, # Hero Attacks the Enemy    (rate, min., max.)
                   25,  25, 1000, # Hero delivers a CRITICAL! (rate, min., max.)
                   30,   5, 1000, # Hero takes Damage         (rate, min., max.)
                    5,   5,  150, # Hero Hits with MP Damage  (rate, min., max.)
                   15,  15,  200, # Hero takes MP Damage      (rate, min., max.)
                   30,  10, 1000, # Hero takes Element Damage (rate, min., max.)
                  250,            # Hero Takes Status Effect  (flat rate)
                  150,            # Restore Ally's Health     (flat rate)
                  250,            # Struck by Feared Enemy    (flat rate)  
                  500,            # Enemy Killed              (flat rate)
                  750,            # Boss Killed               (flat rate)
                  900,            # Hero Killed               (flat rate)
                  200,            # Victory                   (flat rate)
                  200,            # Escape                    (flat rate)
                  100,            # Defending                 (flat rate)
                  160,            # Lone Battler              (flat rate)
                  40,             # Any action performed      (flat rate)
                  160   ]         # Critical Health           (flat rate)  
  
  # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  
  #=================#
  #   BAR CONTROL   #
  #=================#
                  
  # Flexible positioning system
  # ===========================
  # Default position appears under the name or level
  #
  LB_BARS_ON     = true             # If false, bars are never shown.
  LB_MENU_ON     = true             # If true, the bar is shown in the menu.
  LB_MENU_POS    = [ 0, 24, 108]    # Position in the menu:  X, Y, & bar width.
  LB_BATTLE_POS  = [ 0,  0, 108]    # Position in the battle menu.  Same setup.

  
  # Limit Break Ring Effect
  #
  LB_RING = "Item2"
  
  
  # Color System for Built-in Bar
  # --Optional use of Windowskin color or RGB color system--
  #
  LB_BAR_Norm_Start = 14
  LB_BAR_Norm_End   = 6
  LB_BAR_Max_Start  = Color.new(128, 64,  0)
  LB_BAR_Max_End    = Color.new(255, 32, 32)

  
  # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  
  #=================#
  #  ACTOR CONTROL  #
  #=================#
    
  # Starting/Default Limit Break Setting
  # This determines how the bar is filled for your characters on the initial
  # start of your game.
  #
  LB_START    = 8   # 0 = Attack          |  1 = Critical      |  2 = Damaged
                    # 3 = Attack MP       |  4 = Damaged MP    |  5 = Damaged E.
                    # 6 = Damage Status   |  7 = Restore Ally  |  8 = Feared En.
                    # 9 = Killed an enemy | 10 = Killed a Boss | 11 = Hero Died
                    #12 = Victory         | 13 = Escape/Flee   | 14 = Defending
                    #15 = Lone Combatant  | 16 = Any Action    | 17 = Crit. HP


  # Hidden Actors
  # =============
  # This array holds the ID number of Actors who hide their own limitbreak
  # gauges in both the battle and menu screens.
  #
  LB_HIDDEN_ACTORS  = []  

  
  # Hidden Bar
  # ==========
  # This makes the limitbreak gauge invisible for any actors who have no
  # limit break skills.
  #
  LB_NO_SKILL_HIDE  = true

  # Enemy Bosses (by ID)
  # ====================
  # Related to the LB_Rate, it determines if points garnered through 'killing'
  # an ememy gives regular 'enemy' points or 'boss' points to your LB gauge.
  #
  LB_BOSSES = []     # Emptied.  Not using it this time.
            
  
  # Feared Enemy (by ID)
  # ====================
  # Related to the LB_Rate, it determines if points are garnered when struck by
  # an especially feared enemy.
  #
  LB_FEARED   = 6     # Set to enemy 6 (Willowisp)
                    
  
  # Element Weakness (by ID)
  # ========================
  # Related to the LB_Rate, it determines if points are garnered when hit by
  # an attack with a specific elemental trait, like fire, water, etc.
  #
  LB_WEAKNESS = 11    # Set to element 11 (Thunder)
  
  
  # Limit Break Death Wipe                
  # ======================
  # This supercedes the LB_RATE condition for the 'Hero Died' setting.
  #
  LB_D_WIPE = true    # If true, death wipes out their LB points.
  
  

   #========================================================================
   #            C O N F I G U R A T I O N   S Y S T E M   E N D            #
   #========================================================================



#==============================================================================
# ** TAG CONSTANT
#------------------------------------------------------------------------------
#  Constant value(s) used to gain data from the 'note' section.
#==============================================================================

# Used for 'note-tagged' Limit Breaks
Note_LimitBreak = LB_NAME



#==============================================================================
# ** RPG
#------------------------------------------------------------------------------
#  A module containing RPGVX Data Structures.
#==============================================================================

module RPG
  #==========================================================================
==
  # ** Skill
  #----------------------------------------------------------------------------
  #  Data class for skills.
  #==========================================================================
==
  
  class Skill < RPG::UsableItem
    #--------------------------------------------------------------------------
    # * Set Limit Break Type
    #--------------------------------------------------------------------------
    def setup_limitbreak
      @__is_limitbreak = false
      self.note.split(/[rn]+/).each { |line|
          @__is_limitbreak = true if line =~ Note_LimitBreak  }
    end
    #--------------------------------------------------------------------------
    # * Obtain Limit Break Flag
    #--------------------------------------------------------------------------
    def limitbreak?
      setup_limitbreak if @__is_limitbreak == nil
      return @__is_limitbreak
    end
  end
end



#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles system-related data. Also manages vehicles and BGM, etc.
# The instance of this class is referenced by $game_system.
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :lb_menu                  # bars in menu flag
  attr_accessor :lb_menu_pos              # menu bar positioning
  attr_accessor :lb_battle_pos            # battle bar positioning
  attr_accessor :lb_hidden_actors         # bars hidden
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias lb_init initialize  
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    # Perform the original call
    lb_init
    @lb_menu          = LB_MENU_ON
    @lb_menu_pos      = LB_MENU_POS
    @lb_battle_pos    = LB_BATTLE_POS
    @lb_hidden_actors = LB_HIDDEN_ACTORS
  end
end



#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  This class deals with battlers. It's used as a superclass of the Game_Actor
# and Game_Enemy classes.
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias lb_add_state add_state
  alias lb_skill_can_use? skill_can_use?
  alias lb_execute_damage execute_damage
  alias lb_apply_state_changes apply_state_changes
  #--------------------------------------------------------------------------
  # * Add State
  #     state_id : state ID
  #--------------------------------------------------------------------------
  def add_state(state_id)
    # Perform the original call
    lb_add_state(state_id)
    # Perform Conditional Decrease
    self.limitbreak = 0 if dead? && LB_D_WIPE
  end
  #--------------------------------------------------------------------------
  # * Determine Usable Skills
  #     skill : skill
  #--------------------------------------------------------------------------
  def skill_can_use?(skill)
    return false unless lb_skill_can_use?(skill)                # Standard
    return false if @limitbreak != LB_MAX && skill.limitbreak?  # Limit Break
    return true
  end
  #--------------------------------------------------------------------------
  # * Damage Reflection
  #     user : User of skill or item
  #    @hp_damage, @mp_damage, or @absorbed must be calculated before this
  #    method is called.
  #--------------------------------------------------------------------------
  def execute_damage(user)
    # Perform the original call
    lb_execute_damage(user)
    # Perform Conditional Increase
    return unless user.is_a?(Game_Battler)
    return if self.class == user.class
    return if hp_damage == 0 && mp_damage == 0
    increase_attacker_limitbreak(user)    if user.lb_type ==  0 # Attack
    increase_critical_limitbreak(user)    if user.lb_type ==  1 # Critical
    increase_damaged_limitbreak           if self.lb_type ==  2 # Damaged
    increase_mp_attacker_limitbreak(user) if user.lb_type ==  3 # Attack MP
    increase_mp_damaged_limitbreak        if self.lb_type ==  4 # Damaged MP
    increase_e_damaged_limitbreak(user)   if self.lb_type ==  5 # Damaged Element
    increase_restore_limitbreak(user)     if user.lb_type ==  7 # Restore Health
    increase_feared_limitbreak(user)      if self.lb_type ==  8 # Restore Health
    increase_enemy_limitbreak(user)       if user.lb_type ==  9 # Enemy
    increase_boss_limitbreak(user)        if user.lb_type == 10 # Boss
    increase_hero_limitbreak(user)        if user.lb_type == 11 # Hero
    # Perform Conditional Decrease
    self.limitbreak = 0 if dead? && LB_D_WIPE
  end
  #--------------------------------------------------------------------------
  # * Apply State Changes
  #     obj : Skill, item, or attacker
  #--------------------------------------------------------------------------  
  def apply_state_changes(obj)
    increase_s_damaged_limitbreak if self.lb_type == 6  && obj.plus_state_set.empty?
    # Perform the original call
    lb_apply_state_changes(obj)
  end
  #--------------------------------------------------------------------------
  # * Limit Break Increase:  Attack
  #     attacker : attacker
  #--------------------------------------------------------------------------
  def increase_attacker_limitbreak(attacker)
    lb_calc = (hp_damage * 5 * LB_RATE[0]) / 100
    lb_add  = [[lb_calc, LB_RATE[1]].max, LB_RATE[2]].min
    attacker.limitbreak += lb_add
  end
  #--------------------------------------------------------------------------
  # * Limit Break Increase:  Critical Hit
  #     attacker : attacker
  #--------------------------------------------------------------------------
  def increase_critical_limitbreak(attacker)
    lb_calc = (hp_damage * 5 * LB_RATE[3]) / 100
    lb_add  = [[lb_calc, LB_RATE[4]].max, LB_RATE[5]].min
    attacker.limitbreak += lb_add
  end  
  #--------------------------------------------------------------------------
  # * Limit Break Increase:  Damaged/Struck
  #     attacker : attacker
  #--------------------------------------------------------------------------
  def increase_damaged_limitbreak
    lb_calc = (hp_damage * 5 * LB_RATE[6]) / self.maxhp
    lb_add  = [[lb_calc, LB_RATE[7]].max, LB_RATE[8]].min
    self.limitbreak += lb_add
  end
  #--------------------------------------------------------------------------
  # * Limit Break Increase:  MP Attack
  #     attacker : attacker
  #--------------------------------------------------------------------------
  def increase_mp_attacker_limitbreak(attacker)
    lb_calc = (mp_damage * 5 * LB_RATE[9]) / 100
    lb_add  = [[lb_calc, LB_RATE[10]].max, LB_RATE[11]].min
    attacker.limitbreak += lb_add
  end
  #--------------------------------------------------------------------------
  # * Limit Break Increase:  MP Drained
  #     attacker : attacker
  #--------------------------------------------------------------------------
  def increase_mp_damaged_limitbreak
    lb_calc = (mp_damage * 5 * LB_RATE[12]) / self.maxmp
    lb_add  = [[lb_calc, LB_RATE[13]].max, LB_RATE[14]].min
    self.limitbreak += lb_add
  end  
  #--------------------------------------------------------------------------
  # * Limit Break Increase:  Elementally Damaged
  #     attacker : attacker
  #--------------------------------------------------------------------------
  def increase_e_damaged_limitbreak(attacker)
    lb_e_check = false
    case attacker.action.kind
    when 0; lb_e_check = true if attacker.element_rate(self.lb_weakness) > 100
    when 1; lb_e_check = true if attacker.action.skill.element_set.include?(self.lb_weakness)
    when 2; lb_e_check = true if attacker.action.item.element_set.include?(self.lb_weakness)
    end
    return unless lb_e_check
    lb_calc = (hp_damage * 5 * LB_RATE[15]) / self.maxhp
    lb_add  = [[lb_calc, LB_RATE[16]].max, LB_RATE[17]].min
    self.limitbreak += lb_add
  end  
  #--------------------------------------------------------------------------
  # * Limit Break Increase:  Status Effect
  #     attacker : attacker
  #--------------------------------------------------------------------------
  def increase_s_damaged_limitbreak
    self.limitbreak += LB_RATE[18]
  end    
  #--------------------------------------------------------------------------
  # * Limit Break Increase:  Restore
  #     attacker : attacker
  #--------------------------------------------------------------------------
  def increase_restore_limitbreak(attacker)
    if attacker.is_a?(Game_Actor) && self.is_a?(Game_Actor) && self != attacker
      attacker.limitbreak += LB_RATE[19] if hp_damage < 0
    end
  end
  #--------------------------------------------------------------------------
  # * Limit Break Increase:  Feared Enemy
  #     attacker : attacker
  #--------------------------------------------------------------------------
  def increase_feared_limitbreak(attacker)
    return if attacker.is_a?(Game_Actor)
    if self.lb_feared == attacker.enemy_id
      self.limitbreak += LB_RATE[20]
    end
  end    
  
  #--------------------------------------------------------------------------
  # * Limit Break Increase:  Killed Enemy
  #     attacker : attacker
  #--------------------------------------------------------------------------
  def increase_enemy_limitbreak(attacker)
    if self.is_a?(Game_Enemy) && self.dead?
      attacker.limitbreak += LB_RATE[21]
    end
  end  
  #--------------------------------------------------------------------------
  # * Limit Break Increase:  Killed Boss
  #     attacker : attacker
  #--------------------------------------------------------------------------
  def increase_boss_limitbreak(attacker)
    if self.is_a?(Game_Enemy) && self.dead?
      if LB_BOSSES.include?(self.enemy_id)
        attacker.limitbreak += LB_RATE[22]
      end
    end
  end  
  #--------------------------------------------------------------------------
  # * Limit Break Increase:  Killed Hero
  #     attacker : attacker
  #--------------------------------------------------------------------------
  def increase_hero_limitbreak(attacker)
    if self.is_a?(Game_Actor) && self.dead?
      self.limitbreak += LB_RATE[23]
    end
  end    
end



#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles actors. It's used within the Game_Actors class
# ($game_actors) and referenced by the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------  
  attr_accessor :lb_type                  # Limitbreak action type
  attr_accessor :lb_weakness              # Limitbreak element weakness
  attr_accessor :lb_feared                # Limitbreak feared enemy
  attr_accessor :lb_ringer                # Limit Break Ring Checker
  attr_accessor :lb_battle_started        # Limit Break Start System
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias lb_setup setup
  #--------------------------------------------------------------------------
  # * Setup
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  def setup(actor_id)
    # Perform the original call
    lb_setup(actor_id)
    @limitbreak         = 0           # Initialize an empty limibreak gauge
    @lb_type            = LB_START    # Set the 'configured' limitbreak type
    @lb_weakness        = LB_WEAKNESS # Set the 'configured' weakness element
    @lb_feared          = LB_FEARED   # Set the 'configured' feared enemy
    @lb_ringer          = false       # Initialize a turned-off ringer flag
    @lb_battle_started  = false       # Initialize the battle start flag
  end
  #--------------------------------------------------------------------------
  # * Adjust the limitbreak value (permits addition & keeps within range)
  #--------------------------------------------------------------------------
  def limitbreak=(limitbreak)
    @limitbreak = limitbreak
    @limitbreak = LB_MAX if @limitbreak > LB_MAX
    @limitbreak = 0 if @limitbreak < 0
  end
  #--------------------------------------------------------------------------
  # * Acquire Limit Break value (nil values won't cause errors now)
  #--------------------------------------------------------------------------
  def limitbreak
    # Return 0 if nil (prevent errors)
    @limitbreak = 0 if @limitbreak == nil
    return @limitbreak
  end  
  #--------------------------------------------------------------------------
  # * Adjust the limitbreak weakness value
  #--------------------------------------------------------------------------
  def lb_weakness=(lb_weakness)
    @lb_weakness = lb_weakness
    @lb_weakness = 0 if @lb_weakness == nil
  end
  #--------------------------------------------------------------------------
  # * Acquire Limit Break weakness (nil values won't cause errors now)
  #--------------------------------------------------------------------------
  def lb_weakness
    # Return 0 if nil (prevent errors)
    @lb_weakness = 0 if @lb_weakness == nil
    return @lb_weakness
  end    
  #--------------------------------------------------------------------------
  # * Adjust the limitbreak feared enemy value
  #--------------------------------------------------------------------------
  def lb_feared=(lb_feared)
    @lb_feared = lb_feared
    @lb_feared = 0 if @lb_feared == nil
  end
  #--------------------------------------------------------------------------
  # * Acquire Limit Break weakness (nil values won't cause errors now)
  #--------------------------------------------------------------------------
  def lb_feared
    # Return 0 if nil (prevent errors)
    @lb_feared = 0 if @lb_feared == nil
    return @lb_feared
  end  
  #--------------------------------------------------------------------------
  # * Determine if Limit Break skill
  #--------------------------------------------------------------------------
  def limitbreak_skill?
    result = false
    last_in_battle = $game_temp.in_battle
    $game_temp.in_battle = false
    self.skills.each { |skill|
      if skill.limitbreak?
        result = true
        break
      end
    }
    $game_temp.in_battle = last_in_battle
    return result
  end
  #--------------------------------------------------------------------------
  # * Determine if gauge visible
  #--------------------------------------------------------------------------
  def lb_gauge_visible?
    return false  if !$game_system.lb_menu && !$game_temp.in_battle
    return false  if $game_system.lb_hidden_actors.include?(self.id)
    return false  if !limitbreak_skill? && LB_NO_SKILL_HIDE
    return true
  end
end



#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
#  This class handles enemy characters. It's used within the Game_Troop class
# ($game_troop).
#==============================================================================

class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------  
  attr_accessor :limitbreak               # Limitbreak gauge
  attr_accessor :lb_type                  # Limitbreak action type  
  attr_accessor :lb_weakness              # Limitbreak element weakness
  attr_accessor :lb_feared                # Limitbreak feared enemy
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias lb_jnitialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     index    : index in troop
  #     enemy_id : enemy ID
  #--------------------------------------------------------------------------
  def initialize(index, enemy_id)
    # Perform the original call
    lb_jnitialize(index, enemy_id)
    @limitbreak = 0
    @lb_type = nil
    @lb_weakness = nil
    @lb_feared = nil
  end
end



#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  This is a superclass of all windows in the game.
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias lb_draw_actor_name draw_actor_name
  #--------------------------------------------------------------------------
  # * Draw Name
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #--------------------------------------------------------------------------
  def draw_actor_name(actor, x, y)
    # Set/reset the x, y and width of the Limit Break bar.    
    ox = $game_temp.in_battle ? $game_system.lb_battle_pos[0] : $game_system.lb_menu_pos[0]
    oy = $game_temp.in_battle ? $game_system.lb_battle_pos[1] : $game_system.lb_menu_pos[1]
    ow = $game_temp.in_battle ? $game_system.lb_battle_pos[2] : $game_system.lb_menu_pos[2]
    # Draw bar based on positioning (if bars are on)
    draw_actor_lb(actor, x + ox, y + oy, ow) if LB_BARS_ON
    # Perform the original call
    lb_draw_actor_name(actor, x, y)
  end
  #--------------------------------------------------------------------------
  # * Get LB Gauge Color 1
  #--------------------------------------------------------------------------
  def lb_gauge_normal_start_color
    color = LB_BAR_Norm_Start
    return (color.is_a?(Integer) ? text_color(color) : color)
  end
  #--------------------------------------------------------------------------
  # * Get LB Gauge Color 2
  #--------------------------------------------------------------------------
  def lb_gauge_normal_end_color
    color = LB_BAR_Norm_End
    return (color.is_a?(Integer) ? text_color(color) : color)
  end
  #--------------------------------------------------------------------------
  # * Get LB Max Gauge Color 1
  #--------------------------------------------------------------------------
  def lb_gauge_max_start_color
    color = LB_BAR_Max_Start
    return (color.is_a?(Integer) ? text_color(color) : color)
  end
  #--------------------------------------------------------------------------
  # * Get LB Max Gauge Color 2
  #--------------------------------------------------------------------------
  def lb_gauge_max_end_color
    color = LB_BAR_Max_End
    return (color.is_a?(Integer) ? text_color(color) : color)
  end
  #--------------------------------------------------------------------------
  # * Draw Limitbreak Bar
  #     actor  : actor
  #     x      : draw spot x-coordinate
  #     y      : draw spot y-coordinate
  #     width  : bar width
  #     height : bar height
  #--------------------------------------------------------------------------
  def draw_actor_lb(actor, x, y, width = 120)
    return unless actor.lb_gauge_visible?
    gw = width * actor.limitbreak / LB_MAX
    gc1 = (gw == width ? lb_gauge_max_start_color : lb_gauge_normal_start_color)
    gc2 = (gw == width ? lb_gauge_max_end_color : lb_gauge_normal_end_color)
    self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
    self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
  end  
end



#==============================================================================
# ** Scene_Skill
#------------------------------------------------------------------------------
#  This class performs the skill screen processing.
#==============================================================================

class Scene_Skill < Scene_Base
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias lb_use_skill_nontarget use_skill_nontarget
  #--------------------------------------------------------------------------
  # * Use Skill (apply effects to non-ally targets)
  #--------------------------------------------------------------------------
  def use_skill_nontarget
    # Use up/empty the bar
    @actor.limitbreak = 0 if @skill.limitbreak?
    # Perform the original call
    lb_use_skill_nontarget
  end
end



#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias lb_battle_end battle_end
  alias lb_process_action process_action
  alias lb_execute_action execute_action
  alias lb_execute_action_skill execute_action_skill
  #--------------------------------------------------------------------------
  # * End Battle
  #     result : Results (0: win, 1: escape, 2:lose)
  #--------------------------------------------------------------------------
  def battle_end(result)
    case result
    when 0  # Victory
      $game_party.existing_members.each { |actor|
      actor.limitbreak += LB_RATE[24] if actor.lb_type == 12 }
    when 1  # Escape
      $game_party.existing_members.each { |actor|
      actor.limitbreak += LB_RATE[25] if actor.lb_type == 13 }
    end
    # Perform the original call
    lb_battle_end(result)
  end
  #--------------------------------------------------------------------------
  # * Battle Action Processing
  #--------------------------------------------------------------------------
  def process_action  
  lb_process_action
  # Go through the Actors
    $game_party.members.each { |actor|
      # Only perform if the actor exists
      next unless actor.exist?
      # When the Limit Break gauge is set to zero,
      # Reset the Limit Break Ringer to false
      if actor.limitbreak == 0
        actor.lb_ringer = false
      end
      # When the Limit Break Ringer hasn't rung
      if actor.lb_ringer == false
        # But, if the Limit Break Bar is filled
        if actor.limitbreak == LB_MAX
          # Only show for visible gauges
          if actor.lb_gauge_visible?
            # If the battle only just started
            if actor.lb_battle_started == true
              # turn off the battle started flag
              actor.lb_battle_started = false
            else
              # Play the Limit Break Sound Effect
              full_lb_se
            end
          end
          # And Set the Limit Break Ringer to true
          actor.lb_ringer = true
        end
      end
      }
  end  
  #--------------------------------------------------------------------------
  # * Execute Battle Actions
  #--------------------------------------------------------------------------
  def execute_action
    if @active_battler.is_a?(Game_Actor)
      lb_add = 0
      # Defending
      lb_add += LB_RATE[26] if @active_battler.lb_type == 14 && @active_battler.action.basic == 1
      # Alone
      lb_add += LB_RATE[27] if @active_battler.lb_type == 15 && $game_party.existing_members.size == 1
      # Action
      lb_add += LB_RATE[28] if @active_battler.lb_type == 16
      # Fatal
      lb_add += LB_RATE[29] if @active_battler.lb_type == 17 && @active_battler.hp < @active_battler.maxhp / 4
      @active_battler.limitbreak += lb_add
    end
    # Perform the original call
    lb_execute_action
  end
  #--------------------------------------------------------------------------
  # * Execute Battle Action: Skill
  #--------------------------------------------------------------------------
  def execute_action_skill
    # Perform the original call
    lb_execute_action_skill
    skill = @active_battler.action.skill
    @active_battler.limitbreak = 0 if skill.limitbreak?
  end
  #--------------------------------------------------------------------------
  # * Full Limit Break Gauge SE
  #--------------------------------------------------------------------------
  def full_lb_se
    if LB_RING != nil
      if LB_RING != ""
        Audio.se_play("Audio/SE/" + LB_RING, 80, 100)
      end
    end
  end    
end
끝!!!!!!!!!!!!!!!!!!!!
And KGC's
시작!!!!!!!!!!!

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ ◆ オーバードライブ - KGC_OverDrive ◆ VX ◆
#_/ ◇ Last update : 2008/06/22 ◇
#_/----------------------------------------------------------------------------
#_/ 専用のゲージを消費して使用するスキルを作成します。
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#==============================================================================
# ★ カスタマイズ項目 - Customize ★
#==============================================================================

module KGC
module OverDrive
# ◆ ドライブゲージ最大値
# 普通はこのままでOK。微調整したい場合に変更。
GAUGE_MAX = 1000
# ◆ ドライブゲージ増加量
# 高いほどゲージが溜まりやすい。
# マイナス値を指定すると減少。
# 「被ダメージ」は、受けたダメージの最大 HP に対する割合で増加量を算出。
# (500 だと、最大 HP 相当のダメージで 500 溜まる)
GAIN_RATE = [
80, # 攻撃
500, # 被ダメージ
200, # 勝利
100, # 逃走
160, # 孤独
40, # 行動
160, # 瀕死
] # ← この ] は消さないこと!

# ◆ アクターのデフォルトドライブタイプ
# 0..攻撃 1..被ダメージ 2..勝利 3..逃走 4..孤独 5..行動 6..瀕死
DEFAULT_ACTOR_DRIVE_TYPE = [0, 1, 6]
# ◆ エネミーのデフォルトドライブタイプ
DEFAULT_ENEMY_DRIVE_TYPE = [0, 1, 4, 5, 6]

# ◆ ドライブゲージの開始色 (通常時)
# 数値 : C[n] と同じ色。
# Color : 指定した色。 ( Color.new(255, 128, 128) など )
GAUGE_NORMAL_START_COLOR = 14
# ◆ ドライブゲージの終了色 (通常時)
GAUGE_NORMAL_END_COLOR = 6
# ◆ ドライブゲージの開始色 (最大時)
GAUGE_MAX_START_COLOR = 10
# ◆ ドライブゲージの終了色 (最大時)
GAUGE_MAX_END_COLOR = 2

# ◆ 死亡(HP 0)時にドライブゲージを 0 にする
EMPTY_ON_DEAD = true

# ◆ ドライブゲージを表示しないアクター
# ゲージを隠すアクターのIDを配列に格納。
HIDE_GAUGE_ACTOR = []
# ◆ 非戦闘時はドライブゲージを隠す
HIDE_GAUGE_NOT_IN_BATTLE = false
# ◆ オーバードライブスキル未修得ならゲージを隠す
HIDE_GAUGE_NO_OD_SKILLS = true
# ◆ ゲージを隠している場合はゲージを増加させない
NOT_GAIN_GAUGE_HIDING = true

# ◆ ゲージ不足のときはオーバードライブスキルを隠す
HIDE_SKILL_LACK_OF_GAUGE = false
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

$imported = {} if $imported == nil
$imported["OverDrive"] = true

module KGC::OverDrive
# ドライブタイプ
module Type
ATTACK = 0 # 攻撃
DAMAGE = 1 # 被ダメージ
VICTORY = 2 # 勝利
ESCAPE = 3 # 逃走
ALONE = 4 # 孤独
ACTION = 5 # 行動
FATAL = 6 # 瀕死
end

# 正規表現
module Regexp
# スキル
module Skill
# オーバードライブ
OVER_DRIVE = /<(?:OVER_DRIVE|オーバードライブ)s*(d+)?>/i
# ゲージ増加率
OD_GAIN_RATE = /<(?:OD_GAIN_RATE|ODゲージ増加率)s*(d+)[%%]?>/i
end
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# □ KGC::Commands
#==============================================================================

module KGC::Commands
module_function
#--------------------------------------------------------------------------
# ○ アクターのドライブゲージの増減
# actor_id : アクター ID (-1 : パーティ全体)
# value : 増加量 (マイナスも可)
#--------------------------------------------------------------------------
def gain_actor_od_gauge(actor_id, value)
if actor_id == -1
# 生存メンバー全員のゲージを操作
$game_party.existing_members.each { |actor|
actor.overdrive += value
}
else
actor = $game_actors[actor_id]
actor.overdrive += value if actor != nil && actor.exist?
end
end
#--------------------------------------------------------------------------
# ○ エネミーのドライブゲージの増減
# enemy_index : エネミー index (-1 : 全体)
# value : 増加量 (マイナスも可)
#--------------------------------------------------------------------------
def gain_enemy_od_gauge(enemy_index, value)
if enemy_index == -1
# 生存エネミー全員のゲージを操作
$game_troop.existing_members.each { |enemy|
enemy.overdrive += value
}
else
enemy = $game_troop.members[enemy_index]
enemy.overdrive += value if enemy != nil && enemy.exist?
end
end
#--------------------------------------------------------------------------
# ○ アクターのドライブゲージの取得
# actor_id : アクター ID
# variable_id : 戻り値を格納する変数 ID
#--------------------------------------------------------------------------
def get_actor_od_gauge(actor_id, variable_id = 0)
actor = $game_actors[actor_id]
n = (actor != nil ? actor.overdrive : 0)
if variable_id > 0
$game_variables[variable_id] = n
end
return n
end
#--------------------------------------------------------------------------
# ○ エネミーのドライブゲージの取得
# enemy_index : エネミー index
# variable_id : 戻り値を格納する変数 ID
#--------------------------------------------------------------------------
def get_enemy_od_gauge(enemy_index, variable_id = 0)
enemy = $game_troop.members[enemy_index]
n = (enemy != nil ? enemy.overdrive : 0)
if variable_id > 0
$game_variables[variable_id] = n
end
return n
end
#--------------------------------------------------------------------------
# ○ アクターのドライブゲージが最大か判定
# actor_id : アクター ID
#--------------------------------------------------------------------------
def actor_od_gauge_max?(actor_id)
actor = $game_actors[actor_id]
return false if actor == nil
return actor.overdrive == actor.max_overdrive
end
#--------------------------------------------------------------------------
# ○ エネミーのドライブゲージが最大か判定
# enemy_index : エネミー index
#--------------------------------------------------------------------------
def enemy_od_gauge_max?(enemy_index)
enemy = $game_troop.members[enemy_index]
return false if enemy == nil
return enemy.overdrive == enemy.max_overdrive
end
#--------------------------------------------------------------------------
# ○ アクターのドライブタイプの変更
# actor_id : アクター ID (-1 : パーティ全体)
# types : ドライブタイプの配列 (省略時 : 初期化)
#--------------------------------------------------------------------------
def set_actor_drive_type(actor_id, types = nil)
if actor_id == -1
# メンバー全員のドライブタイプを変更
$game_party.members.each { |actor|
actor.drive_type = types
}
else
actor = $game_actors[actor_id]
actor.drive_type = types if actor != nil
end
end
#--------------------------------------------------------------------------
# ○ エネミーのドライブタイプの変更
# enemy_index : エネミー index (-1 : 全体)
# types : ドライブタイプの配列 (省略時 : 初期化)
#--------------------------------------------------------------------------
def set_enemy_drive_type(enemy_index, types = nil)
if enemy_index == -1
# エネミー全員のドライブタイプを変更
$game_troop.members.each { |enemy|
enemy.drive_type = types
}
else
enemy = $game_troop.members[enemy_index]
enemy.drive_type = types if enemy != nil
end
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

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

class RPG::Skill < RPG::UsableItem
#--------------------------------------------------------------------------
# ○ オーバードライブのキャッシュ生成
#--------------------------------------------------------------------------
def create_overdrive_cache
@__is_overdrive = false
@__od_cost = KGC::OverDrive::GAUGE_MAX
@__od_gain_rate = 100

self.note.split(/[rn]+/).each { |line|
case line
when KGC::OverDrive::Regexp::Skill::OVER_DRIVE
# オーバードライブ
@__is_overdrive = true
@__od_cost = $1.to_i if $1 != nil
when KGC::OverDrive::Regexp::Skill::OD_GAIN_RATE
# ゲージ増加率
@__od_gain_rate = $1.to_i
end
}

# OverDrive でなければ、ゲージ消費量 0
unless @__is_overdrive
@__od_cost = 0
end
end
#--------------------------------------------------------------------------
# ○ OverDrive スキルであるか
#--------------------------------------------------------------------------
def overdrive?
create_overdrive_cache if @__is_overdrive == nil
return @__is_overdrive
end
#--------------------------------------------------------------------------
# ○ ドライブゲージ消費量
#--------------------------------------------------------------------------
def od_cost
create_overdrive_cache if @__od_cost == nil
return @__od_cost
end
#--------------------------------------------------------------------------
# ○ ドライブゲージ増加率
#--------------------------------------------------------------------------
def od_gain_rate
create_overdrive_cache if @__od_gain_rate == nil
return @__od_gain_rate
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

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

class Game_Battler
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_writer :drive_type # ドライブタイプ
#--------------------------------------------------------------------------
# ○ ドライブゲージ量取得
#--------------------------------------------------------------------------
def overdrive
@overdrive = 0 if @overdrive == nil
return @overdrive
end
#--------------------------------------------------------------------------
# ○ ドライブゲージ最大量取得
#--------------------------------------------------------------------------
def max_overdrive
return KGC::OverDrive::GAUGE_MAX
end
#--------------------------------------------------------------------------
# ○ ドライブゲージの操作
#--------------------------------------------------------------------------
def overdrive=(value)
@overdrive = [[value, max_overdrive].min, 0].max
end
#--------------------------------------------------------------------------
# ○ ドライブタイプの取得
#--------------------------------------------------------------------------
def drive_type
return []
end
#--------------------------------------------------------------------------
# ○ OverDrive スキル習得済み判定
#--------------------------------------------------------------------------
def overdrive_skill_learned?
return true
end
#--------------------------------------------------------------------------
# ○ ゲージ表示判定
#--------------------------------------------------------------------------
def od_gauge_visible?
return false
end
#--------------------------------------------------------------------------
# ○ ゲージ増加可否判定
#--------------------------------------------------------------------------
def can_gain_overdrive?
return true
end
#--------------------------------------------------------------------------
# ○ 攻撃時増加判定
#--------------------------------------------------------------------------
def drive_attack?
return drive_type.include?(KGC::OverDrive::Type::ATTACK)
end
#--------------------------------------------------------------------------
# ○ 被ダメージ時増加判定
#--------------------------------------------------------------------------
def drive_damage?
return drive_type.include?(KGC::OverDrive::Type::DAMAGE)
end
#--------------------------------------------------------------------------
# ○ 勝利時増加判定
#--------------------------------------------------------------------------
def drive_victory?
return drive_type.include?(KGC::OverDrive::Type::VICTORY)
end
#--------------------------------------------------------------------------
# ○ 逃走時増加判定
#--------------------------------------------------------------------------
def drive_escape?
return drive_type.include?(KGC::OverDrive::Type::ESCAPE)
end
#--------------------------------------------------------------------------
# ○ 孤独時増加判定
#--------------------------------------------------------------------------
def drive_alone?
return drive_type.include?(KGC::OverDrive::Type::ALONE)
end
#--------------------------------------------------------------------------
# ○ 行動時増加判定
#--------------------------------------------------------------------------
def drive_action?
return drive_type.include?(KGC::OverDrive::Type::ACTION)
end
#--------------------------------------------------------------------------
# ○ 瀕死時増加判定
#--------------------------------------------------------------------------
def drive_fatal?
return drive_type.include?(KGC::OverDrive::Type::FATAL)
end
#--------------------------------------------------------------------------
# ● ステートの付加
# state_id : ステート ID
#--------------------------------------------------------------------------
alias add_state_KGC_OverDrive add_state
def add_state(state_id)
add_state_KGC_OverDrive(state_id)

reset_overdrive_on_dead if dead?
end
#--------------------------------------------------------------------------
# ○ スキルの消費ドライブゲージ計算
# skill : スキル
#--------------------------------------------------------------------------
def calc_od_cost(skill)
return 0 unless skill.is_a?(RPG::Skill)

return skill.od_cost
end
#--------------------------------------------------------------------------
# ● スキルの使用可能判定
# skill : スキル
#--------------------------------------------------------------------------
alias skill_can_use_KGC_OverDrive? skill_can_use?
def skill_can_use?(skill)
return false unless skill_can_use_KGC_OverDrive?(skill)

return false if calc_od_cost(skill) > overdrive
return true
end
#--------------------------------------------------------------------------
# ● ダメージの反映
# user : スキルかアイテムの使用者
# 呼び出し前に @hp_damage、@mp_damage、@absorbed が設定されていること。
#--------------------------------------------------------------------------
alias execute_damage_KGC_OverDrive execute_damage
def execute_damage(user)
execute_damage_KGC_OverDrive(user)

increase_overdrive(user)
end
#--------------------------------------------------------------------------
# ○ 死亡時ドライブゲージ初期化処理
#--------------------------------------------------------------------------
def reset_overdrive_on_dead
return unless KGC::OverDrive::EMPTY_ON_DEAD

self.overdrive = 0
end
#--------------------------------------------------------------------------
# ○ ドライブゲージ増加処理
# attacker : 攻撃者
#--------------------------------------------------------------------------
def increase_overdrive(attacker = nil)
return unless attacker.is_a?(Game_Battler) # 攻撃者がバトラーでない
return if self.class == attacker.class # 攻撃側と防御側が同じ
return if hp_damage == 0 && mp_damage == 0 # ダメージなし

if can_gain_overdrive?
increase_attacker_overdrive(attacker)
increase_defender_overdrive(attacker)
end
reset_overdrive_on_dead if dead?
end
#--------------------------------------------------------------------------
# ○ 攻撃側のドライブゲージ増加処理
# attacker : 攻撃者
#--------------------------------------------------------------------------
def increase_attacker_overdrive(attacker)
return unless attacker.drive_attack? # ドライブタイプ「攻撃」なし

od_gain = KGC::OverDrive::GAIN_RATE[KGC::OverDrive::Type::ATTACK]
if attacker.action.kind == 1
rate = attacker.action.skill.od_gain_rate # スキルの倍率を適用
od_gain = od_gain * rate / 100
if rate > 0
od_gain = [od_gain, 1].max
elsif rate < 0
od_gain = [od_gain, -1].min
end
end
attacker.overdrive += od_gain
end
#--------------------------------------------------------------------------
# ○ 防御側のドライブゲージ増加処理
# attacker : 攻撃者
#--------------------------------------------------------------------------
def increase_defender_overdrive(attacker)
return unless self.drive_damage? # ドライブタイプ「ダメージ」なし

rate = KGC::OverDrive::GAIN_RATE[KGC::OverDrive::Type::DAMAGE]
od_gain = 0
od_gain += hp_damage * rate / maxhp if hp_damage > 0
od_gain += mp_damage * rate / maxmp if mp_damage > 0 && maxmp > 0
if rate > 0
od_gain = [od_gain, 1].max
elsif rate < 0
od_gain = [od_gain, -1].min
end
self.overdrive += od_gain
end
#--------------------------------------------------------------------------
# ● スキルの効果適用
# user : スキルの使用者
# skill : スキル
#--------------------------------------------------------------------------
alias skill_effect_KGC_OverDrive skill_effect
def skill_effect(user, skill)
skill_effect_KGC_OverDrive(user, skill)

# アイテムでスキルを発動した場合はゲージ消費判定を無視
if $imported["ReproduceFunctions"] && $game_temp.exec_skill_on_item
return
end
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● セットアップ
# actor_id : アクター ID
#--------------------------------------------------------------------------
alias setup_KGC_OverDrive setup
def setup(actor_id)
setup_KGC_OverDrive(actor_id)

@overdrive = 0
@drive_type = nil
end
#--------------------------------------------------------------------------
# ○ OverDrive タイプの取得
#--------------------------------------------------------------------------
def drive_type
unless @drive_type.is_a?(Array)
return KGC::OverDrive::DEFAULT_ACTOR_DRIVE_TYPE
end
return @drive_type
end
#--------------------------------------------------------------------------
# ○ OverDrive スキル習得済み判定
#--------------------------------------------------------------------------
def overdrive_skill_learned?
result = false
# 一時的に戦闘中フラグを解除
last_in_battle = $game_temp.in_battle
$game_temp.in_battle = false

self.skills.each { |skill|
if skill.overdrive?
result = true
break
end
}
$game_temp.in_battle = last_in_battle
return result
end
#--------------------------------------------------------------------------
# ○ ゲージ増加可否判定
#--------------------------------------------------------------------------
def can_gain_overdrive?
if KGC::OverDrive::NOT_GAIN_GAUGE_HIDING
# 非表示
return false if KGC::OverDrive::HIDE_GAUGE_ACTOR.include?(self.id)
end
if KGC::OverDrive::HIDE_GAUGE_NO_OD_SKILLS
# 未修得
return false unless overdrive_skill_learned?
end

return true
end
#--------------------------------------------------------------------------
# ○ ゲージ表示判定
#--------------------------------------------------------------------------
def od_gauge_visible?
# 戦闘中非表示
if KGC::OverDrive::HIDE_GAUGE_NOT_IN_BATTLE && !$game_temp.in_battle
return false
end
# 非表示
return false if KGC::OverDrive::HIDE_GAUGE_ACTOR.include?(self.id)
# ゲージ増加不可
return false unless can_gain_overdrive?

return true
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Game_Enemy
#==============================================================================

class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# index : 敵グループ内インデックス
# enemy_id : 敵キャラ ID
#--------------------------------------------------------------------------
alias initialize_KGC_OverDrive initialize
def initialize(index, enemy_id)
initialize_KGC_OverDrive(index, enemy_id)

@overdrive = 0
@drive_type = nil
end
#--------------------------------------------------------------------------
# ○ OverDrive タイプの取得
#--------------------------------------------------------------------------
def drive_type
unless @drive_type.is_a?(Array)
return KGC::OverDrive::DEFAULT_ENEMY_DRIVE_TYPE
end
return @drive_type
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_Base
#==============================================================================

class Window_Base < Window
#--------------------------------------------------------------------------
# ○ ドライブゲージの通常時の色 1 の取得
#--------------------------------------------------------------------------
def od_gauge_normal_color1
color = KGC::OverDrive::GAUGE_NORMAL_START_COLOR
return (color.is_a?(Integer) ? text_color(color) : color)
end
#--------------------------------------------------------------------------
# ○ ドライブゲージの通常時の色 2 の取得
#--------------------------------------------------------------------------
def od_gauge_normal_color2
color = KGC::OverDrive::GAUGE_NORMAL_END_COLOR
return (color.is_a?(Integer) ? text_color(color) : color)
end
#--------------------------------------------------------------------------
# ○ ドライブゲージの最大時の色 1 の取得
#--------------------------------------------------------------------------
def od_gauge_max_color1
color = KGC::OverDrive::GAUGE_MAX_START_COLOR
return (color.is_a?(Integer) ? text_color(color) : color)
end
#--------------------------------------------------------------------------
# ○ ドライブゲージの最大時の色 2 の取得
#--------------------------------------------------------------------------
def od_gauge_max_color2
color = KGC::OverDrive::GAUGE_MAX_END_COLOR
return (color.is_a?(Integer) ? text_color(color) : color)
end
#--------------------------------------------------------------------------
# ● 名前の描画
# actor : アクター
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
alias draw_actor_name_KGC_OverDrive draw_actor_name
def draw_actor_name(actor, x, y)
draw_actor_od_gauge(actor, x, y, 108)

draw_actor_name_KGC_OverDrive(actor, x, y)
end
#--------------------------------------------------------------------------
# ○ ドライブゲージの描画
# actor : アクター
# x : 描画先 X 座標
# y : 描画先 Y 座標
# width : 幅
#--------------------------------------------------------------------------
def draw_actor_od_gauge(actor, x, y, width = 120)
return unless actor.od_gauge_visible?

gw = width * actor.overdrive / actor.max_overdrive
gc1 = (gw == width ? od_gauge_max_color1 : od_gauge_normal_color1)
gc2 = (gw == width ? od_gauge_max_color2 : od_gauge_normal_color2)
self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_Skill
#==============================================================================

if KGC::OverDrive::HIDE_SKILL_LACK_OF_GAUGE

class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# ○ スキルをリストに含めるかどうか
# skill : スキル
#--------------------------------------------------------------------------
unless $@
alias include_KGC_OverDrive? include? if method_defined?(:include?)
end
def include?(skill)
return false if skill == nil

if defined?(include_KGC_OverDrive?)
return false unless include_KGC_OverDrive?(skill)
end

return false unless skill.overdrive?

return (@actor.calc_od_cost(skill) <= @actor.overdrive)
end

if method_defined?(:include_KGC_OverDrive?)
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
@data = []
for skill in @actor.skills
next unless include?(skill)
@data.push(skill)
if skill.id == @actor.last_skill_id
self.index = @data.size - 1
end
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
end

end # <-- class
end # <-- if KGC::OverDrive::HIDE_SKILL_LACK_OF_GAUGE

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Skill
#==============================================================================

class Scene_Skill < Scene_Base
#--------------------------------------------------------------------------
# ● スキルの使用 (味方対象以外の使用効果を適用)
#--------------------------------------------------------------------------
alias use_skill_nontarget_KGC_OverDrive use_skill_nontarget
def use_skill_nontarget
consume_od_gauge

use_skill_nontarget_KGC_OverDrive
end
#--------------------------------------------------------------------------
# ○ スキル使用時のドライブゲージ消費
#--------------------------------------------------------------------------
def consume_od_gauge
@actor.overdrive -= @actor.calc_od_cost(@skill)
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

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

class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● 戦闘終了
# result : 結果 (0:勝利 1:逃走 2:敗北)
#--------------------------------------------------------------------------
alias battle_end_KGC_OverDrive battle_end
def battle_end(result)
increase_overdrive_on_battle_end(result)

battle_end_KGC_OverDrive(result)
end
#--------------------------------------------------------------------------
# ○ 戦闘終了時のドライブゲージ増加処理
# result : 結果 (0:勝利 1:逃走 2:敗北)
#--------------------------------------------------------------------------
def increase_overdrive_on_battle_end(result)
case result
when 0 # 勝利
od_gain = KGC::OverDrive::GAIN_RATE[KGC::OverDrive::Type::VICTORY]
$game_party.existing_members.each { |actor|
actor.overdrive += od_gain if actor.drive_victory?
}
when 1 # 逃走
od_gain = KGC::OverDrive::GAIN_RATE[KGC::OverDrive::Type::ESCAPE]
$game_party.existing_members.each { |actor|
actor.overdrive += od_gain if actor.drive_escape?
}
end
end
#--------------------------------------------------------------------------
# ● 戦闘行動の実行
#--------------------------------------------------------------------------
alias execute_action_KGC_OverDrive execute_action
def execute_action
increase_overdrive_on_action

execute_action_KGC_OverDrive
end
#--------------------------------------------------------------------------
# ○ 行動時のドライブゲージ増加処理
#--------------------------------------------------------------------------
def increase_overdrive_on_action
battler = @active_battler
od_gain = 0
unit = (battler.actor? ? $game_party : $game_troop)

# 孤独戦闘
if battler.drive_alone? && unit.existing_members.size == 1
od_gain += KGC::OverDrive::GAIN_RATE[KGC::OverDrive::Type::ALONE]
end
# 行動
if battler.drive_action?
od_gain += KGC::OverDrive::GAIN_RATE[KGC::OverDrive::Type::ACTION]
end
# 瀕死
if battler.drive_fatal? && battler.hp < battler.maxhp / 4
od_gain += KGC::OverDrive::GAIN_RATE[KGC::OverDrive::Type::FATAL]
end
battler.overdrive += od_gain
end
#--------------------------------------------------------------------------
# ● 戦闘行動の実行 : スキル
#--------------------------------------------------------------------------
alias execute_action_skill_KGC_OverDrive execute_action_skill
def execute_action_skill
execute_action_skill_KGC_OverDrive

consume_od_gauge
end
#--------------------------------------------------------------------------
# ○ スキル使用時のドライブゲージ消費
#--------------------------------------------------------------------------
def consume_od_gauge
skill = @active_battler.action.skill
@active_battler.overdrive -= @active_battler.calc_od_cost(skill)
end
end
Comment '2'
  • ?
    훈덕 2009.01.30 08:34
    글 제목은 무시하고 (외국 RPG 포럼에서 질문글로 올라온 제목을 그대로 퍼온듯)
    어쨌든 파판의 오버드라이브와 리미트브레이크를 재현한 스크립트네요.
  • ?
    정검중 2009.03.29 14:17
    어떤방식인지 스샷이좀있으면하는데요......

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 3 습작 2012.12.24 5457
457 타이틀/게임오버 Random Title Screen 2 Man... 2008.10.28 1457
456 폴스 세이브 4 Man... 2008.10.28 2343
455 Attribute System Man... 2008.10.28 1293
454 More SaveFlies(대박) 2 Man... 2008.10.28 2125
453 Khai's Window Helper 1.4 1 Man... 2008.10.28 1272
452 기타 RPG 2000이나 RPG 2003처럼 전체화면으로 나오게 하는 스크립트(대박) 21 Man... 2008.10.28 4833
451 타이틀/게임오버 New Title Screen 3 Man... 2008.10.28 1834
450 변수/스위치 Variable Criticals Man... 2008.10.28 1492
449 Detailed Call Script Error Mesage 3 Man... 2008.10.28 1258
448 기타 TagNote v2.0 5 Man... 2008.10.28 1996
447 베틀 스크린 톤 체인지?? 무슨 말? 4 Man... 2008.10.28 1616
446 디러그 시스템?? 1 Man... 2008.10.28 1248
445 새로운 종류의 세이브 스크립트!! 8 Man... 2008.10.28 3517
» 전투 오버 드라이브 프로블럼 2 Man... 2008.10.28 2271
443 영상 ??(Avi play ver beta 0.8) 4 Man... 2008.10.28 1576
442 맵/타일 GubiD's Isometric Maps for RPG Maker VX 1 Man... 2008.10.28 1684
441 Limit Break VX 3 Man... 2008.10.28 1778
440 Multi-threader snippet by Omegazion Man... 2008.10.28 1107
439 Enable Usage of Rmxp 캐릭터(?) 5 Man... 2008.10.28 2413
438 Screen Resolution 3 Man... 2008.10.28 1172
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 32 Next
/ 32