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.

advanced limit breaks only available in battle

I'm trying to make it that the characters limit break bar can only go up in battle. Does any one know how to do that.
 
I don't know what script you are using, but I'll try to help.

Add this above the part of the script that adds to the limit break bar:
Code:
if $game_temp.in_battle
And at the end of the code that adds to the limit break bar, add this:
Code:
end

Hope I helped.
 
I didn't know where to put it. Heres the script. The main problem I have is with the Healer. I tried putting it there but it didn't work. If you want a demo of my game to see whats wrong just ask. Thanks.
PHP:
#==============================================================================
# Advanced Limit Break Script
#==============================================================================
# SephirothSpawn
# Version 1
# 29.11.05
#==============================================================================

#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log("Advanced Limit Break", "SephirothSpawn", 1, "12.17.05")

#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.state("Advanced Limit Break") == true
  
  #==============================================================================
  # ** Game_Actor
  #==============================================================================
  class Game_Actor < Game_Battler
    #--------------------------------------------------------------------------
    # * Public Instance Variables
    #--------------------------------------------------------------------------
    attr_reader :limit
    attr_accessor :limit_type
    #------------------------------------------------------------------------------
    # * Alias Listings
    #------------------------------------------------------------------------------
    alias seph_limitbreak_gameactor_setup setup
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def setup(actor_id)
      seph_limitbreak_gameactor_setup(actor_id)
      @limit = 0
      @limit_type = 0
    end
    #--------------------------------------------------------------------------
    # * Set Limit
    #--------------------------------------------------------------------------
    def limit=(limit)
      @limit = limit
      @limit = 1000 if @limit > 1000
    end
  end

  #==============================================================================
  # ** Window_Base
  #==============================================================================
  class Window_Base < Window
    #--------------------------------------------------------------------------
    # Alias Listings
    #--------------------------------------------------------------------------
    alias seph_limitbreak_windowbase_drawactorname draw_actor_name
    #--------------------------------------------------------------------------
    # Draw Actor Name
    #--------------------------------------------------------------------------
    def draw_actor_name(actor, x, y)
      ox = $game_temp.in_battle ? 4 : 16
      draw_slant_bar(x + ox, y + 32, actor.limit, 1000.0, 120)
      seph_limitbreak_windowbase_drawactorname(actor, x, y)
    end
    #--------------------------------------------------------------------------
    # Draw Slant Bar
    #--------------------------------------------------------------------------
    def draw_slant_bar(x, y, min, max, width = 152, height = 6, bar_color = Color.new(150, 0, 0, 255))
      # Draw Border
      for i in 0..height
        self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
      end
      # Draw Background
      for i in 1..(height - 1)
        r = 100 * (height - i) / height + 0 * i / height
        g = 100 * (height - i) / height + 0 * i / height
        b = 100 * (height - i) / height + 0 * i / height
        a = 255 * (height - i) / height + 255 * i / height
        self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
      end
      # Color Values
      if min == max
        bar_color = Color.new(200, 0, 0, 255) 
      end
      # Draws Bar
      for i in 1..( (min / max) * width - 1)
        for j in 1..(height - 1)
          r = bar_color.red * (width - i) / width + 255 * i / width
          g = bar_color.green * (width - i) / width + 255 * i / width
          b = bar_color.blue * (width - i) / width + 60 * i / width
          a = bar_color.alpha * (width - i) / width + 255 * i / width
          self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
        end
      end
    end
  end
  
  #==============================================================================
  # Window Horizontal Command
  #==============================================================================
  class Window_HorizCommand < Window_Selectable
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize(commands, width = 640, height = 64)
      super(0, 0, width, height)
      self.contents = Bitmap.new(width - 32, height - 32)
      @commands = commands
      @item_max = @commands.size
      @column_max = @commands.size
      refresh
      self.index = 0
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      self.contents.clear
      for i in 0...@item_max
        draw_item(i, normal_color)
      end
    end
    #--------------------------------------------------------------------------
    # * Draw Item
    #     index : item number
    #--------------------------------------------------------------------------
    def draw_item(index, color)
      self.contents.font.color = color
      x = width / @item_max * index
      off = width / @item_max - 32
      self.contents.draw_text(x, 0, off, 32, @commands[index], 1)
    end
    #--------------------------------------------------------------------------
    # * Disable Item
    #     index : item number
    #--------------------------------------------------------------------------
    def disable_item(index)
      draw_item(index, disabled_color)
    end
  end
  
  #==============================================================================
  # ** Window_Skill
  #==============================================================================
  class Window_Skill < Window_Selectable
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh(seperation = true, overdrive_skills = false)
      if self.contents != nil
        self.contents.dispose
        self.contents = nil
      end
      @data = []
      unless @actor == nil
        for i in [email=0...@actor.skills.size]0...@actor.skills.size[/email]
          skill = $data_skills[@actor.skills[i]]
          unless skill == nil
            if seperation
              if overdrive_skills
                @data.push(skill) if skill.element_set.include?(20)
              else
                @data.push(skill) unless skill.element_set.include?(20)
              end
            else
              @data.push(skill)
            end
          end
        end
      end
      # If item count is not 0, make a bit map and draw all items
      @item_max = @data.size
      if @item_max > 0
        self.contents = Bitmap.new(width - 32, row_max * 32)
        for i in 0...@item_max
          draw_item(i)
        end
      end
    end
    #--------------------------------------------------------------------------
    # * Check Data
    #--------------------------------------------------------------------------
    def data
      return @data
    end
  end
  
  #==============================================================================
  # ** Window_Limit_Types
  #==============================================================================
  class Window_Limit_Types < Window_Selectable
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
      super(0, 128, 640, 288)
      @column_max = 2
      refresh
      self.index = 0
    end
    #--------------------------------------------------------------------------
    # * Get Type
    #--------------------------------------------------------------------------
    def get_type
      return @data[self.index]
    end
    #--------------------------------------------------------------------------
    # * Help Text
    #--------------------------------------------------------------------------
    def help_text
      case index
      when 0    ; text = 'Warrior - Gains When Hero Damages Enemy'
      when 1    ; text = 'Stotic - Gains When Hero Recieves Damage'
      when 2    ; text = 'Healer - Gains When Hero uses Restoriative Magic'
      when 3    ; text = 'Comrade - Gains When Allies Hit'
      when 4    ; text = 'Slayer - Gains When Hero Kills Enemy'
      when 5    ; text = 'Victor - Gains When Party Wins Battle'
      when 6    ; text = 'Tactician - Gains When Hero Inflicts Status Effect on Enemy'
      when 7    ; text = 'Hero - Gains When Hero Destroys Enemy with more than 10,000 HP'
      when 8    ; text = "Ally - Gains When Hero's Turn Comes"
      when 9    ; text = "Daredevil - Gains When Hero's Turn Comes and in Critical Condition"
      when 10  ; text = 'Solo - Gains When Hero Is Only Member in Party'
      when 11  ; text = 'Coward - Gains When Hero Escapes Battle'
      when 12  ; text = 'Dancer - Gains When Hero Evades Enemy Attack'
      when 13  ; text = 'Rook - Gains When Hero Guards Enemy Elemental or Status Attack'
      when 14  ; text = 'Sufferer - Gains When Hero is Inflicted with Status Effect'
      when 15  ; text = "Victim - Gains When Hero's Turn comes, and is inflicted by Status"
      when 16  ; text = 'Avenger - Gains When Ally is Killed By Enemy'
      when 17  ; text = 'Defender - Gains When Hero Chooses to Guard'
      end
      return text
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      if self.contents != nil
        self.contents.dispose
        self.contents = nil
      end
      @data = ['Warrior', 'Stotic', 'Healer', 'Comrade', 'Slayer', 'Victor',
                     'Tactician', 'Hero', 'Ally', 'Daredevil', 'Solo', 'Coward', 'Dancer',
                     'Rook', 'Sufferer', 'Victim', 'Avenger', 'Defender']
      # If item count is not 0, make a bit map and draw all items
      @item_max = @data.size
      if @item_max > 0
        self.contents = Bitmap.new(width - 32, row_max * 32)
        for i in 0...@item_max
          draw_item(i)
        end
      end
    end
    #--------------------------------------------------------------------------
    # * Draw Item
    #     index : item number
    #--------------------------------------------------------------------------
    def draw_item(index)
      x = 4 + index % 2 * (288 + 32)
      y = index / 2 * 32
      self.contents.draw_text(x, y, contents.width / 2 - 32, 32, @data[index], 1)
    end
  end

  #==============================================================================
  # ** Scene_Menu
  #==============================================================================
  class Scene_Menu
    #------------------------------------------------------------------------------
    # * Alias Listings
    #------------------------------------------------------------------------------
    alias seph_limitbreak_scenemenu_init initialize
    alias seph_limitbreak_scenemenu_update_command_check update_command_check
    alias seph_limitbreak_scenemenu_update_status_check update_status_check
    #--------------------------------------------------------------------------
    # * Object Initialization
    #     menu_index : command cursor's initial position
    #--------------------------------------------------------------------------
    def initialize(menu_index = 0)
      seph_limitbreak_scenemenu_init(menu_index)
      # Inserts 'Limit Break' Below Skill
      @commands.insert(@commands.index($data_system.words.skill) + 1, 'Limit Break')
    end
    #--------------------------------------------------------------------------
    # * Update Command Check
    #--------------------------------------------------------------------------
    def update_command_check
      seph_limitbreak_scenemenu_update_command_check
      # Loads Command
      command = @commands[@command_window.index]
      # Check If Command is Limit Break
      if command == 'Limit Break'
        command_start_limit
      end
    end
    #--------------------------------------------------------------------------
    # * Update Status Check
    #--------------------------------------------------------------------------
    def update_status_check
      seph_limitbreak_scenemenu_update_status_check
      # Loads Command
      command = @commands[@command_window.index]
      # Check If Command is Limit Break
      if command == 'Limit Break'
        command_limit
      end
    end
    #--------------------------------------------------------------------------
    # * Command Start Limit
    #--------------------------------------------------------------------------
    def command_start_limit
      activate_status
    end
    #--------------------------------------------------------------------------
    # * Command Limit
    #--------------------------------------------------------------------------
    def command_limit
      # If this actor's action limit is 2 or more
      if $game_party.actors[@status_window.index].restriction >= 2
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Switch to skill screen
      $scene = Scene_LimitBreak.new(@status_window.index)
    end
  end
  
  #==============================================================================
  # ** Scene_LimitBreak
  #==============================================================================
  class Scene_LimitBreak
    #--------------------------------------------------------------------------
    # * Object Initialization
    #     actor_index : actor index
    #--------------------------------------------------------------------------
    def initialize(actor_index = 0)
      @actor_index = actor_index
    end
    #--------------------------------------------------------------------------
    # * Main Processing
    #--------------------------------------------------------------------------
    def main
      # Get actor
      @actor = $game_party.actors[@actor_index]
      # Make Help Window
      @help_window = Window_Help.new
      # Command Window
      @command_window = Window_HorizCommand.new(['View Skills', 'Set Overdrive Type'])
        @command_window.y = 64
      # Skill Window
      @skill_window = Window_Skill.new(@actor)
        @skill_window.height = 288
        @skill_window.refresh(true, true)
        @skill_window.active = false
      # Skill Status Window
      @status_window = Window_SkillStatus.new(@actor)
        @status_window.y = 416
      # Limit Break Types Window
      @limit_break_type_window = Window_Limit_Types.new
        @limit_break_type_window.index = @actor.limit_type
        @limit_break_type_window.visible = @limit_break_type_window.active = false
      # Associate help window
      if @skill_window.help_window == nil
        @help_window.set_text('No Limit Breaks Available', 1)
      else
        @skill_window.help_window = @help_window
      end
      # Scene Objects
      @objects = [@help_window, @command_window, @skill_window, @limit_break_type_window, @status_window]
      # Execute transition
      Graphics.transition
      # Main loop
      loop do
        # Update game screen
        Graphics.update
        # Update input information
        Input.update
        # Objects Update
        @objects.each {|x| x.update}
        # Frame update
        update
        # Abort loop if screen is changed
        if $scene != self
          break
        end
      end
      # Prepare for transition
      Graphics.freeze
      # Dispose of Objects
      @objects.each {|x| x.dispose}
    end
    #--------------------------------------------------------------------------
    # * Frame Update
    #--------------------------------------------------------------------------
    def update
      # If Main Command Active : call update_main
      if @command_window.active
        update_main
        return
      end
      # If skill window is active: call update_skill
      if @skill_window.active
        update_skill
        return
      end
      # If Limit Type is active: call update_type
      if @limit_break_type_window.active
        update_type
        return
      end
    end
    #--------------------------------------------------------------------------
    # * Frame Update (if main window is active)
    #--------------------------------------------------------------------------
    def update_main
      # Toggles Windows Visiblity
      @skill_window.visible = @command_window.index == 0 ? true : false
      @limit_break_type_window.visible = @command_window.index == 1 ? true : false
      # If B button was pressed
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # Switch to menu screen
        $scene = Scene_Menu.new(2)
        return
      end
      # If C button was pressed
      if Input.trigger?(Input::C)
        # Branch Point
        case @command_window.index
        when 0  # View Skills
          if @skill_window.data.size == 0
            $game_system.se_play($data_system.buzzer_se)
            @help_window.set_text('No Limit Breaks Available', 1)
          else
            $game_system.se_play($data_system.decision_se)
            @command_window.active = false
            @skill_window.active = true
          end
        when 1  # Set Limit Break Type
            $game_system.se_play($data_system.decision_se)
            @command_window.active = false
            @limit_break_type_window.active = true
            @help_window.set_text(@limit_break_type_window.help_text, 1)
        end
      end
      # If R button was pressed
      if Input.trigger?(Input::R)
        # Play cursor SE
        $game_system.se_play($data_system.cursor_se)
        # To next actor
        @actor_index += 1
        @actor_index %= $game_party.actors.size
        # Switch to different skill screen
        $scene = Scene_LimitBreak.new(@actor_index)
        return
      end
      # If L button was pressed
      if Input.trigger?(Input::L)
        # Play cursor SE
        $game_system.se_play($data_system.cursor_se)
        # To previous actor
        @actor_index += $game_party.actors.size - 1
        @actor_index %= $game_party.actors.size
        # Switch to different skill screen
        $scene = Scene_LimitBreak.new(@actor_index)
        return
      end
    end
    #--------------------------------------------------------------------------
    # * Frame Update (if main window is active)
    #--------------------------------------------------------------------------
    def update_skill
      # Refreshes Help Window Text
      @skill_window.help_window = @help_window
      # If B button was pressed
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # Switch to main menu
        @command_window.active = true
        @skill_window.active = false
        return
      end
    end
    #--------------------------------------------------------------------------
    # * Frame Update (if main window is active)
    #--------------------------------------------------------------------------
    def update_type
      # Refreshes Help Window Text
      if Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN) || Input.trigger?(Input::RIGHT) || Input.trigger?(Input::LEFT)
        @help_window.set_text(@limit_break_type_window.help_text, 1)
      end
      # If B button was pressed
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # Switch to main menu
        @command_window.active = true
        @limit_break_type_window.active = false
        return
      end
      # If C button was pressed
      if Input.trigger?(Input::C)
        # Play cancel SE
        $game_system.se_play($data_system.decision_se)
        # Set Actor Limit Type
        @actor.limit_type = @limit_break_type_window.index
        @help_window.set_text("#{@actor.name}'s Limit Type is Now #{@limit_break_type_window.get_type}", 1)
        return
      end
    end
  end
  
  #==============================================================================
  # ** Scene_Battle
  #==============================================================================
  class Scene_Battle
    #------------------------------------------------------------------------------
    # * Alias Listings
    #------------------------------------------------------------------------------
    alias seph_limitbreak_scenebattle_battleend battle_end
    alias seph_limitbreak_scenebattle_updatephase1 update_phase1
    alias seph_limitbreak_scenebattle_makebasicactionguard make_basic_action_result_guard
    #------------------------------------------------------------------------------
    # * Battle End Result
    #------------------------------------------------------------------------------
    def battle_end(result)
      for actor in $game_party.actors
        # Victor
        if result == 0
          if actor.limit_type == 5
            actor.limit += 200
          end
        # Coward
        elsif result == 1
          if actor.limit_type == 11
            actor.limit += 100
          end
        end
      end
      seph_limitbreak_scenebattle_battleend(result)
    end
    #------------------------------------------------------------------------------
    # * Update Phase 1
    #------------------------------------------------------------------------------
    def update_phase1
      for actor in $game_party.actors
        # Ally
        if actor.limit_type == 8
          actor.limit += 40
        end
        # Daredevil
        if actor.limit_type == 9 && actor.hp.quo(actor.maxhp) < 0.5
          actor.limit += 160 
        end
        # Solo
        if actor.limit_type == 16 && $game_party.actors.size == 1
          actor.limit += 160
        end
        # Victim
        if actor.limit_type == 15 && actor.states.empty?
          actor.limit += 160
        end
      end
      seph_limitbreak_scenebattle_updatephase1
    end
    #--------------------------------------------------------------------------
    # * Make Basic Action Results - Guard
    #--------------------------------------------------------------------------
    def make_basic_action_result_guard
      # Defender
      if @active_battler.is_a?(Game_Actor)
        if @active_battler.limit_type == 17
          @active_battler.limit += 80
        end
      end
      seph_limitbreak_scenebattle_makebasicactionguard
    end
  end
  
  #==============================================================================
  # ** Game_Battler
  #==============================================================================
  class Game_Battler
    #--------------------------------------------------------------------------
    # * Applying Normal Attack Effects
    #     attacker : battler
    #--------------------------------------------------------------------------
    def attack_effect(attacker)
      # Clear critical flag
      self.critical = false
      # First hit detection
      hit_result = (rand(100) < attacker.hit)
      # If hit occurs
      if hit_result == true
        # Calculate basic damage
        atk = [attacker.atk - self.pdef / 2, 0].max
        self.damage = atk * (20 + attacker.str) / 20
        # Element correction
        self.damage *= elements_correct(attacker.element_set)
        self.damage /= 100
        # If damage value is strictly positive
        if self.damage > 0
          # Critical correction
          if rand(100) < 4 * attacker.dex / self.agi
            self.damage *= 2
            self.critical = true
          end
          # Guard correction
          if self.guarding?
            self.damage /= 2
          end
        end
        # Dispersion
        if self.damage.abs > 0
          amp = [self.damage.abs * 15 / 100, 1].max
          self.damage += rand(amp+1) + rand(amp+1) - amp
        end
        # Second hit detection
        eva = 8 * self.agi / attacker.dex + self.eva
        hit = self.damage < 0 ? 100 : 100 - eva
        hit = self.cant_evade? ? 100 : hit
        hit_result = (rand(100) < hit)
      end
      # If hit occurs
      if hit_result == true
        # State Removed by Shock
        remove_states_shock
        # Loads Current States
        current_states = self.states
        # Substract damage from HP
        self.hp -= self.damage
        # Slayer, Hero & Avenger
        if self.dead?
          if self.is_a?(Game_Actor)
            # Avenger
            for actor in $game_party.actors
              unless actor == self
                if actor.limit_type == 16
                  actor.limit += 300 unless actor.dead?
                end
              end
            end
          else
            # Hero
            if attacker.limit_type == 7 && self.maxhp >= 10000
              attacker.limit += 250 
            end
            # Slayer
            if attacker.limit_type == 4
              attacker.limit += 200 
            end
          end
        end
        # State change
        @state_changed = false
        states_plus(attacker.plus_state_set)
        states_minus(attacker.minus_state_set)
        # Sufferer
        if self.is_a?(Game_Actor)
          if states.size > current_states.size
            if self.limit_type == 14
              self.limit += 160 
            end
          end
        end
        # Warrior & Tactician
        unless self.is_a?(Game_Actor)
          # Warrior
          if attacker.limit_type == 0
            attacker.limit += [self.damage * 10, 160].min
          end
          # Tactician
          if attacker.limit_type == 6
            attacker.limit += 160 
          end
        end
        # Stotic
        if self.is_a?(Game_Actor)
          if self.limit_type == 1
            self.limit += self.damage * 100 / self.maxhp
          end
        end
        # Comrade
        if self.is_a?(Game_Actor)
          for actor in $game_party.actors
            unless actor == self
              if actor.limit_type == 3
                actor.limit += self.damage * 20 / self.maxhp
              end
            end
          end
        end
      # When missing
      else
        # Dancer & Rook
        if self.is_a?(Game_Actor)
          # Dancer
          if self.limit_type == 12
            self.limit += 160 
          end
          # Rook
          if self.limit_type == 13 && !attacker.plus_state_set.empty?
            self.limit += 100 
          end
        end
        # Set damage to "Miss"
        self.damage = "Miss"
        # Clear critical flag
        self.critical = false
      end
      # End Method
      return true
    end
    #--------------------------------------------------------------------------
    # * Apply Skill Effects
    #     user  : the one using skills (battler)
    #     skill : skill
    #--------------------------------------------------------------------------
    def skill_effect(user, skill)
      # Clear critical flag
      self.critical = false
      # If skill scope is for ally with 1 or more HP, and your own HP = 0,
      # or skill scope is for ally with 0, and your own HP = 1 or more
      if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
         ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
        # End Method
        return false
      end
      # Clear effective flag
      effective = false
      # Set effective flag if common ID is effective
      effective |= skill.common_event_id > 0
      # First hit detection
      hit = skill.hit
      if skill.atk_f > 0
        hit *= user.hit / 100
      end
      hit_result = (rand(100) < hit)
      # Set effective flag if skill is uncertain
      effective |= hit < 100
      # If hit occurs
      if hit_result == true
        # Calculate 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
        # Calculate rate
        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)
        # Calculate basic damage
        self.damage = power * rate / 20
        # Element correction
        self.damage *= elements_correct(skill.element_set)
        self.damage /= 100
        # If damage value is strictly positive
        if self.damage > 0
          # Guard correction
          if self.guarding?
            self.damage /= 2
          end
        end
        # Dispersion
        if skill.variance > 0 and self.damage.abs > 0
          amp = [self.damage.abs * skill.variance / 100, 1].max
          self.damage += rand(amp+1) + rand(amp+1) - amp
        end
        # Second hit detection
        eva = 8 * self.agi / user.dex + self.eva
        hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
        hit = self.cant_evade? ? 100 : hit
        hit_result = (rand(100) < hit)
        # Set effective flag if skill is uncertain
        effective |= hit < 100
      end
      # If hit occurs
      if hit_result == true
        # If physical attack has power other than 0
        if skill.power != 0 and skill.atk_f > 0
          # State Removed by Shock
          remove_states_shock
          # Set to effective flag
          effective = true
        end
        # Loads Current States
        current_states = self.states
        # Substract damage from HP
        last_hp = self.hp
        self.hp -= self.damage
        # Healer
        if self.damage < 0
          if user.is_a?(Game_Actor)
            if self.is_a?(Game_Actor) && self != user
              if user.limit_type == 2
                user.limit += 80
              end
            end
          end
        end
        effective |= self.hp != last_hp
        # Slayer, Hero & Avenger
        if self.dead?
          if self.is_a?(Game_Actor)
            # Avenger
            for actor in $game_party.actors
              unless actor == self
                if actor.limit_type == 16
                  actor.limit += 300 unless actor.dead?
                end
              end
            end
          else
            # Hero
            if user.limit_type == 7 && self.maxhp >= 10000
              user.limit += 250 
            end
            # Slayer
            if user.limit_type == 4
              user.limit += 200 
            end
          end
        end
        @state_changed = false
        effective |= states_plus(skill.plus_state_set)
        effective |= states_minus(skill.minus_state_set)
        # Sufferer
        if self.is_a?(Game_Actor)
          if states.size > current_states.size
            if self.limit_type == 14
              self.limit += 160 
            end
          end
        end
        # Warrior & Tactician
        if user.is_a?(Game_Actor)
          # Warrior
          if user.limit_type == 0
            user.limit += [self.damage * 10, 160].min
          end
          # Tactician
          if user.limit_type == 6
            user.limit += 160 
          end
        end
        # Stotic
        if self.is_a?(Game_Actor)
          if self.limit_type == 1
            self.limit += self.damage * 100 / self.maxhp
          end
        end
        # Comrade
        if self.is_a?(Game_Actor)
          for actor in $game_party.actors
            unless actor == self
              if actor.limit_type == 3
                actor.limit += self.damage * 20 / self.maxhp
              end
            end
          end
        end
        # If power is 0
        if skill.power == 0
          # Set damage to an empty string
          self.damage = ""
          # If state is unchanged
          unless @state_changed
            # Set damage to "Miss"
            self.damage = "Miss"
          end
        end
      # When missing
      else
        # Dancer & Rook
        if self.is_a?(Game_Actor)
          # Dancer
          if self.limit_type == 12
            self.limit += 160 
          end
          # Rook
          if self.limit_type == 13 && user.plus_state_set.empty?
            self.limit += 100 
          end
        end
        # Set damage to "Miss"
        self.damage = "Miss"
        # Clear critical flag
        self.critical = false
      end
      # If not in battle
      unless $game_temp.in_battle
        # Set damage to nil
        self.damage = nil
      end
      # End Method
      return effective
    end
  end  

  #==============================================================================
  # ** Scene_Battle
  #==============================================================================
  class Scene_Battle
    #--------------------------------------------------------------------------
    # * Alias Listings
    #--------------------------------------------------------------------------
    alias seph_limitbreak_scenebattle_commandsinit commands_init
    alias seph_limitbreak_scenebattle_updatephase3 update_phase3
    alias seph_limitbreak_scenebattle_checkcommands check_commands
    alias seph_limitbreak_scenebattle_endenemyselect end_enemy_select
    alias seph_limitbreak_scenebattle_endactorselect end_actor_select
    #--------------------------------------------------------------------------
    # * Set Commands
    #--------------------------------------------------------------------------
    def commands_init
      seph_limitbreak_scenebattle_commandsinit
      @commands.insert(@commands.index($data_system.words.skill) + 1, 'Limit Break')
    end
    #--------------------------------------------------------------------------
    # * Frame Update (actor command phase)
    #--------------------------------------------------------------------------
    def update_phase3
      seph_limitbreak_scenebattle_updatephase3
      # If limit skill is enabled
      if @limit_skill_window != nil
        update_phase3_limit_select
      end
    end
    #--------------------------------------------------------------------------
    # * Check Commands
    #--------------------------------------------------------------------------
    def check_commands
      seph_limitbreak_scenebattle_checkcommands
      # Loads Current Command
      command = @commands[@actor_command_window.index]
      if command == 'Limit Break'
        update_phase3_command_limit
      end
    end
    #--------------------------------------------------------------------------
    # * Command : Limit
    #--------------------------------------------------------------------------
    def update_phase3_command_limit
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Set action
      @active_battler.current_action.kind = 1
      # Start skill selection
      start_limit_select
    end
    #--------------------------------------------------------------------------
    # * Start Limit Selection
    #--------------------------------------------------------------------------
    def start_limit_select
      # Skill Window
      @limit_skill_window = Window_Skill.new(@active_battler)
        @limit_skill_window.refresh(true, true)
      # Associate help window
      @limit_skill_window.help_window = @help_window
      # Disable actor command window
      @actor_command_window.active = false
      @actor_command_window.visible = false
    end
    #--------------------------------------------------------------------------
    # * Frame Update (actor command phase : limit selection)
    #--------------------------------------------------------------------------
    def update_phase3_limit_select
      # Make skill window visible
      @limit_skill_window.visible = true
      # Update skill window
      @limit_skill_window.update
      # If B button was pressed
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # End skill selection
        end_limit_select
        return
      end
      # If C button was pressed
      if Input.trigger?(Input::C)
        # Get currently selected data on the skill window
        @skill = @limit_skill_window.skill
        # If it can't be used
        if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Checks Overdrive
        if @active_battler.limit < 1000
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Set action
        @active_battler.current_action.skill_id = @skill.id
        # Make skill window invisible
        @limit_skill_window.visible = false
        # If effect scope is single enemy
        if @skill.scope == 1
          # Start enemy selection
          start_enemy_select
        # If effect scope is single ally
        elsif @skill.scope == 3 or @skill.scope == 5
          # Start actor selection
          start_actor_select
        # If effect scope is not single
        else
          # End skill selection
          end_limit_select
          # Go to command input for next actor
          phase3_next_actor
        end
        # Resets Limit
        @active_battler.limit = 0
        return
      end
    end
    #--------------------------------------------------------------------------
    # * End Skill Selection
    #--------------------------------------------------------------------------
    def end_limit_select
      # Dispose of skill window
      @limit_skill_window.dispose
      @limit_skill_window = nil
      # Hide help window
      @help_window.visible = false
      # Enable actor command window
      @actor_command_window.active = true
      @actor_command_window.visible = true
    end
    #--------------------------------------------------------------------------
    # * End Enemy Selection
    #--------------------------------------------------------------------------
    def end_enemy_select
      seph_limitbreak_scenebattle_endenemyselect
      unless @limit_skill_window ==  nil
        end_limit_select
      end
    end
    #--------------------------------------------------------------------------
    # * End Actor Selection
    #--------------------------------------------------------------------------
    def end_actor_select
      seph_limitbreak_scenebattle_endactorselect
      unless @limit_skill_window ==  nil
        end_limit_select
      end
    end
  end
  
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end
 

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