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.

Esper system + Battle Report merge - Conflict

I have a small request which should be simpler for anyone who knows well scripting (i.e better than my poor self :D).

I have the following scripts working in one game:

FF Esper System

Code:
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs menu screen processing.
#==============================================================================

class Window_Base
  
  
  def draw_actor_name(actor, x, y,color = normal_color)
    self.contents.font.color = color
    self.contents.draw_text(x, y, 120, 32, actor.name)
  end
  
  def draw_actor_extra_parameter(actor, x, y, type)
    case type
    when 0
      parameter_value = actor.extra_atk
    when 1
      parameter_value = actor.extra_pdef
    when 2
      parameter_value = actor.extra_mdef
    when 3
      parameter_value = actor.extra_str
    when 4
      parameter_value = actor.extra_dex
    when 5
      parameter_value = actor.extra_agi
    when 6
      parameter_value = actor.extra_int
    end
    if parameter_value > 0 #MOD HERE FOR COLOR
      self.contents.font.color =  system_color #Color.new(0,400,0) MOD FOR COLOR
      self.contents.draw_text(x + 120, y, 36, 32, "+" + parameter_value.to_s, 2)
    elsif parameter_value < 0
      self.contents.font.color =  Color.new(200,0,0)
      self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
    end
  end
  
  def draw_esper_parameter(esper, x, y, type)
    case type
    when -1
      parameter_name = "Level" #MOD 
      parameter_value = esper.lvl #esper.lvl ""
    when 0
      parameter_name = $data_system.words.atk
      parameter_value = esper.atk
    when 1
      parameter_name = $data_system.words.pdef
      parameter_value = esper.pdef
    when 2
      parameter_name = $data_system.words.mdef
      parameter_value = esper.mdef
    when 3
      parameter_name = $data_system.words.str
      parameter_value = esper.str
    when 4
      parameter_name = $data_system.words.dex
      parameter_value = esper.dex
    when 5
      parameter_name = $data_system.words.agi
      parameter_value = esper.agi
    when 6
      parameter_name = $data_system.words.int
      parameter_value = esper.int
    end
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 120, 32, parameter_name,1)
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 100, y, 36, 32, parameter_value.to_s, 2)
  end
  
  def draw_esper_graphic(esper, x, y)
      bitmap = RPG::Cache.picture("Summons/" +esper.name) #MOD
      src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
      self.contents.blt(x, y, bitmap, src_rect)
  end
    
  def draw_esper_skills(esper, x, y)
      column = 0
      self.contents.font.color = system_color
      self.contents.draw_text(x, y, 120, 32, "Skills:")
      self.contents.font.color = normal_color
      for i in esper.skill
        column += 32
        self.contents.draw_text(x, y + column, 204, 32, $data_skills[i].name, 0) if i != 0
      end
  end
end

class Window_BattleResult < Window_Base
  
def initialize(exp, gold, treasures,espers=0)
    @exp = exp
    @gold = gold
    @treasures = treasures
    super(160, espers*32 + 52, 320, @treasures.size * 32 + 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.y = 160 - height / 2 if espers <= 1
    self.back_opacity = 160
    self.visible = false
    refresh
  end
end

class Window_Skill
  
  def draw_item(index)
    #Duping the array is better for reading.
    a = ESPERS::SKILL_COLOR.dup
    skill = @data[index]
    if @actor.skill_can_use?(skill.id)
      #if the skill is given by the esper.
      if @actor.esper_skill?(skill.id)
        #draw in color "a".
        self.contents.font.color = Color.new(a[0],a[1],a[2],255)
      #if not...
      else
        #draw in the normal color.
        self.contents.font.color = normal_color
      end
    else
      if @actor.esper_skill?(skill.id)
        self.contents.font.color = Color.new(a[0],a[1],a[2],128)
      else
        self.contents.font.color = disabled_color
      end
    end
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(skill.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
    self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  end
end

class Window_Status < Window_Base
  alias esper_windowstatus_refresh refresh
  
  def refresh
    esper_windowstatus_refresh
    draw_actor_extra_parameter(@actor,130, 192, 0)
    draw_actor_extra_parameter(@actor,130, 224, 1)
    draw_actor_extra_parameter(@actor,130, 256, 2)
    draw_actor_extra_parameter(@actor,130, 304, 3)
    draw_actor_extra_parameter(@actor,130, 336, 4)
    draw_actor_extra_parameter(@actor,130, 368, 5)
    draw_actor_extra_parameter(@actor,130, 400, 6)
  end
end

class Game_Actor < Game_Battler
  
  attr_accessor :esper1 
  attr_accessor :esper2
  attr_accessor :esper3
  
  alias esper_gameactor_setup setup
  alias esper_base_str  base_str
  alias esper_base_dex  base_dex
  alias esper_base_agi  base_agi
  alias esper_base_int  base_int
  alias esper_base_atk  base_atk
  alias esper_base_pdef base_pdef
  alias esper_base_mdef base_mdef
  
  def setup(actor_id)
    @esper1 = 0
    @esper2 = 0
    @esper3 = 0
    esper_gameactor_setup(actor_id)
  end
  def equip_esper(esper,slot = 1)
    case slot
    when 1
    @esper1 = esper
    when 2
    @esper2 = esper
    when 3
    @esper3 = esper
    end
  end

  def base_str
    n = esper_base_str
    n += @esper1.str if @esper1 != 0
    n += @esper2.str if @esper2 != 0
    n += @esper3.str if @esper3 != 0
    return [[n, 1].max, 999].min
  end
  
  def extra_str
    n = 0
    n += @esper1.str if @esper1 != 0
    n += @esper2.str if @esper2 != 0
    n += @esper3.str if @esper3 != 0
    return n
  end
 

 
  def base_dex
    n = esper_base_dex
    n += @esper1.dex if @esper1 != 0
    n += @esper2.dex if @esper2 != 0
    n += @esper3.dex if @esper3 != 0
    return [[n, 1].max, 999].min
  end
  
  def extra_dex
    n = 0
    n += @esper1.dex if @esper1 != 0
    n += @esper2.dex if @esper2 != 0
    n += @esper3.dex if @esper3 != 0
    return n
  end

 
  def base_agi
    n = esper_base_agi
    n += @esper1.agi if @esper1 != 0
    n += @esper2.agi if @esper2 != 0
    n += @esper3.agi if @esper3 != 0
    return [[n, 1].max, 999].min
  end
 
  def extra_agi
    n = 0
    n += @esper1.agi if @esper1 != 0
    n += @esper2.agi if @esper2 != 0
    n += @esper3.agi if @esper3 != 0
    return n
  end

  
  def base_int
    n = esper_base_int
    n += @esper1.int if @esper1 != 0
    n += @esper2.int if @esper2 != 0
    n += @esper3.int if @esper3 != 0
    return [[n, 1].max, 999].min
  end
 
  def extra_int
    n = 0
    n += @esper1.int if @esper1 != 0
    n += @esper2.int if @esper2 != 0
    n += @esper3.int if @esper3 != 0
    return n
  end
 
  def base_atk
    n = esper_base_atk
    n += @esper1.atk if @esper1 != 0
    n += @esper2.atk if @esper2 != 0
    n += @esper3.atk if @esper3 != 0
    return n
  end
    
  def extra_atk
    n = 0
    n += @esper1.atk if @esper1 != 0
    n += @esper2.atk if @esper2 != 0
    n += @esper3.atk if @esper3 != 0
    return n
  end
 
  def base_pdef
    n = esper_base_pdef
    n += @esper1.pdef if @esper1 != 0
    n += @esper2.pdef if @esper2 != 0
    n += @esper3.pdef if @esper3 != 0
    return n
  end
 
  def extra_pdef
    n = 0
    n += @esper1.pdef if @esper1 != 0
    n += @esper2.pdef if @esper2 != 0
    n += @esper3.pdef if @esper3 != 0
    return n
  end

   def base_mdef
    n = esper_base_mdef
    n += @esper1.mdef if @esper1 != 0
    n += @esper2.mdef if @esper2 != 0
    n += @esper3.mdef if @esper3 != 0
    return n
  end
  
  def extra_mdef
    n = 0
    n += @esper1.mdef if @esper1 != 0
    n += @esper2.mdef if @esper2 != 0
    n += @esper3.mdef if @esper3 != 0
    return n
  end

  def remove_esper(esper = @esper1)
    for esper_skills in esper.skill
      forget_skill(esper_skills)
    end
    case esper
    when @esper1
    @esper1 = 0
    when @esper2
    @esper2 = 0
    when @esper3
    @esper3 = 0
    end
  end
  
  def esper_skill?(skill,esper = @esper1)
    if esper != 0
      for i in esper.skill
        return true if i == skill
      end
    end
    return false
  end
  
  def skills(esper = @esper1)
    if esper != 0
      for esper_skills in esper.skill
        unless esper_skills.nil?
          if esper_skills != 0
            self.learn_skill(esper_skills)
          end
        end
      end
    end
    return @skills
  end
end

class Game_Battler
  
  attr_accessor :oldhp
  
  alias esper_gameactor_skill_effect  skill_effect

  def skill_effect(user, skill)
    if user.is_a?(Game_Actor)
      if user.esper1 != 0 
        if skill.id == user.esper1.skill[0]
          user.esper1.add_exp
        end
      end
    end
    esper_gameactor_skill_effect(user, skill)
  end
end

class Game_Party
  
  attr_accessor :espers
  
  alias espers_gameparty_initialize initialize
  
  def initialize
    espers_gameparty_initialize
    @espers = []
  end
  
  def gain_esper(esper)
    @espers.push(esper)
  end
end

#-------------------------
#-----Custom Classes------
#-------------------------
class Window_EsperStatus < Window_Base

  def initialize(esper)
    super(160, 64, 480, 416)
    self.contents = Bitmap.new(width - 32, height - 32)
    @esper = esper
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.size = 32#40
    self.contents.draw_text(150, 4,180,40,@esper.name)
    self.contents.font.size = 18 #22 MOD
    draw_esper_graphic(@esper, 60, 100) if ESPERS::PICTURES == true
    draw_esper_skills(@esper, 300, 72)
    draw_esper_parameter(@esper, 120, 40, -1)
    draw_esper_parameter(@esper, 0, 72, 0)
    draw_esper_parameter(@esper, 0, 104, 1)
    draw_esper_parameter(@esper, 0, 136, 2)
    draw_esper_parameter(@esper, 0, 168, 3)
    draw_esper_parameter(@esper, 0, 200, 4)
    draw_esper_parameter(@esper, 0, 232, 5)
    draw_esper_parameter(@esper, 0, 264, 6)
  end
end

class Window_EsperList < Window_Selectable
  
  def initialize(width, commands)
    super(0, 64, width, 416)
    @item_max = commands.size
    @commands = commands
    self.contents = Bitmap.new(width - 32, @item_max * 32)
    refresh
    self.index = 0
  end
  
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i, normal_color)
    end
  end
  
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new(14, 32 * index, self.contents.width - 8, 32) #MOD DONE
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    if @commands[index].is_a?(String)
      self.contents.draw_text(rect, @commands[index])
    else
      self.contents.draw_text(rect, @commands[index].name)
    end
  end
  
  def disable_item(index)
    draw_item(index, disabled_color)
  end
  def enable_item(index)
    draw_item(index, normal_color)
  end
end

class Window_EsperEquip < Window_Selectable
  
  def initialize
    super(0, 64, 160, 50*$game_party.actors.size + 30)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
    self.active = false
    self.index = -1
  end
  
  def refresh(remove = false)
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      x = 64
      y = i * 50
      actor = $game_party.actors[i]
      draw_actor_graphic(actor, x - 40, y + 50)
      if actor.esper1 == 0 || remove == true
        draw_actor_name(actor, x - 20, y)
      else
       draw_actor_name(actor, x - 20, y) #draw_actor_name(actor, x - 20, y, disabled_color)
       end
    end
  end
    
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0, @index * 50, self.width - 32, 50)
    end
  end
end

class Window_EsperUp < Window_Base
  
  def initialize(espers)
    @espers_leveled = espers
    super(160, 10, 320,32 + 32*espers.size)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 160
    self.visible = false
    refresh
  end
  
  def refresh
    self.contents.clear
    y = 0
    for i in @espers_leveled
      self.contents.draw_text(4, y, self.width, 32,i.name + " has leveled up.")
      y += 32
    end
  end
end

class Window_EsperUp < Window_Base
  
  def initialize(espers)
    @espers_leveled = espers
    super(160, 10, 320,32 + 32*espers.size)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 160
    self.visible = false
    refresh
  end
  
  def refresh
    self.contents.clear
    y = 0
    for i in @espers_leveled
      self.contents.draw_text(4, y, self.width, 32,i.name + " has leveled up.")
      y += 32
    end
  end
end

class Window_Esperdummy < Window_Base
  
  def initialize(x = 160, y = 64, width = 480, height = 416)
    super(x, y, width, height)
    self.contents = Bitmap.new(width - 32, height - 32)
  end
end

class Scene_Esper
  
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  
  def main
    #array that hold the commands
    @esper_commands = []
    #here the espers are added in the arrays
    for i in $game_party.espers
      @esper_commands.push(i)
    end
    #a dup of @esper_commands before it gets other command then espers
    @espers_in_commands = @esper_commands.dup
    #adds the non-esper text for each esper that the player do not have
    while @esper_commands.length < ESPERS::MAX_ESPERS
      @esper_commands.push(ESPERS::NO_ESPER)
    end
    #adds the remove command
    @esper_commands.push(ESPERS::REMOVAL)
    #... I don't want to comment the rest for now.
    @esperlist_window = Window_EsperList.new(160, @esper_commands)
    for i in 0...@esper_commands.length - 1
      if i >= $game_party.espers.length
        @esperlist_window.disable_item(i)
      end
    end
    
    @help_window = Window_Help.new
    @help_window.set_text("Equip the selected summon")
    @esperlist_window.index = @menu_index
    @choose_actor_window = Window_EsperEquip.new
    @choose_actor_window.visible = false
    @choose_actor_window.active = false
    @choose_actor_window.index = @menu_index
    if $game_party.espers != []
      @esper_window = Window_EsperStatus.new($game_party.espers[0])
    else
      @esper_window = Window_Esperdummy.new
    end
    for i in 0...$game_party.actors.size
      if $game_party.actors[i].esper1 != 0
        for a in 0...@espers_in_commands.size
          if $game_party.actors[i].esper1.name == @espers_in_commands[a].name
            @esperlist_window.disable_item(a)
          end
        end
      end
    end
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @esperlist_window.dispose
    @esper_window.dispose
    @choose_actor_window.dispose
    @help_window.dispose
  end
  
  def update
    @esperlist_window.update
    @esper_window.update
    @choose_actor_window.update
    @help_window.update
    if @esperlist_window.active
      update_command
      return
    end
    if @choose_actor_window.active
      update_esper
      return
    end
  end
  
  def update_command
    
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(5) #MOD HERE FOR POSITION
      return
    end
    if Input.trigger?(Input::DOWN) || Input.trigger?(Input::UP)
        @esper_window.dispose
        if @esperlist_window.index < $game_party.espers.length
          @esper_window = Window_EsperStatus.new($game_party.espers[@esperlist_window.index])
          @help_window.set_text("Equip the selected summon")
        elsif @esperlist_window.index == ESPERS::MAX_ESPERS
          @esper_window = Window_Esperdummy.new
          @help_window.set_text("Remove the equipped summon")
        else
          @esper_window = Window_Esperdummy.new
          @help_window.set_text("")
          @help_window.set_text("Equip the selected summon")
        end
    end
    if Input.trigger?(Input::C)
      if @esperlist_window.index < $game_party.espers.length
        for i in 0...$game_party.actors.size
          if $game_party.actors[i].esper1 != 0
            if $game_party.actors[i].esper1.name == @espers_in_commands[@esperlist_window.index].name
              $game_system.se_play($data_system.buzzer_se)
              @help_window.set_text("This summon is already equipped")
              return
            end
          end
        end
        $game_system.se_play($data_system.decision_se)
        @esperlist_window.active = false
        @choose_actor_window.active = true
        @choose_actor_window.visible = true
        @choose_actor_window.refresh
        @help_window.set_text("Choose a player to equip the summon")
        @esperlist_window.visible = false
      elsif @esperlist_window.index == ESPERS::MAX_ESPERS
        $game_system.se_play($data_system.decision_se)
        @esperlist_window.active = false
        @choose_actor_window.active = true
        @choose_actor_window.visible = true
        @esperlist_window.visible = false
        @help_window.set_text("Select a player to remove the summon")
        @choose_actor_window.refresh(true)
      else
        $game_system.se_play($data_system.buzzer_se)
        @help_window.set_text("You do not have this summon yet")
      end
    return
    end
  end
  
  def update_esper
    actor = $game_party.actors[@choose_actor_window.index]
    #here it updates the help window
    if Input.trigger?(Input::DOWN) || Input.trigger?(Input::UP)
      if @esperlist_window.index != ESPERS::MAX_ESPERS
        @help_window.set_text("Choose a player to equip the summon")
      else
        @help_window.set_text("Choose a player to remove the summon")
      end
    end
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @choose_actor_window.active = false
      @choose_actor_window.visible = false
      @esperlist_window.active = true
      @esperlist_window.visible = true
      @help_window.set_text("")
      return
    end
    if Input.trigger?(Input::C)
      if actor.esper1 == 0 && @esperlist_window.index != ESPERS::MAX_ESPERS
        actor.esper1 = @esper_commands[@esperlist_window.index]
        $game_system.se_play($data_system.decision_se)
        @choose_actor_window.active = false
        @choose_actor_window.visible = false
        @esperlist_window.active = true
        @esperlist_window.visible = true
        @esperlist_window.disable_item(@esperlist_window.index)
      elsif @esperlist_window.index == ESPERS::MAX_ESPERS && actor.esper1 != 0
        $game_system.se_play($data_system.decision_se)
        @choose_actor_window.active = false
        @choose_actor_window.visible = false
        @esperlist_window.active = true
        @esperlist_window.visible = true
        #Now comes the esper remove thingy
        temp = actor.esper1
        @esperlist_window.enable_item(@esper_commands.index(temp))
        actor.remove_esper
      else
      $game_system.se_play($data_system.buzzer_se)
      if @esperlist_window.index != ESPERS::MAX_ESPERS
        @help_window.set_text("This player already has one summon equipped")
      else
        @help_window.set_text("This player does not have a summon equipped")
      end
      end
    return
    end
  end
end

class Game_Esper

  attr_reader :id
  attr_accessor :skill
  attr_reader :name
  attr_accessor :str
  attr_accessor :dex
  attr_accessor :agi
  attr_accessor :int
  attr_accessor :atk
  attr_accessor :pdef
  attr_accessor :mdef
  attr_reader :exp
  attr_accessor :lvl
  attr_reader :exp_table

  def initialize(id,name,exp_table=[10,20,30],skill=[],str=[],dex=[],
    agi=[],int=[],atk=[],pdef=[],mdef=[])
  @skill = []
  @id = id
  @skill_table = skill
  @skill.push(@skill_table[0])
  @name = name
  @str_table = str
  @dex_table = dex
  @agi_table = agi
  @int_table = int
  @atk_table = atk
  @pdef_table = pdef
  @mdef_table = mdef
    @str = @str_table[0]
  @dex = @dex_table[0]
  @agi = @agi_table[0]
  @int = @int_table[0]
  @atk = @atk_table[0]
  @pdef = @pdef_table[0]
  @mdef = @mdef_table[0]
  @exp_table = exp_table
  @exp = 0
  @lvl = 1
end

  def ==(other)
    Marshal.dump(self) == Marshal.dump(other)
  end

  def equiped?
    for i in 0...$game_party.actors.size
    if self != 0 && $game_party.actors[i].esper1 != 0
      if  self.name == $game_party.actors[i].esper1.name
        return true
      end
    end
   return false
  end
  end
  
  def lvl_up
    self.lvl += 1
    self.str = @str_table[self.lvl - 1]
    self.dex = @dex_table[self.lvl - 1]
    self.agi = @agi_table[self.lvl - 1]
    self.int = @int_table[self.lvl - 1]
    self.atk = @atk_table[self.lvl - 1]
    self.pdef = @pdef_table[self.lvl - 1]
    self.mdef = @mdef_table[self.lvl - 1]
    self.skill.push(@skill_table[self.lvl - 1])
  end
      
  def add_exp
  @exp += 1
  end
end

module ESPERS
#You must set up all constants to fully customize the system.

#MAX_ESPERS is the maximum number of espers in the game.
  MAX_ESPERS = 15

#The text for the espers that the party don't got yet.
  NO_ESPER = "?????"

#The text for esper removal.
  REMOVAL = "Remove"
  
#The Color that the espers given skills are shown,
#RGB format(default is yellow, use 255,255,255 to white, like the normal skills)
  SKILL_COLOR = [255,255,0]
  
#1st []
#2nd [skills]
#rest[atts]
  
#PICTURES is the constant that sets if you will use pictures or no
#if yes, set it to true, if no, to false.
  PICTURES = true
#Here you set up all your espers.
  Pyrobolse = Game_Esper.new(1,"Pyrobolse",[1,1,1,1,50],[44,44,44,44,44,44],[6,9,12,15,20],
[-6,9,12,15,20],[6,9,12,15,20],[6,9,12,15,20],[6,9,12,15,20],[6,9,12,15,20],[6,9,12,15,20])

  Hectoculus = Game_Esper.new(2,"Hectoculus",[1,0,0,0,0],[7,0,0,0,0],
[1,0,0,0,0],[2,0,0,0,0],[6,0,0,0,0],[11,0,0,0,0],[2,0,0,0,0],[1,0,0,0,0],[5,0,0,0,0])

  Xylomid = Game_Esper.new(3,"Xylomid",[1,20,30,40,50],[7,8,9,10,11,12],
[10,15,20,25,30],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0])

  Slug = Game_Esper.new(4,"Slug",[1,20,30,40,50],[7,8,9,10,11,12],
[6,10,12,13,15],[3,4,6,8,9],[1,3,4,6,6],[10,13,14,16],[10,9,5,3,1],[0,0,0,0,0],[7,8,8,9,9])

  Serrasalmus = Game_Esper.new(5,"Serrasalmus",[1,20,30,40,50],[7,8,9,10,11,12],
[1,2,3,4,5],[2,3,4,5,6],[6,8,10,12,14],[11,13,15,17,19],[2,3,4,5,6],[1,2,3,4,5],[1,2,3,4,5])

  Sahuagin = Game_Esper.new(6,"Sahuagin",[1,20,30,40,50],[7,8,9,10,11,12],
[6,7,8,9,10],[5,6,7,8,9],[4,5,6,7,8],[3,4,5,6,7],[2,3,4,5,6],[1,2,3,4,5],[1,2,3,4,5])

  Ultros = Game_Esper.new(7,"Ultros",[1,20,30,40,50],[7,8,9,10,11,12],
[6,7,8,9,10],[5,6,7,8,9],[4,5,6,7,8],[3,4,5,6,7],[2,3,4,5,6],[1,2,3,4,5],[1,2,3,4,5])

  Ratame = Game_Esper.new(8,"Ratame",[1,20,30,40,50],[7,8,9,10,11,12],
[10,15,20,25,30],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0])

  Tyrannosaurus = Game_Esper.new(9,"Tyrannosaurus",[1,20,30,40,50],[7,8,9,10,11,12],
[6,10,12,13,15],[3,4,6,8,9],[1,3,4,6,6],[10,13,14,16],[10,9,5,3,1],[0,0,0,0,0],[7,8,8,9,9])

  Garuda = Game_Esper.new(10,"Garuda",[1,20,30,40,50],[7,8,9,10,11,12],
[1,2,3,4,5],[2,3,4,5,6],[6,8,10,12,14],[11,13,15,17,19],[2,3,4,5,6],[1,2,3,4,5],[1,2,3,4,5])

  Yojimbo = Game_Esper.new(11,"Yojimbo",[1,20,30,40,50],[7,8,9,10,11,12],
[6,7,8,9,10],[5,6,7,8,9],[4,5,6,7,8],[3,4,5,6,7],[2,3,4,5,6],[1,2,3,4,5],[1,2,3,4,5])

  Onyx = Game_Esper.new(12,"Onyx",[1,20,30,40,50],[7,8,9,10,11,12],
[6,7,8,9,10],[5,6,7,8,9],[4,5,6,7,8],[3,4,5,6,7],[2,3,4,5,6],[1,2,3,4,5],[1,2,3,4,5])

  Ifrit = Game_Esper.new(13,"Ifrit",[1,20,30,40,50],[7,8,9,10,11,12],
[6,7,8,9,10],[5,6,7,8,9],[4,5,6,7,8],[3,4,5,6,7],[2,3,4,5,6],[1,2,3,4,5],[1,2,3,4,5])

  Omua = Game_Esper.new(14,"Omua",[1,20,30,40,50],[7,8,9,10,11,12],
[6,7,8,9,10],[5,6,7,8,9],[4,5,6,7,8],[3,4,5,6,7],[2,3,4,5,6],[1,2,3,4,5],[1,2,3,4,5])

  Gargantua = Game_Esper.new(15,"Gargantua",[1,20,30,40,50],[7,8,9,10,11,12],
[6,7,8,9,10],[5,6,7,8,9],[4,5,6,7,8],[3,4,5,6,7],[2,3,4,5,6],[1,2,3,4,5],[1,2,3,4,5])
end

FF Victory Battle Status

Code:
#---------------------------------------------------------------------------------
#This shows the FF style Battle Results after victory
#---------------------------------------------------------------------------------
class Game_Actor < Game_Battler
  def exp=(exp)
    @exp = [[exp, 9999999].min, 0].max
    while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
      @level += 1
      
      # NEW - David
      $d_new_skill = nil
      
      for j in $data_classes[@class_id].learnings
        if j.level == @level
          learn_skill(j.skill_id)
      
          # NEW - David
          skill = $data_skills[j.skill_id]
          $d_new_skill = skill.name
      
        end
      end
    end
    while @exp < @exp_list[@level]
      @level -= 1
    end
    @hp = [@hp, self.maxhp].min
    @sp = [@sp, self.maxsp].min
  end
  
  #--------------------------------------------------------------------------
  # * Get the current EXP
  #--------------------------------------------------------------------------
  def now_exp
    return @exp - @exp_list[@level]
  end
  #--------------------------------------------------------------------------
  # * Get the next level's EXP
  #--------------------------------------------------------------------------
  def next_exp
    return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  end

end

class Window_LevelUp < Window_Base

  #----------------------------------------------------------------
  def initialize(actor, pos)
    #change this to false to show the actor's graphic
    @face = true
    @actor = actor
    y = (pos * 120)
    super(280, y, 360, 120)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 255    
    if $d_dum == false
      refresh
    end
  end

  #----------------------------------------------------------------
  def dispose
    super
  end

  #----------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.size = 18
    if @face == true
    draw_actor_face(@actor, 4, 0)
    else
    draw_actor_graphic(@actor, 50, 80)
    end
    draw_actor_name(@actor, 111, 0)
    draw_actor_level(@actor, 186, 0)
    show_next_exp = @actor.level == 99 ? "---" : "#{@actor.next_exp}"
    min_bar = @actor.level == 99 ? 1 : @actor.now_exp
    max_bar = @actor.level == 99 ? 1 : @actor.next_exp
    draw_slant_bar(115, 80, min_bar, max_bar, 190, 6, bar_color = Color.new(190, 190, 210, 255), end_color = Color.new(235, 235, 255, 255))
    #(0, 100, 0, 255), end_color = Color.new(0, 255, 0, 255)) MOD HERE 4 color
    self.contents.draw_text(115, 24, 300, 32, "Exp: #{@actor.now_exp}")
    self.contents.draw_text(115, 48, 300, 32, "Level Up: " + show_next_exp)
  end

  
  #----------------------------------------------------------------
  def level_up
    self.contents.font.color = system_color
    self.contents.draw_text(230, 48, 80, 32, "LEVEL UP!")
  end
  
  #----------------------------------------------------------------
  def update
    super
  end
  
end # of Window_LevelUp

#=================================
#Window_EXP
# Written by: David Schooley
#=================================

class Window_EXP < Window_Base

  #----------------------------------------------------------------
  def initialize(exp)
    super(0, 0, 280, 60)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 255
    refresh(exp)
  end

  #----------------------------------------------------------------
  def dispose
    super
  end

  #----------------------------------------------------------------
  def refresh(exp)
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 150, 32, "Exp Earned:")
    self.contents.font.color = normal_color
    self.contents.draw_text(180, 0, 54, 32, exp.to_s, 2)
  end
  
  #----------------------------------------------------------------
  def update
    super
  end
  
end # of Window_EXP

#=================================
#Window_Money_Items
# Written by: David Schooley
#=================================

class Window_Money_Items < Window_Base

  #----------------------------------------------------------------
  def initialize(money, treasures)
    @treasures = treasures
    super(0, 60, 280, 420)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 255
    refresh(money)
  end

  #----------------------------------------------------------------
  def dispose
    super
  end

  #----------------------------------------------------------------
  def refresh(money)
    @money = money
    self.contents.clear
    
    self.contents.font.color = system_color
    self.contents.draw_text(4, 4, 100, 32, "Items Found:")
    self.contents.font.color = normal_color
    
    y = 32
    for item in @treasures
      draw_item_name(item, 4, y)
      y += 32
    end
    
    cx = contents.text_size($data_system.words.gold).width
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 340, 220-cx-2, 32, $game_party.gold.to_s, 2)
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 300, 220-cx-2, 32, "+ " + @money.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(124-cx, 340, cx + 100, 32, $data_system.words.gold, 2)
  end

  def update
    super
  end
  
end # of Window_Money_Items


class Scene_Battle
  alias raz_battle_report_main main
  alias raz_battle_report_be battle_end

  def main
    # NEW - David
    #$battle_end = false
    @lvup_window = []
    @show_dummies = true # Show dummy windows or not?
    raz_battle_report_main
    # NEW - David
    @lvup_window = nil
    @level_up = nil
    @ch_stats = nil
    @ch_compare_stats = nil
    Audio.me_stop
  end

  def battle_end(result)
    raz_battle_report_be(result)
    # NEW - David
    $game_system.me_play($game_system.battle_end_me)
    $game_system.bgm_play($game_temp.map_bgm)
    @status_window.visible = false
    @spriteset.dispose
    Graphics.transition
    if result == 0
      display_lv_up(@exp, @gold, @treasures)
      loop do
        Graphics.update
        Input.update
        if Input.trigger?(Input::C)
          break
        end
      end
      trash_lv_up
    end

  end
    
  def start_phase5
    @phase = 5
    #$game_system.me_play($game_system.battle_end_me) MOD MOVED UP
   # $game_system.bgm_play($game_temp.map_bgm)
    exp = 0
    gold = 0
    treasures = []
    for enemy in $game_troop.enemies
      unless enemy.hidden
        exp += enemy.exp
        gold += enemy.gold
        if rand(100) < enemy.treasure_prob
          if enemy.item_id > 0
            treasures.push($data_items[enemy.item_id])
          end
          if enemy.weapon_id > 0
            treasures.push($data_weapons[enemy.weapon_id])
          end
          if enemy.armor_id > 0
            treasures.push($data_armors[enemy.armor_id])
          end
        end
      end
    end
    treasures = treasures[0..5]

    # NEW - David
    @treasures = treasures
    @exp  = exp
    @gold = gold

    
    for item in treasures
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
    @phase5_wait_count = 10
  end

  def update_phase5
    if @phase5_wait_count > 0
      @phase5_wait_count -= 1
      if @phase5_wait_count == 0
        
        # NEW - David
        $game_temp.battle_main_phase = false        
      end
      return
    end

    # NEW - David
      battle_end(0)

  end

  def display_lv_up(exp, gold, treasures)
    
    $d_dum = false
    d_extra = 0
    i = 0
    for actor in $game_party.actors
        # Fill up the Lv up windows
        @lvup_window[i] = Window_LevelUp.new($game_party.actors[i], i)
        i += 1
    end

    # Make Dummies
    if @show_dummies == true
      $d_dum = true
      for m in i..3
        @lvup_window[m] = Window_LevelUp.new(m, m)
      end
    end
    
    @exp_window = Window_EXP.new(exp)
    @m_i_window = Window_Money_Items.new(gold, treasures)
    @press_enter = nil
    gainedexp = exp
    @level_up = [0, 0, 0, 0]
    @d_new_skill = ["", "", "", ""]
    @d_breakout = false
    @m_i_window.refresh(gold)
    wait_for_OK

    @d_remember = $game_system.bgs_memorize
    Audio.bgs_play("Audio/SE/032-Switch01", 100, 300)
  
    # NEW - David
    max_exp = exp
    value = 28
    if exp < value
      value = exp
    end
    if value == 0
      value = 1
    end
    for n in 0..gainedexp - (max_exp / value)
      exp -= (max_exp / value)
      if @d_breakout == false
        Input.update
      end
      
      for i in 0...$game_party.actors.size
        actor = $game_party.actors[i]
        if actor.cant_get_exp? == false
          last_level = actor.level
          actor.exp += (max_exp / value)
          # Fill up the Lv up windows
          if @d_breakout == false
            @lvup_window[i].refresh
            @exp_window.refresh(exp)
          end
          
          if actor.level > last_level
            @level_up[i] = 5
            Audio.se_play("Audio/SE/056-Right02.ogg", 70, 150)
            if $d_new_skill
              @d_new_skill[i] = $d_new_skill
            end
          end
          
          if @level_up[i] == 0
            @d_new_skill[i] = ""
          end
          
          if @level_up[i] > 0
            @lvup_window[i].level_up
          end
          
          if Input.trigger?(Input::C) or exp <= 0
            @d_breakout = true
          end
        end
        
        if @d_breakout == false
          if @level_up[i] >0
            @level_up[i] -= 1
          end
          Graphics.update
        end
      end
      
      if @d_breakout == true
        for i in 0...$game_party.actors.size
          actor = $game_party.actors[i]
          if actor.cant_get_exp? == false
            actor.exp += exp
          end
        end
        exp = 0
        break
      end
    end
    Audio.bgs_stop
    @d_remember = $game_system.bgs_restore
    
    for i in 0...$game_party.actors.size
      @lvup_window[i].refresh
    end
    @exp_window.refresh(exp)
    Audio.se_play("Audio/SE/006-System06.ogg", 70, 150)
    $game_party.gain_gold(gold)
    @m_i_window.refresh(0)
    Graphics.update
  end
  
  def trash_lv_up
    # NEW - David
    i=0
    
    for i in 0 ... 4
      @lvup_window[i].visible = false
    end
    @exp_window.visible = false
    @m_i_window.visible = false
    @lvup_window = nil
    @exp_window = nil
    @m_i_window = nil
  end

  # Wait until OK key is pressed
  def wait_for_OK
    loop do
      Input.update
      Graphics.update
      if Input.trigger?(Input::C)
        break
      end
    end
  end

end

class Window_Base < Window
  def draw_actor_face(actor, x, y)
    bitmap = RPG::Cache.picture("Faces/" + actor.character_name)
    self.contents.blt(x, y, bitmap, Rect.new(0,0,96,96))
  end
  
  #--------------------------------------------------------------------------
  # * Draw Slant Bar(by SephirothSpawn)
  #--------------------------------------------------------------------------
  def draw_slant_bar(x, y, min, max, width = 152, height = 6,
      bar_color = Color.new(150, 0, 0, 0), end_color = Color.new(255, 255, 50, 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 #100... a=255
      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
    # Draws Bar
    for i in 1..( (min / max.to_f) * width - 1)
      for j in 1..(height - 1)
        r = bar_color.red * (width - i) / width + end_color.red * i / width
        g = bar_color.green * (width - i) / width + end_color.green * i / width
        b = bar_color.blue * (width - i) / width + end_color.blue * i / width
        a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
        self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
      end
    end
  end

end

And finally I have the limitbreak script by dvv:

Code:
#==============================================================================
# *** Limit Break (DVV's)                                          (03-18-2007)
# *** Version 1.6
#------------------------------------------------------------------------------
# by DerVVulfman
# 
#   This system is a revamped & rewritten system that disables 'element-tagged'
#   skills until the hero's limitbreak bar is filled.   Once the skill is used,
#   the skill becomes disabled again.   Works with and without the RTAB system.
#   
#   One feature  that was sadly lacking in all other systems  was the inability
#   to fill the limitbreak bar with item damage.   Previous systems only looked
#   to damage inflicted through attacks and skill use.   Items such as grenades
#   were entirely overlooked.
#
#   It is still designed  'menu-less'  so there would be  no conflicts with any
#   custom menu scripts.  However,  with a little work, making a menu system to
#   change an actor's limit break fill-type (Attack/Defend/Guard) can be accom-
#   plished fairly easily... for the script literate.  :)
#
#   It still requires Cogwheel's HP/SP/EXP Gauge script to draw the Limit Break
#   bar, unless a suitable Bar Drawing script is available.   However,  without 
#   the bar drawing script, you will not get an error.   You just won't see the
#   bars on the screen.   Previous scripts  either had  their own 'cheaper' bar
#   rendering system, or had 'REQUIRED' scripts that without 'em... crashed.
#
#   Bug reported by link2795 for healing items crashing the game when used with
#   the RTAB system.  Bug caught and squashed.
#
#   Removed Window_BattleStatus's 'Update' def as re-aliasation slowed the game
#   down without contributing to anything.  It was a bug in the KGC_OverDrive
#   and previous BattleStatus Mod script combined.
#
#   Converted the positioning system's CONSTANTS into ($)GLOBAL values that you
#   can edit and change from a script call.   That way, positioning of the bars
#   can be changed based on which menu  or battlestatus window you are using at
#   the time.
#
#   Added a feature to hide limit break bars from the menu and the battlestatus
#   screens. Simple enough... just fill the array with the ID of the heroes you
#   don't want to have visible bars.  As it TOO uses ($)GLOBAL values, you can
#   change it through a script call.
#
#   Added save/load feature so ($)GLOBAL values that are changed through script
#   calls can be recorded into the savegame files.
#
#==============================================================================

#==============================================================================
#                         * Configuration Section *
#==============================================================================

  # Name of the Limit Break element 
  LB_NAME   = "Limit Break"


  # Starting/Default Limit Break Setting
  LB_START  = 2   # 0 = Attack          |  1 = Critical      |  2 = Damaged
                  # 3 = Killed an enemy |  4 = Killed a Boss |  5 = Hero Died
                  # 6 = Victory         |  7 = Escape/Flee   |  8 = Defending
                  # 9 = Lone Combatant  | 10 = Any Action    | 11 = Crit. Health
  

  # Enemy Bosses (by ID)
  # Related to the LB_Rate, it determines if points garnered through 'killing'
  # an ememy gives regular 'enemy' points or 'boss' points to your LB gauge.
  LB_BOSSES = [17]   # Set to enemy 17 (Skeleton)
  
  # Hidden Actors (by ID)
  # This array holds the ID number of Actors who hide their own Limit Break bars
  # in both the battle and menu screens.  Will only apply to both battle & menu.
  $lb_hidden = [9]  # Set to actor #3, Cyrus
  
 
  # Limit Break Max Value
  LB_MAX    = 1000
  
  # Limit Break Fill Rates
  # For flat rates & max value settings, the max value should not exceed LB_MAX.
  LB_RATE   = [  10,   50,  200,  # Hero Attacks the Enemy    (rate, min., max.)
                 25,   25, 1000,  # Hero delivers a CRITICAL! (rate, min., max.)
                 30,    1, 1000,  # Hero takes Damage         (rate, min., max.)
                500,  750,  900,  # Fatalaties:  Enemy, Boss or Self (flat rate)
                200,  200,  100,  # Victory, Escape & Defending      (flat rate)
                160,   40,  160]  # Loner, Action & Crit. Health     (flat rate)
                
  
  # Flexible positioning system.  Default position appears under the STATUS txt.
  $lb_menu_on    = 0              # If set to '1', the bar is shown in the menu.
  $lb_menu_pos   = [ 0,  13, 130] # Positioning in the menu:  X, Y, & bar width.
  $lb_battle_pos = [ 205,  -25, 130] # Positioning in the battle menu.  Same setup.
  $lb_rtab_pos   = [ 0, 0, 111] # Position if using RTAB system.   Same setup.
  $lb_rtab_var   = [0, 40]        # Variable distances between hero's LB gauges.
  
  # SE played when Limit Break filled
  LB_RING   = "157-Skill01"
  

  #----------------------------------------------------------------------------
  # Do not edit below unless you know what you're doing. The following code is
  # for automatic systems in the script. Values are edited or passed elsewhere.
  #----------------------------------------------------------------------------

  # Stores the battler id for item users (needed for non-RTAB systems)
  $item_user = nil
  # Obtain the Limit Break 'id' from the system
  $data_system = load_data("Data/System.rxdata")
  $lb_element_id = $data_system.elements.index(LB_NAME)
  
#==============================================================================
#                       * Configuration Section End *
#==============================================================================



#============================================================================== 
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles data surrounding the system. Backround music, etc.
#  is managed here as well. Refer to "$game_system" for the instance of 
#  this class.
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  # Additional values for the save/load feature
  attr_accessor :lb_mn                    # menu on
  attr_accessor :lb_mp                    # menu position
  attr_accessor :lb_bp                    # battle position
  attr_accessor :lb_rp                    # rtab position
  attr_accessor :lb_rv                    # rtab variance
  attr_accessor :lb_h                     # hidden
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias lb_init initialize
  def initialize
    # Perform the original call
    lb_init
    # Create the savable values
    @lb_mn  = 0
    @lb_mp  = []
    @lb_bp  = []
    @lb_rp  = []
    @lb_rv  = []
    @lb_h   = []
  end  
end  



#==============================================================================
# ** Scene_Save
#------------------------------------------------------------------------------
#  This class performs save screen processing.
#==============================================================================

class Scene_Save < Scene_File
  #--------------------------------------------------------------------------
  # * Write Save Data
  #     file : write file object (opened)
  #--------------------------------------------------------------------------
  alias lb_wsd write_save_data
  def write_save_data(file)
    # Store the globals
    $game_system.lb_mn  = $lb_menu_on
    $game_system.lb_mp  = $lb_menu_pos
    $game_system.lb_bp  = $lb_battle_pos
    $game_system.lb_rp  = $lb_rtab_pos
    $game_system.lb_rv  = $lb_rtab_var
    $game_system.lb_h   = $lb_hide
    # Perform the original call
    lb_wsd(file)
  end
end



#==============================================================================
# ** Scene_Load
#------------------------------------------------------------------------------
#  This class performs load screen processing.
#==============================================================================

class Scene_Load < Scene_File
  #--------------------------------------------------------------------------
  # * Read Save Data
  #     file : file object for reading (opened)
  #--------------------------------------------------------------------------
  alias lb_rsd read_save_data
  def read_save_data(file)
    #Perform the original call
    lb_rsd(file)
    # ReStore the globals
    $lb_menu_on    = $game_system.lb_mn
    $lb_menu_pos   = $game_system.lb_mp
    $lb_battle_pos = $game_system.lb_bp
    $lb_rtab_pos   = $game_system.lb_rp
    $lb_rtab_var   = $game_system.lb_rv
    $lb_hide       = $game_system.lb_h
  end
end



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

class Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------  
  attr_accessor :base_damage
  #--------------------------------------------------------------------------
  # * Applying Normal Attack Effects (Edited)
  #     attacker : battler
  #--------------------------------------------------------------------------
  alias lb_attack_effect attack_effect
  def attack_effect(attacker)
    # Attach base damage to battler (for self.base_damage)
    @base_damage = nil
    # Execute the original process
    result = lb_attack_effect(attacker)
    # Set current damage (rtab or not)
    current_dmg = self.damage
    if $rtab_detected; current_dmg = self.damage[attacker]; end
    # Set crit flag (rtab or not)
    current_crit = self.critical
    if $rtab_detected; current_crit = self.critical[attacker]; end
    # Calculate basic damage
    if @base_damage == nil
      @base_damage = 
      [attacker.atk - self.pdef / 2, 0].max * (20 + attacker.str) / 20
    end
    # When actual physical damage is applied
    if result && current_dmg.is_a?(Numeric) && self.base_damage > 0
      # When HERO attacking the enemy (and tagged for 'Attack')
      if attacker.is_a?(Game_Actor) && self.is_a?(Game_Enemy) && attacker.lb_type == 0 
        # Limit Break growth calculation
        lb_calc = current_dmg * LB_RATE[0] * 10 / self.base_damage
        # Adjust Limit Break growth between min & max values
        lb_add = [[lb_calc, LB_RATE[1]].max, LB_RATE[2]].min
        # OD gauge increase
        attacker.limitbreak += lb_add
      end
      # If the HERO made a critical hit on the Enemy
      if attacker.is_a?(Game_Actor) && self.is_a?(Game_Enemy) && attacker.lb_type == 1 
        if current_crit
          # Limit Break growth calculation
          lb_calc = current_dmg * LB_RATE[3] * 10 / self.base_damage
          # Adjust Limit Break growth between min & max values
          lb_add = [[lb_calc, LB_RATE[4]].max, LB_RATE[5]].min
          # OD gauge increase
          attacker.limitbreak += lb_add  
        end
      end
      # When HERO is damaged by the enemy (and tagged for 'Damaged')
      if attacker.is_a?(Game_Enemy) && self.is_a?(Game_Actor) && self.lb_type == 2 
        lb_calc = current_dmg * LB_RATE[6] * 10 / self.maxhp
        # Adjust Limit Break growth between min & max values
        lb_add = [[lb_calc, LB_RATE[7]].max, LB_RATE[8]].min
        self.limitbreak += lb_add
      end
      # IF a battler has died
      if self.dead?
        # Regular killing move check.
        if attacker.is_a?(Game_Actor) && attacker.lb_type == 3
          attacker.limitbreak += LB_RATE[9]  
        # Killed a boss enemy  
        elsif attacker.is_a?(Game_Actor) && attacker.lb_type == 4 &&
          LB_BOSSES.include?(self.id)
          attacker.limitbreak += LB_RATE[10]  
        end
        # Hero dies
        if self.is_a?(Game_Actor) && self.lb_type == 5
          self.limitbreak += LB_RATE[11]  
        end        
      end
    end
    return result
  end
  #--------------------------------------------------------------------------
  # * Apply Skill Effects
  #     user  : the one using skills (battler)
  #     skill : skill
  #--------------------------------------------------------------------------  
  alias lb_skill_effect skill_effect  
  def skill_effect(user, skill)
    # Attach base damage to battler (for self.base_damage)
    @base_damage = nil
    # Execute the original process
    result = lb_skill_effect(user, skill)
    # Set current damage (rtab or not)
    current_dmg = self.damage
    if $rtab_detected; current_dmg = self.damage[user]; end
    # Recalculate the base (unadjusted) damage
    if @base_damage == nil
      # 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
      @base_damage = power * rate / 20
    end
    # When actual physical damage is applied
    if result && current_dmg.is_a?(Numeric) && self.base_damage > 0
      # When HERO attacking the enemy (and tagged for 'Attack')
      if user.is_a?(Game_Actor) && self.is_a?(Game_Enemy) && user.lb_type == 0
        # Limit Break growth calculation
        lb_calc = current_dmg * LB_RATE[0] * 10 / self.base_damage
        # Adjust Limit Break growth between min & max values
        lb_add = [[lb_calc, LB_RATE[1]].max, LB_RATE[2]].min
        # OD gauge increase
        user.limitbreak += lb_add
      end
      # When HERO is damaged by the enemy (and tagged for 'Damaged')
      if user.is_a?(Game_Enemy) && self.is_a?(Game_Actor) && self.lb_type == 2
        lb_calc = current_dmg * LB_RATE[6] * 10 / self.maxhp
        # Adjust Limit Break growth between min & max values
        lb_add = [[lb_calc, LB_RATE[7]].max, LB_RATE[8]].min
        self.limitbreak += lb_add
      end
      # IF a battler has died
      if self.dead?
        # Regular killing move check.
        if user.is_a?(Game_Actor) && user.lb_type == 3
          user.limitbreak += LB_RATE[9]  
        # Killed a boss enemy  
        elsif user.is_a?(Game_Actor) && user.lb_type == 4 &&
          LB_BOSSES.include?(self.id)
          user.limitbreak += LB_RATE[10]  
        end
        # Hero dies
        if self.is_a?(Game_Actor) && self.lb_type == 5
          self.limitbreak += LB_RATE[11]  
        end        
      end
    end
    # When limitbreak skill is used
    if user.is_a?(Game_Actor) && skill.element_set.include?($lb_element_id)
      # Reset gauge
      user.limitbreak = 0
    end
    return result
  end
  #--------------------------------------------------------------------------
  # * Application of Item Effects
  #     item : item
  #--------------------------------------------------------------------------
  alias lb_item_effect item_effect  
  def item_effect(item, battler = @active_battler)
    # Attach base damage to battler (for self.base_damage)
    @base_damage = nil
    # Set 'user' to the current battler (and ensure if RTAB)
    user = $item_user
    if $rtab_detected; user = battler; end
    # Execute the original process (RTAB or not)
    if $rtab_detected
      result = lb_item_effect(item, user)
    else
      result = lb_item_effect(item)
    end
    # Set current damage (rtab or not)
    current_dmg = self.damage
    if $rtab_detected; current_dmg = self.damage[user]; end
    # Recalculate the base (unadjusted) damage
    if @base_damage == nil
      #Calculate power
      power = maxhp * item.recover_hp_rate / 100 + item.recover_hp
      if power < 0
        power += self.pdef * item.pdef_f / 20
        power = [power, 0].min
      end
      # Set damage value and reverse item power amount
      @base_damage = -power
    end
    # When actual physical damage is applied
    if result && current_dmg.is_a?(Numeric) && self.base_damage > 0
      # When HERO attacking the enemy (and tagged for 'Attack')
      if user.is_a?(Game_Actor) && self.is_a?(Game_Enemy) && user.lb_type == 0
        # Limit Break growth calculation
        lb_calc = current_dmg * LB_RATE[0] * 10 / self.base_damage
        # Adjust Limit Break growth between min & max values
        lb_add = [[lb_calc, LB_RATE[1]].max, LB_RATE[2]].min
        # OD gauge increase
        user.limitbreak += lb_add
      end
      # When HERO is damaged by the enemy (and tagged for 'Damaged')
      if user.is_a?(Game_Enemy) && self.is_a?(Game_Actor) && self.lb_type == 2
        lb_calc = current_dmg * LB_RATE[6] * 10 / self.maxhp
        # Adjust Limit Break growth between min & max values
        lb_add = [[lb_calc, LB_RATE[7]].max, LB_RATE[8]].min
        self.limitbreak += lb_add
      end
      # IF a battler has died
      if self.dead?
        # Regular killing move check.
        if user.is_a?(Game_Actor) && user.lb_type == 3
          user.limitbreak += LB_RATE[9]  
        # Killed a boss enemy  
        elsif user.is_a?(Game_Actor) && user.lb_type == 4 &&
          LB_BOSSES.include?(self.id)
          user.limitbreak += LB_RATE[10]  
        end
        # Hero dies
        if self.is_a?(Game_Actor) && self.lb_type == 5
          self.limitbreak += LB_RATE[11]  
        end        
      end
    end
    return result
  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_reader   :limitbreak               # Limitbreak value
  attr_accessor :lb_type                  # Limitbreak action type
  attr_accessor :limitbreak_ring          # Limit Break Ring Checker
  #--------------------------------------------------------------------------
  # * Setup
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  alias lb_setup setup
  def setup(actor_id)
    # Perform the original call
    lb_setup(actor_id)
    @limitbreak = 0           # Reset Limit Break gauge to zero
    @lb_type = LB_START       # Set the Limit Break type to 'config' settings.
    @limitbreak_ring = false  # Turn the 'ring' off
  end
  #--------------------------------------------------------------------------
  # * Determine if Skill can be Used
  #     skill_id : skill ID
  #--------------------------------------------------------------------------
  alias lb_skill_can_use? skill_can_use?
  def skill_can_use?(skill_id)
    # Get result from original call
    result = lb_skill_can_use?(skill_id)
    # Return if already disabled
    return if result == false
    # Obtain skill from database
    skill = $data_skills[skill_id]
    # Only perform if skill
    if skill != nil
      # Only perform if includes the Element
      if skill.element_set.include?($lb_element_id)
        # If the limitbreak bar is filled, skill is available
        if self.limitbreak == LB_MAX
          result = true
        # Otherwise, it isn't
        else
          result = false
        end
      end
    end
    return result & super
  end 
  #--------------------------------------------------------------------------
  # * Adjust the limitbreak value (permits addition & keeps within range)
  #--------------------------------------------------------------------------
  def limitbreak=(limitbreak)
    @limitbreak = limitbreak
    @limitbreak = LB_MAX if @limitbreak > LB_MAX 
    @limitbreak = 0 if @limitbreak < 0
  end
  #--------------------------------------------------------------------------
  # * Acquire Limit Break value (nil values won't cause errors now)
  #--------------------------------------------------------------------------
  def limitbreak
    # Return 0 if nil (prevent errors)
    @limitbreak = 0 if @limitbreak == nil
    return @limitbreak
  end
end



#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  This class is for all in-game windows.
#==============================================================================
class Window_Base
  #--------------------------------------------------------------------------
  # * Draw Actor Name
  #--------------------------------------------------------------------------
  alias lb_draw_actor_name draw_actor_name
  def draw_actor_name(actor, x, y)
    # Only perform if the actor isn't hidden
    unless $lb_hidden.include?(actor.id)
      # Set/reset the x, y and width of the Limit Break bar.    
      ox = $game_temp.in_battle ? $lb_battle_pos[0] : $lb_menu_pos[0]
      oy = $game_temp.in_battle ? $lb_battle_pos[1] : $lb_menu_pos[1]
      ow = $game_temp.in_battle ? $lb_battle_pos[2] : $lb_menu_pos[2]
      # To menu... or not to menu
      if $lb_menu_on == 1 && !$game_temp.in_battle
        draw_actor_lb(actor, x + ox, y + oy + 32, ow)
      elsif $game_temp.in_battle
        unless $rtab_detected
          draw_actor_lb(actor, x + ox, y + oy + 32, ow)
        end
      end
    end
    lb_draw_actor_name(actor, x, y)
  end  
  #--------------------------------------------------------------------------
  # * Draw Battler Name
  #--------------------------------------------------------------------------
  # If the BattleStatus value of 'Alignment' exists
  if $bstat_align != nil
    alias lb_draw_battler_name draw_battler_name
    def draw_battler_name(actor, x, y)
      # Only perform if the actor isn't hidden
      unless $lb_hidden.include?(actor.id)
        # Set/reset the x, y and width of the Limit Break bar.    
        ox = $game_temp.in_battle ? $lb_battle_pos[0] : $lb_menu_pos[0]
        oy = $game_temp.in_battle ? $lb_battle_pos[1] : $lb_menu_pos[1]
        ow = $game_temp.in_battle ? $lb_battle_pos[2] : $lb_menu_pos[2]
        # To menu... or not to menu
        if $lb_menu_on == 1 && !$game_temp.in_battle
          draw_actor_lb(actor, x + ox, y + oy + 32, ow)
        elsif $game_temp.in_battle
          unless $rtab_detected
            draw_actor_lb(actor, x + ox, y + oy + 32, ow)
          end
        end
      end
      lb_draw_battler_name(actor, x, y)
    end    
  end
  #--------------------------------------------------------------------------
  # * Draw Overdrive Meter
  #--------------------------------------------------------------------------
  def draw_actor_lb(actor, x, y, width = 144)
    if defined?(gauge_rect)
      rate = actor.limitbreak.to_f / LB_MAX
      plus_x = 0
      rate_x = 0
      plus_y = 25
      plus_width = 0
      rate_width = 100
      height = 11#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) #80-24
      color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192) #240-72
      lb = (width + plus_width) * actor.limitbreak * rate_width / 100 / LB_MAX
      gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
        width, plus_width + width * rate_width / 100,
        height, lb, align1, align2, align3,
        color1, color2, color3, color4, color5, color6, grade1, grade2)
    end      
  end
end
#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
#  This window displays the status of all party members on the battle screen.
#==============================================================================
class Window_BattleStatus < Window_Base
  
  alias lb_init initialize
  def initialize
    lb_init
    if defined?(at_refresh)
      $rtab_detected = true
    end
    refresh
  end
  #--------------------------------------------------------------------------
  # * Full Limit Break Gauge SE
  #--------------------------------------------------------------------------
  def full_lb_se
    if LB_RING != nil
      if LB_RING != ""
        Audio.se_play("Audio/SE/" + LB_RING, 80, 100)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Frame renewal
  #--------------------------------------------------------------------------
  alias lb_refresh refresh
  def refresh(number = 0)
    # Call the original def
    if $rtab_detected
      lb_refresh(number)
    else
      lb_refresh
    end
    # This block is needed only if RTAB in use
    if $rtab_detected
      # Ensure bitmap available for bar drawing
      if self.contents == nil
        self.contents = Bitmap.new(width - 32 ,height - 32)
      end
      # Search through actors & draw bar if applicable
      if number == 0
        for i in 0...$game_party.act
 

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