Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

FF7 Limit Break for RTAB (edit of original KGC Overdrive script)

Okay here is a FF7 type LimitBreak this is the original KGC Overdrive script that i did just little number editing on so that is was almost edzactly like the FF7 Limt Break :) And it plays a sound when its full so its even more cool. Only thing is I cant find the limit break ready sound so thats its more like it :) If anyone has this sound please tell me :) Oh and this only works with the RTAB script as well. Use it to replace your old KGC Overdrive script and you must first create the "LimitBreak" attribute in your RMXP Database [F9]. Go over to the 'Systems' Tab, and add the LimitBreak attribute to the Attribute Names at the left.

Code:
#==============================================================================
# ** KGC_Overdrive
#------------------------------------------------------------------------------
#  When the privately drawn gauge becomes filled, the skill attached to it is
#  enabled.  
#Edited by MistTribe to make it more FF7 like. I used the KGC_Ringer script placed way at
#the bottom so if you edit the   OD_GAUGE_MAX(line 17) then you have make   
#OD_GAUGE_MAX(line 377) the same value. I set it to 500 as so it gains a little faster.
#==============================================================================

#==============================================================================
# * Customization Section *
#==============================================================================

module KGC
  
  # Overdrive gauge maximum.
  OD_GAUGE_MAX = 500
  
  # Overdrive gauge gain rate.
  # The order (index) and conditions are as follows:
  # Order(index) and conditions are as follows:
  #   0 = Attack      1 = Damage
  #   2 = Victory     3 = Escape
  #   4 = Alone       5 = Action
  #   6 = Fatal
  #
  # The accumulation speed of '0'(Attack) and '1'(Damage)  changes based  on the
  # amount of damage. The higher the rate, the faster the overdrive gauge fills.
  OD_GAIN_RATE = [100, 100, 200, 100, 160, 100, 160]
end

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

  if $game_special_elements == nil
    $game_special_elements = {}
    $data_system = load_data("Data/System.rxdata")
  end
  # OverDrive Attribute
  $game_special_elements["limitbreak"] = $data_system.elements.index("LimitBreak")


#==============================================================================
# ** Game_Battler (Part 3)
#==============================================================================

class Game_Battler

  attr_accessor :base_damage
  #--------------------------------------------------------------------------
  # * Applying Normal Attack Effects (Edited)
  #     attacker : battler
  #--------------------------------------------------------------------------
  alias attack_effect_KGC_OverDrive attack_effect
  def attack_effect(attacker)
    @base_damage = nil
    # Execute the original process
    result = attack_effect_KGC_OverDrive(attacker)
    if @base_damage == nil
      # Retaining basic damage value
      @base_damage = [attacker.atk - self.pdef / 2, 0].max *
        (20 + attacker.str) / 20
    end
    # When the damage is received
    if result && self.damage[attacker].is_a?(Numeric)
      # When attacking increase decision
      if attacker.is_a?(Game_Actor) && self.is_a?(Game_Enemy) &&
        attacker.overdrive_type == 0 && self.base_damage > 0
        # OD gauge growth calculation
        od_up = [[self.damage[attacker] * KGC::OD_GAIN_RATE[0] * 10 /
          self.base_damage, 1].max, 160].min
        # OD gauge increase
        attacker.overdrive += od_up
        # At the time of suffering damage increase decision
      elsif attacker.is_a?(Game_Enemy) && self.is_a?(Game_Actor) &&
        self.overdrive_type == 1 && self.base_damage > 0
        od_up = [self.damage[attacker] * KGC::OD_GAIN_RATE[1] * 10 / 
          self.maxhp, 1].max
        self.overdrive += od_up
      end
    end
    return result
  end
  #--------------------------------------------------------------------------
  # * Apply Skill Effects (Edited)
  #     user  : the one using skills (battler)
  #     skill : skill
  #--------------------------------------------------------------------------  
  alias skill_effect_KGC_OverDrive skill_effect
  def skill_effect(user, skill)
    @base_damage = nil
    # Execute the original process
    result = skill_effect_KGC_OverDrive(user, skill)
    if @base_damage == nil
      #Calculating power
      power = skill.power + user.atk * skill.atk_f / 100
      if power > 0
        power -= self.pdef * skill.pdef_f / 200
        power -= self.mdef * skill.mdef_f / 200
        power = [power, 0].max
      end
      # Calculating magnification ratio
      rate = 20
      rate += (user.str * skill.str_f / 100)
      rate += (user.dex * skill.dex_f / 100)
      rate += (user.agi * skill.agi_f / 100)
      rate += (user.int * skill.int_f / 100)
      # Retaining the basic damage
      @base_damage = power * rate / 20
    end
    #When the damage is received
    if result && self.damage[user].is_a?(Numeric)
      # When attacking increase decision
      if user.is_a?(Game_Actor) && self.is_a?(Game_Enemy) &&
        user.overdrive_type == 0 && self.base_damage > 0
        # OD gauge growth calculation
        od_up = [[self.damage[user] * KGC::OD_GAIN_RATE[0] * 10 / 
          self.base_damage, 1].max, 160].min
        # OD gauge increase
        user.overdrive += od_up
        # At the time of suffering damage increase decision
      elsif user.is_a?(Game_Enemy) && self.is_a?(Game_Actor) &&
        self.overdrive_type == 1 && self.base_damage > 0
        od_up = [self.damage[user] * KGC::OD_GAIN_RATE[1] * 10 /
          self.maxhp, 1].max
        self.overdrive += od_up
      end
    end
    # When overdrive skill is used
    if user.is_a?(Game_Actor) &&
      skill.element_set.include?($game_special_elements["limitbreak"])
      user.overdrive = 0
    end
    return result
  end
end



#==============================================================================
# ** Game_Actor
#==============================================================================
  KGC_Game_Actor_first = "LimitBreak" unless defined?(KGC_Game_Actor)
  module KGC_Game_Actor
  #--------------------------------------------------------------------------
  # * Active decision of skill
  #--------------------------------------------------------------------------
  if defined?(skill_can_use?) && !@_skill_can_use_overdrive
    alias skill_can_use_KGC_OverDrive skill_can_use?
  else
    @_skill_can_use_overdrive = true
  end
  def skill_can_use?(skill_id)
    result = true
    skill = $data_skills[skill_id]
    if skill != nil &&
      skill.element_set.include?($game_special_elements["limitbreak"])
      result = self.overdrive == KGC::OD_GAUGE_MAX
    end
    if defined?(skill_can_use_KGC_OverDrive)
      return result & skill_can_use_KGC_OverDrive(skill_id)
    else
      return result & super
    end
  end
  module_function :skill_can_use?
  public :skill_can_use?
end


class Game_Actor < Game_Battler
  include KGC_Game_Actor
  attr_writer :overdrive_type
  #--------------------------------------------------------------------------
  # * Setup
  #--------------------------------------------------------------------------
  alias setup_KGC_OverDrive setup
  def setup(actor_id)
    # Executing the processing of the origin
    setup_KGC_OverDrive(actor_id)
    @overdrive, @overdrive_type = 0, 1
  end
  #--------------------------------------------------------------------------
  # * Acquisition of OverDrive gauge
  #--------------------------------------------------------------------------
  def overdrive
    @overdrive = 0 if @overdrive == nil
    return @overdrive
  end
  #--------------------------------------------------------------------------
  # * Operation of OverDrive gauge
  #--------------------------------------------------------------------------
  def overdrive=(value)
    @overdrive = [[value, 0].max, KGC::OD_GAUGE_MAX].min
  end
  #--------------------------------------------------------------------------
  # * Acquisition of OverDrive type
  #--------------------------------------------------------------------------
  def overdrive_type
    @overdrive_type = 0 if @overdrive_type == nil
    return @overdrive_type
    end
  end


  #==============================================================================
  # ** Scene_Battle (Part 1)
  #==============================================================================
  class Scene_Battle
  #--------------------------------------------------------------------------
  # * Battle Ends
  #     result : results (0:win 1:lose 2:escape)
  #--------------------------------------------------------------------------
  alias battle_end_KGC_OverDrive battle_end
  def battle_end(result)
    case result
    when 0 # Victory
      $game_party.actors.each { |actor|
      next unless actor.exist?
      #When drive type "victory" is, addition
      if actor.overdrive_type == 2
        actor.overdrive += KGC::OD_GAIN_RATE[2]
      end
      }
    when 1 # Flight
      $game_party.actors.each { |actor|
      next unless actor.exist?
      # When drive type "flight" is, addition
      if actor.overdrive_type == 3
        actor.overdrive += KGC::OD_GAIN_RATE[3]
      end
      }
    end
  # Defeat
  battle_end_KGC_OverDrive(result)
  end
end



#==============================================================================
# ** Scene_Battle (Part 4)
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 2 : start action) (Edited)
  #--------------------------------------------------------------------------
  alias update_phase4_step2_KGC_OverDrive update_phase4_step2
  def update_phase4_step2(battler)
    if battler.is_a?(Game_Actor)
      # Gauge increase decision
      case battler.overdrive_type
      when 4 # Lonely battle
        alone = true
        $game_party.actors.each { |actor|
      next if actor == battler
        # When the survivor is, it is not lonely
        if actor.exist?
          alone = false
          break
        end
        }
        od_up = alone ? KGC::OD_GAIN_RATE[4] : 0
      when 5 # When acting
        od_up = KGC::OD_GAIN_RATE[5]
      when 6 # Dying
        od_up = (battler.hp <= battler.maxhp / 4) ?
        KGC::OD_GAIN_RATE[6] : 0
      else
        od_up = 0
      end
      battler.overdrive += od_up
    end
    # Executing the processing of the origin
    update_phase4_step2_KGC_OverDrive(battler)
  end
  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 4 : animation for target) (Meter Edited)
  #--------------------------------------------------------------------------  
  alias update_phase4_step4_KGC_OverDrive update_phase4_step4
  def update_phase4_step4(battler) 
    @status_window.refresh
    update_phase4_step4_KGC_OverDrive(battler)
  end
end

#==============================================================================
# ** Window_BattleStatus
#==============================================================================

class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Add Overdrive Meters
  #--------------------------------------------------------------------------
  alias refresh_KGC_OverDrive refresh
  def refresh(number = 0)
    if self.contents == nil
      self.contents = Bitmap.new(width - 32, height - 32)
    end
    if number == 0
      for i in 0...$game_party.actors.size
        draw_actor_od($game_party.actors[i], i * 160 + 4, 88, 120)
      end
    else
      if $game_party.actors[number].is_a?(Game_Actor)
        draw_actor_od($game_party.actors[number], number * 160 + 4, 88, 120)
      end
    end
    refresh_KGC_OverDrive(number)
  end
  #--------------------------------------------------------------------------
  # * Opacity Fix
  #--------------------------------------------------------------------------
  alias update_KGC_OverDrive update
  def update
    if $game_temp.battle_main_phase
      self.contents_opacity -= 4 if self.contents_opacity > 191
    else
      self.contents_opacity += 4 if self.contents_opacity < 255
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Overdrive Meter
  #--------------------------------------------------------------------------
  def draw_actor_od(actor, x, y, width = 144)
    rate = actor.overdrive.to_f / KGC::OD_GAUGE_MAX
    plus_x = 0
    rate_x = 0
    plus_y = 25
    plus_width = 0
    rate_width = 100
    height = 10
    align1 = 1
    align2 = 2
    align3 = 0
    grade1 = 1
    grade2 = 0
    color1 = Color.new(0, 0, 0, 192)
    color2 = Color.new(255, 255, 192, 192)
    color3 = Color.new(0, 0, 0, 192)
    color4 = Color.new(64, 0, 0, 192)
    color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
    color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
    od = (width + plus_width) * actor.overdrive * rate_width / 100 /
      KGC::OD_GAUGE_MAX
    gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
    width, plus_width + width * rate_width / 100,
    height, od, align1, align2, align3,
    color1, color2, color3, color4, color5, color6, grade1, grade2)
  end
end
#==============================================================================
# ** KGC_Overdrive Ringer                                          (09-05-2006)
#------------------------------------------------------------------------------
#    by DerVVulfman
#
#-------------------------------------------------------------------------------
#  A requested feature, this script checks whenever the overdrive bar is filled
#  and plays a pre-set sound effect accordingly. There isn't much to the script
#  and was fairly easy to write. It will work with both versions 1 and 2 of the
#  KGC_Overdrive script that I've posted,  and will probably work with the ori-
#  ginal version of KGC_Overdrive before it was edited by Minkoff.
#  
#==============================================================================



#============================================================================== 
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================
class Scene_Battle
  
  # Overdrive gauge maximum (same value as in KGC_OverDrive Script).
  OD_GAUGE_MAX = 500
  
  #--------------------------------------------------------------------------
  # * Full OD Gauge SE
  #--------------------------------------------------------------------------
  def fullod_se
    Audio.se_play("Audio/SE/015-jump01", 100, 100)
  end
  #--------------------------------------------------------------------------
  # * Frame renewal (OD gauge renewal phase)
  #--------------------------------------------------------------------------
  alias update_phase0_overring update_phase0
  def update_phase0
    # Call the original def from RTAB
    update_phase0_overring
    # Go through the Actors
    $game_party.actors.each { |actor|
      # Only perform if the actor exists
      next unless actor.exist?
      # When the Overdrive bar is set to zero,
      # Reset the Overdrive Ringer to false
      if actor.overdrive == 0
        actor.overdrive_ring = false
      end
      # When the Overdrive Ringer hasn't rung
      if actor.overdrive_ring == false
        # But the Overdrive Bar is filled
        if actor.overdrive == OD_GAUGE_MAX 
          # Play the Overdrive Sound Effect
          fullod_se
          # And Set the Overdrive Ringer to true
          actor.overdrive_ring = true
        end
      end
      }
  end
end

  

#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles the actor. It's used within the Game_Actors class
#  ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
   attr_accessor :overdrive_ring
  #--------------------------------------------------------------------------
  # * Setup
  #--------------------------------------------------------------------------
  alias setup_KGC_OverRing setup
  def setup(actor_id)
    # Executing the processing of the origin
    setup_KGC_OverRing(actor_id)
    @overdrive_ring = false
  end
end
 
Neonyo said:
Cool I am glad you got it working, should be useful to some people. NOW it is a limit break system :D
Hehe thanks do you know where I could get the Limt Break ready sound effect from? Been searching on google for a little over an hour now. :) Oh and did you figure our how fo set the hour with Near's script?
 
-Screams- Oh man I so hate you! -calms down- Okay sowwie.. searched for over an hour and couldnt find it.. but .. YES ITS IT!! Woot!! Now I need to find out a way so that if the limit bar is full then it rreplaces your attack with Limit Break and then you can select one of your limits to use.... Which I have NO freaking clue how to do.. Ohh umm do you know how to make it so that when my Limit Break is full it shows an animation of my choice from my animations like when the limits full I want the person whos limit break is ready to have a glittery flash. :) Then it'll be so perfect... :O
 
do you know how to make it so that when my Limit Break is full it shows an animation of my choice from my animations like when the limits full I want the person whos limit break is ready to have a glittery flash. Then it'll be so perfect...
 

Juuhou

Sponsor

Wait, so what did you do? Did you just add the ringer script in the overdrive script? Or did you alter anything else? Also, its not RM2K database...its RMXP....
 
Um, all you changed were the editable values (OD_GAIN_RATE and OD_GAUGE_MAX) and the element name from 'OverDrive' to 'LimitBreak'. :-/

That, AND adding the Ringer script (with it's OD_GAUGE_MAX value changed to match). ':|
 
What do you mean you were skeptical? Well anyways.. Does ANYONE know how to show battle animations in RGSS? If anyone knows please tell me... :(
 
I have a question: in the original, the bar would chrage with every hit you make, lik warrior in FFX. Does this on echarge normally? I would test it, but the following bug comes up
nameerror occured undefined method "update phase 0" for class"Scene Battle". I have removed the _____ form just after one of the "end"s as it too caused an error.
 
It doesn't work for me, it always errors. I might have put the script in the wrong place, so post where you are meant to put the script to see if i put it in the right place, because it always errors when i try and play.
 
The script is a merged script of the KGC Overdrive script and my OverDrive Ringer script. It is meant to work with the RTAB system and the HP/MP/EXP Bar scripts by Cogwheel.

It will not work with any other battlesystem and it is not dependant on any other script, like Animated Battlers.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top