Limit Breaks / Overdrives
Version: 1.4
By: Dargor
Version: 1.4
By: Dargor
Introduction
This script is a replica of FF7 "Limit Breaks" and FF10 "Overdrives". It includes all 17 Overdrive Modes with their original increment formulas.
Features
€¢ Highly Customizable
€¢ Can handle both Limit Breaks and Overdrives
€¢ Comes with all 17 Overdrive Modes from FF10 and their original increment formulas
€¢ Actors can learn Overdrive Modes
€¢ The learning rate of Overdrive Modes can be specific to each actors
€¢ Comes with a Limit/Modes menu
€¢ Can specify which actors can use the Limit command
€¢ Can flag a skill as a Limit using the VX note feature
€¢ A lot more!
Screenshots
Comming soon!
Demo
Two demos comming soon!
Script
- #==============================================================================
- # ** Limit Breaks / Overdrives
- #------------------------------------------------------------------------------
- # © Dargor, 2009
- # 20/02/09
- # Version 1.4
- #------------------------------------------------------------------------------
- # VERSION HISTORY:
- # - 1.0 (16/02/09), Initial release
- # - 1.1 (18/02/09), Added an Actors constant in the configuration module
- # - 1.2 (18/02/09), Skills can now be flagged as Limits with a note that
- # - 1.3 (18/02/09), Fixed a bug with wrong limit mode being displayed in the
- # Limit Status window
- # - 1.4 (20/02/09), Fixed a bug with the "Sufferer" Mode
- #------------------------------------------------------------------------------
- # INTRODUCTION:
- # This script is a replica of FF7 "Limit Breaks" and FF10 "Overdrives".
- # It includes all 17 Overdrive Modes with their original increment formulas.
- # Since Limits and Overdrives are similar, both are supported in this script
- # and are described as follow:
- # - Limit Break: An overdrive with its mode permanently set to "Stoic"
- # without the possibility of modifying it.
- # - Overdrive: A Limit Break with the possibility of having 17 different
- # gauge increment modes.
- #------------------------------------------------------------------------------
- # INSTRUCTIONS:
- # 1) Place this script ABOVE Main and BELOW the Custom Commands script
- # 2) Edit the vocabulary and constants in the Limit_Break module
- #------------------------------------------------------------------------------
- # NOTES:
- # - This script requires the Custom Commands script
- #
- # - This script includes all 17 Overdrive Modes from FF10
- # Here's the list of the modes in the format ID) Name: Description
- # 0) Stoic: Take damage from an enemy
- # 1) Warrior: Deal damage to an enemy
- # 2) Healer: Heal an ally
- # 3) Comrad: Ally takes damage
- # 4) Slayer: Kill an enemy
- # 5) Victor: Win a battle alive
- # 6) Tactician: Inflict a negative state on an enemy
- # 7) Hero: Kill an enemy with a critical hit
- # 8) Ally: Turn reaches self
- # 9) Daredevil: Turn reaches self in the crisis (near death) state
- # 10) Solo: Fight alone
- # 11) Coward: Run away from battles
- # 12) Dancer: Evade an enemy attack
- # 13) Rook: Reduce or nullify an enemy elemental/state attack
- # 14) Sufferer: Get inflicted by a negative state from an enemy
- # 15) Victim: Get affected by a negative state whe turn reach self
- # 16) Avenger: Enemy kills an ally
- #==============================================================================
- # Vocabulary
- Vocab::Limit = 'Limit'
- Vocab::LimitCommand = 'LIMIT!'
- Vocab::LimitReady = "%s's limit gauge is fully charged!"
- Vocab::Mode = 'Mode'
- Vocab::ModeLearn = "%s learned the overdrive mode \\C[17]%s\\C[0]!"
- #==============================================================================
- # ** Limit Break Configuration Module
- #==============================================================================
- module Limit_Break
- # Skill ID of Limits
- Limits = [2,3,4,5]
- # Note Tag. If this tag appears in a skill note, this skill is flagged as a limit
- # An alternative to the above method.
- Skill_Tag = '[Limit]'
- # Actors with the Limit command
- Actors = [1,2]
- # Limit Battle Command Index
- # SYNTAX: { Actor_ID => index }
- Command_Index = { }
- Command_Index.default = 0
- # Actor Maximum amount of LP (Limit Points)
- # This is the maximum number of LP an actor needs to have in order to use Limits
- # SYNTAX: { Actor_ID => value }
- LP_Max = { }
- LP_Max.default = 100
- # Limit Mode Names
- Mode_Names = [
- 'Stoic',
- 'Warrior',
- 'Healer',
- 'Comrad',
- 'Slayer',
- 'Victor',
- 'Tactician',
- 'Hero',
- 'Ally',
- 'Daredevil',
- 'Solo',
- 'Coward',
- 'Dancer',
- 'Rook',
- 'Sufferer',
- 'Victim',
- 'Avenger'
- ]
- # Limit Mode Descriptions
- Mode_Descriptions = [
- 'Receive damage from enemy',
- 'Deal damage to enemy',
- 'Healing HP of an ally',
- 'Ally hit by an enemy',
- 'Destroying an enemy',
- 'Win a battle as an included member',
- 'Inflict negative status on an enemy',
- 'Destroying an enemy with a critical hit',
- 'Turn reaches self',
- 'Turn reaches self when near death',
- 'Fight alone',
- 'Escaping from a battle',
- 'Evading an enemy attack',
- 'Reduce or nullify an enemy status/element attack',
- 'Hit by negative status from an enemy',
- 'Turn reaches self under negative status effects',
- 'Enemy kill ally'
- ]
- # Limit Mode Gauge Increment Formulas
- Mode_Increment = [
- "((@hp_damage.to_f * 30.0) / self.maxhp.to_f).ceil",
- "((@hp_damage.to_f * 10.0) / @estimated_hp_damage.to_f).ceil",
- "((@hp_damage.abs.to_f * 16.0) / self.maxhp.to_f).ceil",
- "((@hp_damage.to_f * 20.0) / self.maxhp.to_f).ceil",
- "20 * (member.maxlp / 100)",
- "20 * (user.maxlp / 100)",
- "16 * (user.maxlp / 100)",
- "20 * (user.maxlp / 100)",
- "4 * (@active_battler.maxlp / 100)",
- "16 * (@active_battler.maxlp / 100)",
- "16 * (@active_battler.maxlp / 100)",
- "10 * (member.maxlp / 100)",
- "16 * (target.maxlp / 100)",
- "10 * (self.maxlp / 100)",
- "16 * (user.maxlp / 100)",
- "16 * (@active_battler.maxlp / 100)",
- "30 * (user.maxlp / 100)"
- ]
- # Limit Modes Learning Rate
- # This is the number if times an actor must meet modes requitement in order to
- # gain this mode.
- # SYNTAX: { Mode_ID => { Actor_ID => value } }
- # NOTE: If a mode is not defined or a value is not specified for an actor,
- # the mode is automatically available.
- Mode_Learn_Rate = {
- 1 => {1 => 1, 2 => 100, 3 => 100, 4 => 100,
- 5 => 100, 6 => 100, 7 => 100, 8 => 100,}
- }
- Mode_Learn_Rate.default = 0
- # Limit gauge color 1
- Gauge_Color1 = 28
- # Limit gauge color 2
- Gauge_Color2 = 29
- # Negative States
- Negative_States = [2,3,4,5,6,7,8]
- # SE played when the limit gauge is full
- Limit_SE = 'Chime2'
- # Have the limit menu in the main menu?
- Limit_Menu = true
- # Index of the Limit command in the main menu?
- Menu_Index = 3
- # Is Mode selection enabled?
- Mode_Enabled = true
- end
- #==============================================================================
- # ** Sound
- #------------------------------------------------------------------------------
- # This module plays sound effects. It obtains sound effects specified in the
- # database from $data_system, and plays them.
- #==============================================================================
- module Sound
- # Limit
- def self.play_limit
- se = RPG::SE.new(Limit_Break::Limit_SE)
- se.play
- end
- end
- #==============================================================================
- # ** RPG::Skill
- #==============================================================================
- class RPG::Skill < RPG::UsableItem
- #--------------------------------------------------------------------------
- # * Is this skill a Limit?
- #--------------------------------------------------------------------------
- def limit?
- note_tag = @note.downcase.include?(Limit_Break::Skill_Tag.downcase)
- if Limit_Break::Limits.include?(@id) or note_tag
- return true
- else
- return false
- 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
- #--------------------------------------------------------------------------
- # * Alias Listing
- #--------------------------------------------------------------------------
- alias dargor_vx_limit_break_system_initialize initialize
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- # The Usual
- dargor_vx_limit_break_system_initialize
- # Add Limit command to the main menu
- if Limit_Break::Limit_Menu
- add_menu_command(Limit_Break::Menu_Index, Vocab::Limit)
- 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
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :limit_mode
- attr_accessor :limit_modes
- attr_accessor :added_modes
- attr_accessor :lp
- #--------------------------------------------------------------------------
- # * Alias Listing
- #--------------------------------------------------------------------------
- alias dargor_vx_limit_break_actor_setup setup
- alias dargor_vx_limit_break_actor_skill_can_use? skill_can_use?
- #--------------------------------------------------------------------------
- # * Setup
- # actor_id : actor ID
- #--------------------------------------------------------------------------
- def setup(actor_id)
- dargor_vx_limit_break_actor_setup(actor_id)
- @lp = 0 # How much the limit bar is filled
- @limit_mode = 0 # ID of the limit (or overdrive) mode
- @limit_modes = [0] # Limit modes available
- @limit_modes_rate = {} # Learning progression of limit modes
- @limit_modes_rate_max = {} # Max value to learn limit modes
- @added_modes = [] # Limit Modes newly added
- setup_limit_modes_rate # Setup limit modes learning variables
- end
- #--------------------------------------------------------------------------
- # * Setup Limit Modes Rate
- #--------------------------------------------------------------------------
- def setup_limit_modes_rate
- # Cycle through all Limit modes
- for mode_id in [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
- # Set initial limit mode rate to 0
- @limit_modes_rate[mode_id] = 0
- # Set maximum limit mode rate
- if Limit_Break::Mode_Learn_Rate[mode_id].nil?
- value = Limit_Break::Mode_Learn_Rate.default
- elsif Limit_Break::Mode_Learn_Rate[mode_id][self.id].nil?
- value = Limit_Break::Mode_Learn_Rate.default
- else
- value = Limit_Break::Mode_Learn_Rate[mode_id][self.id]
- end
- @limit_modes_rate_max[mode_id] = value
- # Gain limit mode if maximum rate is 0
- if value == 0
- gain_limit_mode(mode_id)
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Determine Usable Skills
- # skill : skill
- #--------------------------------------------------------------------------
- def skill_can_use?(skill)
- # Set a limit break as enabled in the Limit Menu
- if Limit_Break::Limits.include?(skill.id) && skill_learn?(skill)
- return true
- end
- # The usual
- dargor_vx_limit_break_actor_skill_can_use?(skill)
- end
- #--------------------------------------------------------------------------
- # * Determine Usable Limits
- # skill_id : skill ID
- #--------------------------------------------------------------------------
- def limit_can_use?
- return Limit_Break::Actors.include?(@actor_id)
- end
- #--------------------------------------------------------------------------
- # * Determine Limit Command Access
- #--------------------------------------------------------------------------
- def limit_ready?
- return @lp == maxlp
- end
- #--------------------------------------------------------------------------
- # * Max LP
- #--------------------------------------------------------------------------
- def maxlp
- result = Limit_Break::LP_Max[@actor_id]
- result = Limit_Break::LP_Max.default if result.nil?
- return result
- end
- #--------------------------------------------------------------------------
- # * Gain LP
- #--------------------------------------------------------------------------
- def gain_lp(lp)
- last_lp = @lp
- @lp = [[@lp + lp, maxlp].min, 0].max
- # Play Limit SE when lp reaches max
- if @lp == maxlp && last_lp != maxlp
- Sound.play_limit
- end
- end
- #--------------------------------------------------------------------------
- # * Gain a Limit Mode
- # mode_id : mode ID
- #--------------------------------------------------------------------------
- def gain_limit_mode(mode_id)
- unless @limit_modes.include?(mode_id)
- @limit_modes << mode_id
- # Add mode to newly added modes list if the mode is not available
- unless @limit_modes_rate_max[mode_id] == 0
- @added_modes << mode_id
- end
- end
- @limit_modes.sort!
- end
- #--------------------------------------------------------------------------
- # * Lose a Limit Mode
- # mode_id : mode ID
- #--------------------------------------------------------------------------
- def lose_limit_mode(mode_id)
- @limit_modes.delete!(mode_id)
- @limit_modes.sort!
- end
- #--------------------------------------------------------------------------
- # * Increase Limit Mode Learning Rate
- # mode_id : mode ID
- # value : value
- #--------------------------------------------------------------------------
- def increase_mode_rate(mode_id, value=1)
- @limit_modes_rate[mode_id] += value
- # Gain Limit Mode
- if @limit_modes_rate[mode_id] >= @limit_modes_rate_max[mode_id]
- gain_limit_mode(mode_id)
- end
- end
- #--------------------------------------------------------------------------
- # * Decrease Limit Mode Learning Rate
- # mode_id : mode ID
- # value : value (automatically turned to Negative Integer)
- #--------------------------------------------------------------------------
- def decrease_mode_rate(mode_id, value=1)
- increase_mode_rate(mode_id, -value)
- end
- #--------------------------------------------------------------------------
- # * Determine Near Incapacitation
- #--------------------------------------------------------------------------
- def crisis?
- return self.hp < self.maxhp / 4
- end
- #--------------------------------------------------------------------------
- # * Determine Element Nullification
- # element_id : element ID
- #--------------------------------------------------------------------------
- def nullify_element?(element_id)
- return element_rate(element_id) == 0
- 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
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_reader :estimated_hp_damage
- #--------------------------------------------------------------------------
- # * Alias Listing
- #--------------------------------------------------------------------------
- alias dargor_vx_limit_break_battler_initialize initialize
- alias dargor_vx_limit_break_battler_execute_damage execute_damage
- alias dargor_vx_limit_break_battler_skill_effect skill_effect
- alias dargor_vx_limit_break_battler_make_attack_damage_value make_attack_damage_value
- alias dargor_vx_limit_break_battler_make_obj_damage_value make_obj_damage_value
- alias dargor_vx_limit_break_battler_apply_state_changes apply_state_changes
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- @estimated_hp_damage = 0
- # The usual
- dargor_vx_limit_break_battler_initialize
- end
- #--------------------------------------------------------------------------
- # * Estimation of Damage From Normal Attack
- # attacker : Attacker
- # The results are substituted for @hp_damage
- # Does not take defense into conssideration
- #--------------------------------------------------------------------------
- def estimated_attack_damage_value(attacker)
- damage = attacker.atk * 4 # base calculation
- damage = 0 if damage < 0 # if negative, make 0
- damage *= elements_max_rate(attacker.element_set) # elemental adjustment
- damage /= 100
- if damage == 0 # if damage is 0,
- damage = rand(2) # half of the time, 1 dmg
- elsif damage > 0 # a positive number?
- @critical = (rand(100) < attacker.cri) # critical hit?
- @critical = false if prevent_critical # criticals prevented?
- damage *= 3 if @critical # critical adjustment
- @critical = false
- end
- damage = apply_variance(damage, 20) # variance
- return damage # damage HP
- 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)
- @estimated_hp_damage = estimated_attack_damage_value(user)
- # The usual
- dargor_vx_limit_break_battler_execute_damage(user)
- # If "Stoic"
- if actor? && @hp_damage > 0
- if self.limit_mode == 0
- formula = Limit_Break::Mode_Increment[0]
- result = eval(formula)
- self.gain_lp(result)
- end
- self.increase_mode_rate(0)
- end
- # If "Warrior"
- if !actor? && user.actor? && @hp_damage > 0
- if user.limit_mode == 1
- formula = Limit_Break::Mode_Increment[1]
- result = eval(formula)
- user.gain_lp(result)
- end
- user.increase_mode_rate(1)
- end
- # If "Healer"
- if actor? && user.actor? && @hp_damage < 0
- if user.limit_mode == 2
- formula = Limit_Break::Mode_Increment[2]
- result = eval(formula)
- user.gain_lp(result)
- end
- user.increase_mode_rate(2)
- end
- # If "Comrad"
- if actor? && @hp_damage > 0
- for member in $game_party.members
- next if member == self
- if member.limit_mode == 3
- formula = Limit_Break::Mode_Increment[3]
- result = eval(formula)
- member.gain_lp(result)
- end
- member.increase_mode_rate(3)
- end
- end
- # If "Slayer"
- if !actor? && self.dead? && user.actor?
- if user.limit_mode == 4
- formula = Limit_Break::Mode_Increment[4]
- result = eval(formula)
- user.gain_lp(result)
- end
- user.increase_mode_rate(4)
- end
- # If "Hero"
- if !actor? && self.dead? && @critical && user.actor?
- if user.limit_mode == 7
- formula = Limit_Break::Mode_Increment[7]
- result = eval(formula)
- user.gain_lp(result)
- end
- user.increase_mode_rate(7)
- end
- # If "Avenger"
- if actor? && self.dead? && !user.actor?
- for member in $game_party.members
- next if member == self
- if user.limit_mode == 16
- formula = Limit_Break::Mode_Increment[16]
- result = eval(formula)
- user.gain_lp(result)
- end
- user.increase_mode_rate(16)
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Apply Skill Effects
- # user : Skill user
- # skill : skill
- #--------------------------------------------------------------------------
- def skill_effect(user, skill)
- # The usual
- dargor_vx_limit_break_battler_skill_effect(user, skill)
- # If "Tactician"
- if !actor? && user.actor?
- for state_id in Limit_Break::Negative_States
- if @added_states.include?(state_id)
- if user.limit_mode == 6
- formula = Limit_Break::Mode_Increment[6]
- result = eval(formula)
- user.gain_lp(result)
- end
- user.increase_mode_rate(6)
- end
- end
- end
- # If "Sufferer"
- if actor? && !user.actor?
- for state_id in Limit_Break::Negative_States
- if @added_states.include?(state_id)
- if self.limit_mode == 14
- formula = Limit_Break::Mode_Increment[14]
- result = eval(formula)
- self.gain_lp(result)
- end
- self.increase_mode_rate(14)
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Calculation of Damage From Normal Attack
- # attacker : Attacker
- # The results are substituted for @hp_damage
- #--------------------------------------------------------------------------
- def make_attack_damage_value(attacker)
- # The usual
- dargor_vx_limit_break_battler_make_attack_damage_value(attacker)
- # If "Rook" (for Elements)
- max_rate = elements_max_rate(attacker.element_set)
- if actor? && max_rate < 100
- if self.limit_mode == 13
- formula = Limit_Break::Mode_Increment[13]
- result = eval(formula)
- target.gain_lp(result)
- end
- target.increase_mode_rate(13)
- end
- end
- #--------------------------------------------------------------------------
- # * Calculation of Damage Caused by Skills or Items
- # user : User of skill or item
- # obj : Skill or item (for normal attacks, this is nil)
- # The results are substituted for @hp_damage or @mp_damage.
- #--------------------------------------------------------------------------
- def make_obj_damage_value(user, obj)
- # The usual
- dargor_vx_limit_break_battler_make_obj_damage_value(user, obj)
- # If "Rook" (for Elements)
- max_rate = elements_max_rate(obj.element_set)
- if actor? && max_rate < 100
- if self.limit_mode == 13
- formula = Limit_Break::Mode_Increment[13]
- result = eval(formula)
- target.gain_lp(result)
- end
- target.increase_mode_rate(13)
- end
- end
- #--------------------------------------------------------------------------
- # * Apply State Changes
- # obj : Skill, item, or attacker
- #--------------------------------------------------------------------------
- def apply_state_changes(obj)
- plus = obj.plus_state_set
- # If "Rook" (for States)
- if actor?
- for state_id in plus
- if state_resist?(state_id) && Limit_Break::Negative_States.include?(state_id)
- if self.limit_mode == 13
- formula = Limit_Break::Mode_Increment[13]
- result = eval(formula)
- target.gain_lp(result)
- end
- target.increase_mode_rate(13)
- end
- end
- end
- # The usual
- dargor_vx_limit_break_battler_apply_state_changes(obj)
- end
- end
- #==============================================================================
- # ** Window_Base
- #------------------------------------------------------------------------------
- # This is a superclass of all windows in the game.
- #==============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # * Alias Listing
- #--------------------------------------------------------------------------
- alias dargor_vx_limit_break_window_base_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)
- unless $scene.is_a?(Scene_Status) or $scene.is_a?(Scene_File) or
- $scene.is_a?(Scene_Limit)
- draw_actor_limit_gauge(actor, x, y, 112)
- end
- dargor_vx_limit_break_window_base_draw_actor_name(actor, x, y)
- end
- #--------------------------------------------------------------------------
- # * Draw Limit Gauge
- # actor : actor
- # x : draw spot x-coordinate
- # y : draw spot y-coordinate
- # width : Width
- #--------------------------------------------------------------------------
- def draw_actor_limit_gauge(actor, x, y, width = 120)
- gw = width * actor.lp / actor.maxlp
- gc1 = text_color(Limit_Break::Gauge_Color1)
- gc2 = text_color(Limit_Break::Gauge_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
- #--------------------------------------------------------------------------
- # * Draw Actor Limit
- #--------------------------------------------------------------------------
- def draw_actor_limit(actor, x, y)
- draw_actor_limit_gauge(actor, x, y)
- self.contents.font.color = system_color
- self.contents.draw_text(x,y,120,WLH,Vocab::Limit)
- end
- #--------------------------------------------------------------------------
- # * Draw Actor Limit Mode
- #--------------------------------------------------------------------------
- def draw_actor_limit_mode(actor, x, y)
- self.contents.font.color = normal_color
- mode = Limit_Break::Mode_Names[actor.limit_mode]
- self.contents.draw_text(x,y,120,WLH,mode)
- end
- end
- #==============================================================================
- # ** Window_Status
- #------------------------------------------------------------------------------
- # This window displays full status specs on the status screen.
- #==============================================================================
- class Window_Status < Window_Base
- #--------------------------------------------------------------------------
- # * Alias Listing
- #--------------------------------------------------------------------------
- alias dargor_vx_limit_break_window_status_draw_basic_info draw_basic_info
- #--------------------------------------------------------------------------
- # * Draw Basic Information
- # x : Draw spot X coordinate
- # y : Draw spot Y coordinate
- #--------------------------------------------------------------------------
- def draw_basic_info(x, y)
- # The usual
- dargor_vx_limit_break_window_status_draw_basic_info(x,y)
- # Draw actor limit gauge
- draw_actor_limit(@actor, x, y + WLH * 4)
- end
- end
- #==============================================================================
- # ** Window_Limit
- #------------------------------------------------------------------------------
- # This window displays a list of usable limits on the limit screen, etc.
- #==============================================================================
- class Window_Limit < Window_Skill
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- @data = []
- for skill in @actor.skills
- @data.push(skill) if skill.limit?
- 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
- #==============================================================================
- # ** Window_LimitStatus
- #------------------------------------------------------------------------------
- # This window displays actor status on the limit screen, etc.
- #==============================================================================
- class Window_LimitStatus < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(0,56,544,56)
- @actor = actor
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- return if @actor.nil?
- draw_actor_name(@actor, 4, 0)
- draw_actor_limit(@actor, 192, 0)
- draw_actor_limit_mode(@actor, 336, 0)
- end
- end
- #==============================================================================
- # ** Window_LimitMode
- #------------------------------------------------------------------------------
- # This window displays a list of usable limit modes on the limit screen, etc.
- #==============================================================================
- class Window_LimitMode < Window_Selectable
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(0, 112, 544, 304)
- @actor = actor
- @item_max = @actor.limit_modes.size
- @column_max = 2
- @mode_id = @actor.limit_mode
- self.index = 0
- refresh
- end
- #--------------------------------------------------------------------------
- # * Selected Limit Mode Description
- #--------------------------------------------------------------------------
- def description
- return Limit_Break::Mode_Descriptions[@actor.limit_modes[self.index]]
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- for i in 0...@item_max
- rect = item_rect(i)
- if @mode_id == @actor.limit_modes[i]
- self.contents.font.color = text_color(29)
- else
- self.contents.font.color = normal_color
- end
- mode_id = @actor.limit_modes[i]
- self.contents.draw_text(rect, Limit_Break::Mode_Names[mode_id])
- end
- end
- #--------------------------------------------------------------------------
- # * Select Limit Mode
- #--------------------------------------------------------------------------
- def select_mode
- @mode_id = @actor.limit_modes[self.index]
- @actor.limit_mode = @mode_id
- refresh
- end
- #--------------------------------------------------------------------------
- # * Update Help Text
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(description == nil ? "" : description)
- end
- end
- #==============================================================================
- # ** Scene_Limit
- #------------------------------------------------------------------------------
- # This class performs the limit screen processing.
- #==============================================================================
- class Scene_Limit < Scene_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- # actor_index : actor index
- #--------------------------------------------------------------------------
- def initialize(actor_index = 0)
- @actor_index = actor_index
- end
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- def start
- create_menu_background
- @actor = $game_party.members[@actor_index]
- @help_window = Window_Help.new
- @mode_window = Window_LimitMode.new(@actor)
- @mode_window.help_window = @help_window
- @mode_window.visible = false
- @mode_window.active = false
- @limit_window = Window_Limit.new(0, 112, 544, 304, @actor)
- @limit_window.help_window = @help_window
- @status_window = Window_LimitStatus.new(@actor)
- @command_window = Window_Command.new(544,[Vocab::Limit, Vocab::Mode], 2)
- @command_window.active = false
- @command_window.visible = false
- end
- #--------------------------------------------------------------------------
- # * Termination processing
- #--------------------------------------------------------------------------
- def terminate
- dispose_menu_background
- @command_window.dispose
- @limit_window.dispose
- @mode_window.dispose
- @status_window.dispose
- @help_window.dispose
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- @command_window.update
- @limit_window.update
- @mode_window.update
- @status_window.update
- @help_window.update
- if @command_window.active
- update_command_selection
- return
- end
- if @limit_window.active
- update_limit_selection
- return
- end
- if @mode_window.active
- update_mode_selection
- return
- end
- end
- #--------------------------------------------------------------------------
- # * Frame Update (Command Selection)
- #--------------------------------------------------------------------------
- def update_command_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- index = $game_system.menu_commands.index(Vocab::Limit)
- $scene = Scene_Menu.new(index)
- return
- end
- if Input.trigger?(Input::C)
- Sound.play_decision
- case @command_window.index
- when 0
- @limit_window.active = true
- @limit_window.visible = true
- @help_window.active = true
- @help_window.visible = true
- @mode_window.active = false
- @mode_window.visible = false
- @command_window.active = false
- @command_window.visible = false
- when 1
- @mode_window.active = true
- @mode_window.visible = true
- @help_window.active = true
- @help_window.visible = true
- @limit_window.active = false
- @limit_window.visible = false
- @command_window.active = false
- @command_window.visible = false
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Frame Update (Limit Selection)
- #--------------------------------------------------------------------------
- def update_limit_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- if Limit_Break::Mode_Enabled
- @limit_window.active = false
- @command_window.visible = true
- @command_window.active = true
- @help_window.active = false
- @help_window.visible = false
- else
- index = $game_system.menu_commands.index(Vocab::Limit)
- $scene = Scene_Menu.new(index)
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- # * Frame Update (Mode Selection)
- #--------------------------------------------------------------------------
- def update_mode_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @mode_window.active = false
- @command_window.visible = true
- @command_window.active = true
- @help_window.active = false
- @help_window.visible = false
- return
- end
- if Input.trigger?(Input::C)
- Sound.play_decision
- @mode_window.select_mode
- @status_window.refresh
- end
- end
- end
- #==============================================================================
- # ** Scene_Menu
- #------------------------------------------------------------------------------
- # This class performs the menu screen processing.
- #==============================================================================
- class Scene_Menu < Scene_Base
- #--------------------------------------------------------------------------
- # * Alias Listing
- #--------------------------------------------------------------------------
- alias dargor_vx_limit_break_menu_update_command_selection update_command_selection
- alias dargor_vx_limit_break_menu_update_actor_selection update_actor_selection
- #--------------------------------------------------------------------------
- # * Update Command Selection
- #--------------------------------------------------------------------------
- def update_command_selection
- # The usual
- dargor_vx_limit_break_menu_update_command_selection
- # Limit Selection
- if Input.trigger?(Input::C)
- case @command_window.selection
- when Vocab::Limit
- start_actor_selection
- return
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Update Actor Selection
- #--------------------------------------------------------------------------
- def update_actor_selection
- # The usual
- dargor_vx_limit_break_menu_update_actor_selection
- # Limit Selection
- if Input.trigger?(Input::C)
- $game_party.last_actor_index = @status_window.index
- Sound.play_decision
- case @command_window.selection
- when Vocab::Limit
- $scene = Scene_Limit.new(@status_window.index)
- end
- end
- end
- end
- #==============================================================================
- # ** Scene_Battle
- #------------------------------------------------------------------------------
- # This class performs battle screen processing.
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # * Alias Listing
- #--------------------------------------------------------------------------
- alias dargor_vx_limit_break_battle_start_actor_command_selection start_actor_command_selection
- alias dargor_vx_limit_break_battle_update_actor_command_selection update_actor_command_selection
- alias dargor_vx_limit_break_battle_next_actor next_actor
- alias dargor_vx_limit_break_battle_prior_actor prior_actor
- alias dargor_vx_limit_break_battle_battle_end battle_end
- alias dargor_vx_limit_break_battle_display_evasion display_evasion
- alias dargor_vx_limit_break_battle_execute_action_skill execute_action_skill
- alias dargor_vx_limit_break_battle_display_level_up display_level_up
- #--------------------------------------------------------------------------
- # * Start Actor Command Selection
- #--------------------------------------------------------------------------
- def start_actor_command_selection
- # Add the Limit command if actor's limit gauge is full
- if @active_battler.limit_ready? && @active_battler.limit_can_use?
- index = Limit_Break::Command_Index[@active_battler.id]
- @active_battler.add_command(index, Vocab::LimitCommand)
- else
- @active_battler.remove_command(Vocab::LimitCommand)
- end
- # The usual
- dargor_vx_limit_break_battle_start_actor_command_selection
- end
- #--------------------------------------------------------------------------
- # * Update Actor Command Selection
- #--------------------------------------------------------------------------
- def update_actor_command_selection
- # The usual
- dargor_vx_limit_break_battle_update_actor_command_selection
- # Limit selection
- if Input.trigger?(Input::C)
- case @actor_command_window.selection
- when @active_battler.class.command_name(Vocab::LimitCommand)
- start_limit_selection
- return
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Go to Command Input for Next Actor
- #--------------------------------------------------------------------------
- def next_actor
- # The usual
- dargor_vx_limit_break_battle_next_actor
- # If "Ally", "Daredevil", "Alone" or "Victim"
- if @active_battler != nil
- @active_battler.increase_mode_rate(8)
- # Ally or Daredevil
- if [8, 9].include?(@active_battler.limit_mode)
- # Gain LP when turn reach actor
- formula_id = @active_battler.crisis? ? 9 : 8
- formula = Limit_Break::Mode_Increment[formula_id]
- result = eval(formula)
- @active_battler.gain_lp(result)
- end
- # Alone
- alone = true
- for member in $game_party.members
- next if member == @active_battler
- alone &&= member.dead?
- end
- if alone
- @active_battler.increase_mode_rate(10)
- end
- if @active_battler.limit_mode == 10 && alone
- # Gain LP when turn reach actor
- formula = Limit_Break::Mode_Increment[10]
- result = eval(formula)
- @active_battler.gain_lp(result)
- end
- # Victim
- victim = false
- for state_id in Limit_Break::Negative_States
- if @active_battler.state?(state_id)
- victim = true
- end
- end
- if victim
- @active_battler.increase_mode_rate(15)
- end
- if @active_battler.limit_mode == 15 && victim
- formula = Limit_Break::Mode_Increment[15]
- result = eval(formula)
- @active_battler.gain_lp(result)
- end
- end
- @status_window.refresh
- end
- #--------------------------------------------------------------------------
- # * Go to Command Input of Previous Actor
- #--------------------------------------------------------------------------
- def prior_actor
- # If "Ally", "Daredevil", "Alone" or "Victim"
- if @active_battler != nil
- @active_battler.increase_mode_rate(8)
- # Ally or Daredevil
- if [8, 9].include?(@active_battler.limit_mode)
- # Gain LP when turn reach actor
- formula_id = @active_battler.crisis? ? 9 : 8
- formula = Limit_Break::Mode_Increment[formula_id]
- result = eval(formula)
- @active_battler.gain_lp(-result)
- end
- # Alone
- alone = true
- for member in $game_party.members
- next if member == @active_battler
- alone &&= member.dead?
- end
- if alone
- @active_battler.increase_mode_rate(10)
- end
- if @active_battler.limit_mode == 10 && alone
- # Gain LP when turn reach actor
- formula = Limit_Break::Mode_Increment[10]
- result = eval(formula)
- @active_battler.gain_lp(-result)
- end
- # Victim
- victim = false
- for state_id in Limit_Break::Negative_States
- if @active_battler.state?(state_id)
- victim = true
- end
- end
- if victim
- @active_battler.increase_mode_rate(15)
- end
- if @active_battler.limit_mode == 15 && victim
- formula = Limit_Break::Mode_Increment[15]
- result = eval(formula)
- @active_battler.gain_lp(-result)
- end
- end
- @status_window.refresh
- # The usual
- dargor_vx_limit_break_battle_prior_actor
- end
- #--------------------------------------------------------------------------
- # * End Battle
- # result : Results (0: win, 1: escape, 2:lose)
- #--------------------------------------------------------------------------
- def battle_end(result)
- # If "Victor"
- if result == 0
- for member in $game_party.members
- next if member.dead?
- if member.limit_mode == 5
- formula = Limit_Break::Mode_Increment[5]
- result = eval(formula)
- member.gain_lp(result)
- end
- member.increase_mode_rate(5)
- end
- end
- # If "Coward"
- if result == 1
- for member in $game_party.members
- next if member.dead?
- if member.limit_mode == 11
- formula = Limit_Break::Mode_Increment[11]
- result = eval(formula)
- member.gain_lp(result)
- end
- member.increase_mode_rate(11)
- end
- end
- # The usual
- dargor_vx_limit_break_battle_battle_end(result)
- end
- #--------------------------------------------------------------------------
- # * Show Escape
- # target : Target
- # obj : Skill or item
- #--------------------------------------------------------------------------
- def display_evasion(target, obj = nil)
- # If "Dancer"
- if target.actor?
- if target.limit_mode == 12
- formula = Limit_Break::Mode_Increment[12]
- result = eval(formula)
- target.gain_lp(result)
- end
- target.increase_mode_rate(12)
- end
- # The usual
- dargor_vx_limit_break_battle_display_evasion(target, obj)
- end
- #--------------------------------------------------------------------------
- # * Start Skill Selection
- #--------------------------------------------------------------------------
- def start_limit_selection
- @help_window = Window_Help.new
- @skill_window = Window_Limit.new(0, 56, 544, 232, @active_battler)
- @skill_window.help_window = @help_window
- @actor_command_window.active = false
- end
- #--------------------------------------------------------------------------
- # * Execute Battle Action: Skill
- #--------------------------------------------------------------------------
- def execute_action_skill
- skill = @active_battler.action.skill
- # If executing a Limit
- if @active_battler.actor? && @active_battler.limit_ready? &&
- Limit_Break::Limits.include?(skill.id)
- @active_battler.remove_command(Vocab::LimitCommand)
- @active_battler.lp = 0
- end
- # The usual
- dargor_vx_limit_break_battle_execute_action_skill
- end
- #--------------------------------------------------------------------------
- # * Display Level Up
- #--------------------------------------------------------------------------
- def display_level_up
- # The usual
- dargor_vx_limit_break_battle_display_level_up
- # Display new limit modes
- display_new_limit_modes
- end
- #--------------------------------------------------------------------------
- # * Display Level Up
- #--------------------------------------------------------------------------
- def display_new_limit_modes
- for member in $game_party.members
- for mode_id in member.added_modes
- mode_name = Limit_Break::Mode_Names[mode_id]
- text = sprintf(Vocab::ModeLearn, member.name, mode_name)
- $game_message.texts.push(text)
- end
- member.added_modes.clear
- wait_for_message
- end
- wait_for_message
- end
- end
Expand to see the code.
Instructions
Refer to the script header.
Compatibility
Requires the Custom Commands script
Should be compatible with everything except some script that alters command windows
Credits and Thanks
Don't forget to give me credit! ;)
Terms and Conditions
Free for Commercial Use. Credits to the script author, Dargor, are required.
Hope you like it!
-Dargor