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.

[VX] Bonus Battles

Bonus Battles
by Dargor
Version 1.0


Introduction
It's been a while since I have posted something here so I thought I should release something new!
This script is based on Star Ocean 3 Bonus Battle system. When filling a bonus gauge with certain action such as using a skill or killing an enemy, the party enters in the Bonus Battle mode and gain bonuses as long as the bonus gauge is filled. The bonus gauge can be broken if a party member is killed or hit by a critical hit.

Screenshots


Script
Code:
 

#==============================================================================

# ** Bonus Battles

#------------------------------------------------------------------------------

#  © Dargor, 2008

#  09/08/08

#  Version 1.0

#------------------------------------------------------------------------------

#  VERSION HISTORY:

#   - 1.0 (09/08/08), Initial release

#------------------------------------------------------------------------------

#  INTRODUCTION:

#     This script is based on Star Ocean 3 Bonus Battle system.

#     When filling a bonus gauge with certain action such as

#     using a skill or killing an enemy, the party enters in the

#     Bonus Battle mode and gain bonuses as long as the bonus gauge is filled

#     The bonus gauge can be broken if a party member is killed or hit by

#     a critical hit.

#------------------------------------------------------------------------------

#  INSTRUCTIONS:

#   - Paste this above main

#   - Edit the constants in Bonus_Battles module  

#------------------------------------------------------------------------------

#  NOTES:

#   - This script supports only 4 bonuses

#      1) Double Gold

#      2) Double EXP

#      3) Increase chances of finding items

#      4) Increase chances of preemptive strikes

#==============================================================================

 

# Vocabulary

Vocab::BonusBattle = 'BONUS BATTLE!'

 

#==============================================================================

# ** Bonus Battle Configuration Module

#==============================================================================

 

module Bonus_Battles

  # The maximum rate (in percent) the bonus gauge can get

  Max_Rate = 300

  # The maximum amount of points the gauge needs to be filled

  Gauge_Max = 100

  # Gauge colors

  Gauge_Color_1 = 29

  Gauge_Color_2 = 28

  Back_Color = 19

  # Time (in seconds) before the bonus rate drops

  Decrease_Time = 2

  # Sound effects

  Gauge_Filled_SE = 'Heal1'

  Gauge_Break_SE = 'Battle2'

  Bonus_Battle_ME = 'Fanfare1'

  Play_Bonus_Battle_ME = false

  # Bonus Points gained

  Attack_Points = 1

  Skill_Points = 2

  Critical_Points = 4

  Kill_Points = 8

  # Automatically gain bonus if in Bonus Battle.

  Auto_Gain_Bonus = true

  # Order of auto-gained bonus

  Auto_Order = [1,3,4,2]

  # Gain a bonus at each X chain battles 

  # (Works only when Auto_Gain_Bonus = true)

  Bonus_Chain = 5

  # Preemptive Multiplier (When party has the Preemptive bonus)

  # VX original preemptive/surprise depends on the average party and 

  # troop agility. If the party's average agility is higher than the 

  # troop's average agility:

  # Preemptive chance = 5%, Surprise chance = 3%

  # If the troop's average agility is higher than the party's average 

  # agility:

  # Preemptive chance = 3%, Surprise chance = 5%

  Preemptive_Multiplier = 4

end

 

#==============================================================================

# ** Sound

#------------------------------------------------------------------------------

#  This module plays sound effects. It obtains sound effects specified in the

# database from $data_system, and plays them.

#==============================================================================

 

module Sound

  # Bonus Battle Gauge Break

  def self.play_gauge_break

    se = RPG::SE.new(Bonus_Battles::Gauge_Break_SE)

    se.play

  end

  # Bonus Battle Gauge Filled

  def self.play_gauge_filled

    se = RPG::SE.new(Bonus_Battles::Gauge_Filled_SE)

    se.play

  end

end

 

#==============================================================================

# ** SRPG::Enemt::DropItem

#==============================================================================

 

module RPG

  class Enemy

    class DropItem

      #------------------------------------------------------------------------

      # * Denominator

      #------------------------------------------------------------------------

      def denominator

        if $game_party.increase_items?

          return @denominator / 2

        else

          return @denominator

        end

      end 

    end

  end

end

 

#==============================================================================

# ** Game_Unit

#------------------------------------------------------------------------------

#  This class handles units. It's used as a superclass of the Game_Party and

# Game_Troop classes.

#==============================================================================

 

class Game_Unit

  #--------------------------------------------------------------------------

  # * Object Initialization

  #--------------------------------------------------------------------------

  def total_agi

    result = 0

    for member in members

      result += member.agi

    end

    return result

  end

end

 

#==============================================================================

# ** Game_System

#------------------------------------------------------------------------------

#  This class handles system-related data. Also manages vehicles and BGM, etc.

# The instance of this class is referenced by $game_system.

#==============================================================================

 

class Game_Party

  #--------------------------------------------------------------------------

  # * Public Instance Variables

  #--------------------------------------------------------------------------

  attr_accessor :bonus_battles

  attr_accessor :bonus_gauge

  attr_accessor :last_bonus_gauge

  attr_accessor :battle_bonuses

  attr_accessor :gauge_rate

  #--------------------------------------------------------------------------

  # * Alias Listing

  #--------------------------------------------------------------------------

  alias dargor_vx_bonus_gauge_party_initialize initialize

  alias dargor_vx_bonus_gauge_party_average_agi average_agi

  #--------------------------------------------------------------------------

  # * Object Initialization

  #--------------------------------------------------------------------------

  def initialize

    dargor_vx_bonus_gauge_party_initialize

    @bonus_battles = 0

    @bonus_gauge = 20

    @battle_bonuses = []

    @last_bonus_gauge = @bonus_gauge

    @gauge_rate = 200

  end

  #--------------------------------------------------------------------------

  # * Add Battle Bonus

  #--------------------------------------------------------------------------

  def add_battle_bonus(type)

    return unless can_add_bonus?

    if !@battle_bonuses.empty? && 

        (Bonus_Battles::Auto_Gain_Bonus or type == 0)

      auto_add_battle_bonus

    else

      @battle_bonuses << type

    end

    @battle_bonuses.sort!

    @battle_bonuses.uniq!

  end

  #--------------------------------------------------------------------------

  # * Auto Add Battle Bonus

  #--------------------------------------------------------------------------

  def auto_add_battle_bonus

    for i in Bonus_Battles::Auto_Order

      if !@battle_bonuses.include?(i)

        @battle_bonuses << i

        return

      end

    end

  end

  #--------------------------------------------------------------------------

  # * Can Add Battle Bonus?

  #--------------------------------------------------------------------------

  def can_add_bonus?

    if @battle_bonuses.size == 0

      result = Integer(@bonus_gauge) >= Bonus_Battles::Gauge_Max

      @bonus_gauge = [@bonus_gauge, Bonus_Battles::Gauge_Max].min

      return result

    elsif @bonus_battles > 0

      result = @bonus_battles % Bonus_Battles::Bonus_Chain == 0

      return result

    end

    return false

  end

  #--------------------------------------------------------------------------

  # * Get Adjusted Gauge Rate

  #--------------------------------------------------------------------------

  def get_adjusted_gauge_rate

    agi_total = [average_agi, $game_troop.average_agi]

    agi_min = agi_total.min

    agi_max = agi_total.max

    difference = (agi_min * 100) / agi_max

    if average_agi >= $game_troop.average_agi

      difference -= 1 until difference % 10 == 0

      rate = 100 - ((difference / 2) + ($game_party.members.size * 10))

    else

      difference += 1 until difference % 10 == 0

      rate = 100 + ((difference / 2) + ($game_troop.members.size * 10))

    end

    rate = [[rate, Bonus_Battles::Max_Rate].min, 0].max

    return rate

  end

  #--------------------------------------------------------------------------

  # * Calculate Average Agility

  #--------------------------------------------------------------------------

  def average_agi

    result = dargor_vx_bonus_gauge_party_average_agi

    result *= 2 if increase_preemptive?

    return result

  end

  #--------------------------------------------------------------------------

  # * Increase Gold Bonus

  #--------------------------------------------------------------------------

  def increase_gold?

    return @battle_bonuses.include?(1)

  end

  #--------------------------------------------------------------------------

  # * Increase EXP Bonus

  #--------------------------------------------------------------------------

  def increase_exp?

    return @battle_bonuses.include?(2)

  end

  #--------------------------------------------------------------------------

  # * Increase Items Bonus

  #--------------------------------------------------------------------------

  def increase_items?

    return @battle_bonuses.include?(3)

  end

  #--------------------------------------------------------------------------

  # * Increase Preemptive Bonus

  #--------------------------------------------------------------------------

  def increase_preemptive?

    return @battle_bonuses.include?(4)

  end

end

 

#==============================================================================

# ** Game_Enemy

#------------------------------------------------------------------------------

#  This class handles enemy characters. It's used within the Game_Troop class

# ($game_troop).

#==============================================================================

 

class Game_Enemy < Game_Battler

  #--------------------------------------------------------------------------

  # * ALias Listing

  #--------------------------------------------------------------------------

  alias dargor_vx_bonus_battle_enemy_exp exp

  alias dargor_vx_bonus_battle_enemy_gold gold

  #--------------------------------------------------------------------------

  # * Get Experience

  #--------------------------------------------------------------------------

  def exp

    result = dargor_vx_bonus_battle_enemy_exp

    result *= 2 if $game_party.increase_exp?

    return result

  end

  #--------------------------------------------------------------------------

  # * Get Gold

  #--------------------------------------------------------------------------

  def gold

    result = dargor_vx_bonus_battle_enemy_gold

    result *= 2 if $game_party.increase_gold?

    return result

  end

end

 

#==============================================================================

# ** Sprite_BonusGauge

#------------------------------------------------------------------------------

#  This sprite is used to display the bonus gauge on the battle screen. 

#  It observes the $game_system bonus gauge variables and automatically 

#  changes sprite conditions.

#==============================================================================

 

class Sprite_BonusGauge < Sprite

  #--------------------------------------------------------------------------

  # * Public Instance Variables

  #--------------------------------------------------------------------------

  attr_accessor :rate_sprite

  attr_accessor :chain_sprite

  #--------------------------------------------------------------------------

  # * Object Initialization

  #     viewport : viewport

  #--------------------------------------------------------------------------

  def initialize(viewport)

    super(viewport)

    self.bitmap = Bitmap.new(92, 268)

    self.x = 544 - self.bitmap.width

    self.y = 16

    self.z = 200

    # Create a seperate sprite for Bonus Rate

    @rate_sprite = Sprite.new(viewport)

    @rate_sprite.bitmap = Bitmap.new(88,24)

    @rate_sprite.x = self.x

    @rate_sprite.y = 264

    @rate_sprite.z = self.z + 1

    # Create a seperate sprite for Chain Battles

    @chain_sprite = Sprite.new(viewport)

    @chain_sprite.bitmap = Bitmap.new(128,24)

    @chain_sprite.x = self.x

    @chain_sprite.y = 0

    @chain_sprite.z = self.z + 1

    @last_color = text_color(0)

    refresh

  end

  #--------------------------------------------------------------------------

  # * Dispose

  #--------------------------------------------------------------------------

  def dispose

    super

    self.bitmap.dispose

    @rate_sprite.dispose

    @chain_sprite.dispose

  end

  #--------------------------------------------------------------------------

  # * Refresh

  #--------------------------------------------------------------------------

  def refresh

    self.bitmap.clear

    @rate_sprite.bitmap.clear

    @chain_sprite.bitmap.clear

    self.bitmap.fill_rect(70,0,10,268,gauge_back_color)

    $game_party.bonus_gauge = [$game_party.bonus_gauge, Bonus_Battles::Gauge_Max].min

    bar_height = ($game_party.bonus_gauge * 264) / Bonus_Battles::Gauge_Max

    bar_y = 264 - bar_height + 2

    gc1 = bar_color_1

    gc2 = bar_color_2

    self.bitmap.gradient_fill_rect(72,bar_y,6,bar_height,gc1,gc2,true)

    rate = $game_party.gauge_rate

    case rate

    when 0

      color = knockout_color

    when 10..49

      color = crisis_color

    else

      color = Color.new(255,255,255)

    end

    if color != @last_color

      @rate_sprite.flash(@last_color, 20 * 4)

    end

    @rate_sprite.bitmap.font.color = color

    @rate_sprite.bitmap.draw_text(0,0,88,24,"#{rate}%",2)

    if $game_party.bonus_battles > 0

      chain = $game_party.bonus_battles

      @chain_sprite.bitmap.font.color = text_color(0)

      @chain_sprite.bitmap.draw_text(0,0,32,24,chain,2)

      @chain_sprite.bitmap.font.color = system_color

      @chain_sprite.bitmap.draw_text(0,0,88,24,"Chain",2)

    end

    @last_color = color

    if $game_party.bonus_gauge == Bonus_Battles::Gauge_Max &&

        $game_party.last_bonus_gauge != Bonus_Battles::Gauge_Max

      Sound.play_gauge_filled

      self.flash(Color.new(255,255,255), 20 * 4)

    end

    if $game_party.bonus_gauge == 0 && 

        $game_party.last_bonus_gauge != 0

      Sound.play_gauge_break

      self.flash(Color.new(255,255,255), 20 * 4)

    end

    $game_party.last_bonus_gauge = $game_party.bonus_gauge

  end

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    super

    @rate_sprite.update

    $game_party.bonus_gauge = [$game_party.bonus_gauge, Bonus_Battles::Gauge_Max].min

    if $game_party.bonus_gauge != @points

      refresh

    end

  end

  #--------------------------------------------------------------------------

  # * Get Text Color

  #     n : Text color number  (0-31)

  #--------------------------------------------------------------------------

  def text_color(n)

    windowskin = Cache.system("Window")

    x = 64 + (n % 8) * 8

    y = 96 + (n / 8) * 8

    return windowskin.get_pixel(x, y)

  end

  #--------------------------------------------------------------------------

  # * Get System Text Color

  #--------------------------------------------------------------------------

  def system_color

    return text_color(16)

  end

  #--------------------------------------------------------------------------

  # * Get Crisis Text Color

  #--------------------------------------------------------------------------

  def crisis_color

    return text_color(17)

  end

  #--------------------------------------------------------------------------

  # * Get Knockout Text Color

  #--------------------------------------------------------------------------

  def knockout_color

    return text_color(18)

  end

  #--------------------------------------------------------------------------

  # * Get Gauge First Color

  #--------------------------------------------------------------------------

  def bar_color_1

    return text_color(Bonus_Battles::Gauge_Color_1)

  end

  #--------------------------------------------------------------------------

  # * Get Gauge Second Color

  #--------------------------------------------------------------------------

  def bar_color_2

    return text_color(Bonus_Battles::Gauge_Color_2)

  end

  #--------------------------------------------------------------------------

  # * Get Gauge Background Color

  #--------------------------------------------------------------------------

  def gauge_back_color

    return text_color(Bonus_Battles::Back_Color)

  end

end

 

#==============================================================================

# ** Sprite_Battler

#------------------------------------------------------------------------------

#  This sprite is used to display battlers. It observes a instance of the

# Game_Battler class and automatically changes sprite conditions.

#==============================================================================

 

class Game_Battler

  #--------------------------------------------------------------------------

  # * Alias Listing

  #--------------------------------------------------------------------------

  alias dargor_vx_bonus_battles_battler_make_attack_damage_value make_attack_damage_value

  alias dargor_vx_bonus_battles_battler_skill_effect skill_effect

  #--------------------------------------------------------------------------

  # * Calculation of Damage From Normal Attack

  #     attacker : Attacker

  #    The results are substituted for @hp_damage

  #--------------------------------------------------------------------------

  def make_attack_damage_value(attacker)

    dargor_vx_bonus_battles_battler_make_attack_damage_value(attacker)

    if attacker.is_a?(Game_Actor)

      if @critical

        # Do not add points for critical hit if the hit kills the target.

        # Instead, add points for killing the target.

        unless @hp_damage >= self.hp

          points = Bonus_Battles::Critical_Points

          points *= $game_party.gauge_rate.to_f / 100

          $game_party.bonus_gauge += points

          # Gain bonus for filling the bonus gauge with a critical hit

          $game_party.add_battle_bonus(3)

        end

      elsif @hp_damage > 0 or @mp_damage > 0

        # Do not add points for hitting if the hit kills the target.

        # Instead, add points for killing the target.

        unless @hp_damage >= self.hp

          points = Bonus_Battles::Attack_Points

          points *= $game_party.gauge_rate.to_f / 100

          $game_party.bonus_gauge += points

          # Gain bonus for filling the bonus gauge with an attack

          $game_party.add_battle_bonus(1)

        end

      end

    else

      # Break bonus gauge if hit by a critical

      if @critical

        $game_party.bonus_gauge = 0

        $game_party.bonus_battles = 0

        $game_party.battle_bonuses = []

      end

    end

  end

  #--------------------------------------------------------------------------

  # * Apply Skill Effects

  #     user  : Skill user

  #     skill : skill

  #--------------------------------------------------------------------------

  def skill_effect(user, skill)

    dargor_vx_bonus_battles_battler_skill_effect(user, skill)

    if user.is_a?(Game_Actor)

      # Do not add points for using skill if the skill kills the target.

      # Instead, add points for killing the target.

      unless @hp_damage >= self.hp

        points = Bonus_Battles::Skill_Points

        points *= $game_party.gauge_rate.to_f / 100

        $game_party.bonus_gauge += points

        # Gain bonus for filling the bonus gauge with an skill

      $game_party.add_battle_bonus(2)

      end

    end

  end

end

 

#==============================================================================

# ** Game_Actor

#------------------------------------------------------------------------------

#  This class handles actors. It's used within the Game_Actors class

# ($game_actors) and referenced by the Game_Party class ($game_party).

#==============================================================================

 

class Game_Actor < Game_Battler

  #--------------------------------------------------------------------------

  # * Alias Listing

  #--------------------------------------------------------------------------

  alias dargor_vx_bonus_battles_actor_perform_collapse perform_collapse

  #--------------------------------------------------------------------------

  # * Perform Collapse

  #--------------------------------------------------------------------------

  def perform_collapse

    dargor_vx_bonus_battles_actor_perform_collapse

    if $game_temp.in_battle and dead?

      $game_party.bonus_gauge = 0

      $game_party.bonus_battles = 0

      $game_party.battle_bonuses = []

    end

  end

end

 

#==============================================================================

# ** Game_Enemy

#------------------------------------------------------------------------------

#  This class handles enemy characters. It's used within the Game_Troop class

# ($game_troop).

#==============================================================================

 

class Game_Enemy < Game_Battler

  #--------------------------------------------------------------------------

  # * Alias Listing

  #--------------------------------------------------------------------------

  alias dargor_vx_bonus_battles_enemy_perform_collapse perform_collapse

  #--------------------------------------------------------------------------

  # * Perform Collapse

  #--------------------------------------------------------------------------

  def perform_collapse

    dargor_vx_bonus_battles_enemy_perform_collapse

    if $game_temp.in_battle and dead?

      points = Bonus_Battles::Kill_Points

      points *= $game_party.gauge_rate.to_f / 100

      $game_party.bonus_gauge += points

      # Gain bonus for filling the bonus gauge by killing an enemy

      $game_party.add_battle_bonus(4)

    end

  end

end

 

#==============================================================================

# ** Spriteset_Battle

#------------------------------------------------------------------------------

#  This class brings together battle screen sprites. It's used within the

# Scene_Battle class.

#==============================================================================

 

class Spriteset_Battle

  #--------------------------------------------------------------------------

  # * Public Instance Variables

  #--------------------------------------------------------------------------

  attr_accessor  :bonus_gauge

  #--------------------------------------------------------------------------

  # * Create Picture Sprite

  #--------------------------------------------------------------------------

  alias dargor_vx_bonus_battles_spriteset_create_pictures create_pictures

  alias dargor_vx_bonus_battles_spriteset_dispose_pictures dispose_pictures

  alias dargor_vx_bonus_battles_spriteset_update_pictures update_pictures

  #--------------------------------------------------------------------------

  # * Create Picture Sprite

  #--------------------------------------------------------------------------

  def create_pictures

    dargor_vx_bonus_battles_spriteset_create_pictures

    @bonus_gauge = Sprite_BonusGauge.new(@viewport2)

  end

  #--------------------------------------------------------------------------

  # * Dispose of Picture Sprite

  #--------------------------------------------------------------------------

  def dispose_pictures

    dargor_vx_bonus_battles_spriteset_dispose_pictures

    @bonus_gauge.dispose

  end

  #--------------------------------------------------------------------------

  # *Update Picture Sprite

  #--------------------------------------------------------------------------

  def update_pictures

    dargor_vx_bonus_battles_spriteset_update_pictures

    @bonus_gauge.update

  end

end

 

#==============================================================================

# ** Window_BonusBattle

#------------------------------------------------------------------------------

#  This window displays battle bonuses on the battle screen.

#==============================================================================

 

class Window_BonusBattle < Window_Base

  #--------------------------------------------------------------------------

  # * Object Initialization

  #--------------------------------------------------------------------------

  def initialize

    super(0, 0, 544, 160)

    self.opacity = 0

    self.openness = 0

    create_back_sprite

    refresh

  end

  #--------------------------------------------------------------------------

  # * refresh

  #--------------------------------------------------------------------------

  def refresh

    self.contents.clear

    self.contents.font.size = 24

    self.contents.font.color = crisis_color

    self.contents.draw_text(0,0,504,WLH,Vocab::BonusBattle,1)

    self.contents.font.size = 20

    self.contents.font.color = normal_color

    return if $game_party.battle_bonuses.size == 0

    for i in 0...$game_party.battle_bonuses.size

      bonus = $game_party.battle_bonuses[i]

      x = i % 1 * 272

      y = i / 1 * WLH

      case bonus

      when 1

        text = 'Double Gold'

      when 2

        text = 'Double EXP'

      when 3 

        text = 'Raise chances of finding items'

      when 4

        text = 'Raise chances of preemptive strikes'

      end

      self.contents.draw_text(x,y + WLH,504,WLH,text)

    end

  end

  #--------------------------------------------------------------------------

  # * Create Background Sprite

  #--------------------------------------------------------------------------

  def create_back_sprite

    @back_sprite = Sprite.new

    @back_sprite.bitmap = Cache.system("MessageBack")

    @back_sprite.opacity = openness

    @back_sprite.z = self.z - 1

  end

  #--------------------------------------------------------------------------

  # * Dispose of Background Sprite

  #--------------------------------------------------------------------------

  def dispose_back_sprite

    @back_sprite.dispose

  end

  #--------------------------------------------------------------------------

  # * Update Background Sprite

  #--------------------------------------------------------------------------

  def update_back_sprite

    @back_sprite.opacity = openness

    @back_sprite.update

  end

  #--------------------------------------------------------------------------

  # * Dispose

  #--------------------------------------------------------------------------

  def dispose

    super

    dispose_back_sprite

  end

  #--------------------------------------------------------------------------

  # * Update

  #--------------------------------------------------------------------------

  def update

    super

    update_back_sprite

  end

end

 

#==============================================================================

# ** Window_Base

#------------------------------------------------------------------------------

#  This is a superclass of all windows in the game.

#==============================================================================

 

class Window_Base < Window

  #--------------------------------------------------------------------------

  # * Public Instance Variables

  #--------------------------------------------------------------------------

  attr_reader :opening

end

 

#==============================================================================

# ** Scene_Map

#------------------------------------------------------------------------------

#  This class performs the map screen processing.

#==============================================================================

 

class Scene_Map < Scene_Base

  #--------------------------------------------------------------------------

  # * Alias Listing

  #--------------------------------------------------------------------------

  alias dargor_vx_bonus_battle_map_preemptive_or_surprise preemptive_or_surprise

  #--------------------------------------------------------------------------

  # * Determine Preemptive Strike and Surprise Attack Chance

  #--------------------------------------------------------------------------

  def preemptive_or_surprise

    if $game_party.increase_preemptive?

      actors_agi = $game_party.average_agi

      enemies_agi = $game_troop.average_agi

      if actors_agi >= enemies_agi

        percent_preemptive = 5 * Bonus_Battles::Preemptive_Multiplier

        percent_surprise = 3

      else

        percent_preemptive = 3 * Bonus_Battles::Preemptive_Multiplier

        percent_surprise = 5

      end

      if rand(100) < percent_preemptive

        $game_troop.preemptive = true

      elsif rand(100) < percent_surprise

        $game_troop.surprise = true

      end

    else

      dargor_vx_bonus_battle_map_preemptive_or_surprise

    end

  end

end

 

#==============================================================================

# ** Scene_Battle

#------------------------------------------------------------------------------

#  This class performs battle screen processing.

#==============================================================================

 

class Scene_Battle < Scene_Base

  #--------------------------------------------------------------------------

  # * Alias Listing

  #--------------------------------------------------------------------------

  alias dargor_vx_bonus_battles_battle_start start

  alias dargor_vx_bonus_battles_battle_terminate terminate

  alias dargor_vx_bonus_battles_battle_update_basic update_basic

  alias dargor_vx_bonus_battles_battle_execute_action execute_action

  #--------------------------------------------------------------------------

  # * Start Processing

  #--------------------------------------------------------------------------

  def start

    # Increase bonus battle count

    if $game_party.bonus_gauge == Bonus_Battles::Gauge_Max

      $game_party.bonus_battles += 1

    end

    # Auto-gain bonuses

    $game_party.add_battle_bonus(0)

    # Set gauge rate

    $game_party.gauge_rate = $game_party.get_adjusted_gauge_rate

    # Create bonus window

    @bonus_window = Window_BonusBattle.new

    @bonus_window.open if $game_party.bonus_battles > 0

    @last_party_bonus = $game_party.battle_bonuses

    dargor_vx_bonus_battles_battle_start

  end

  #--------------------------------------------------------------------------

  # * Start Processing

  #--------------------------------------------------------------------------

  def terminate

    dargor_vx_bonus_battles_battle_terminate

    @bonus_window.dispose

  end

  #--------------------------------------------------------------------------

  # * Basic Update Processing

  #     main : Call from main update method

  #--------------------------------------------------------------------------

  def update_basic(main = false)

    @bonus_window.update

    update_bonus_gauge          # Update the bonus gauge

    update_bonus_window         # Update the bonus window

    # Close the bonus window

    if Input.trigger?(Input::C)

      @bonus_window.close

    end

    # The usual

    dargor_vx_bonus_battles_battle_update_basic(main)

  end

  #--------------------------------------------------------------------------

  # * Frame Update (Bonus gauge)

  #--------------------------------------------------------------------------

  def update_bonus_gauge

    if update_bonus_gauge?

      $game_party.gauge_rate = [$game_party.gauge_rate -= 10, 0].max

      @spriteset.bonus_gauge.refresh

    end

  end

  #--------------------------------------------------------------------------

  # * Frame Update (Bonus window)

  #--------------------------------------------------------------------------

  def update_bonus_window

    if ($game_party.bonus_gauge == Bonus_Battles::Gauge_Max &&

        $game_party.last_bonus_gauge != Bonus_Battles::Gauge_Max) or

        ($game_party.battle_bonuses != @last_party_bonus)

      @bonus_window.refresh

      @bonus_window.open

      @bonus_me = RPG::ME.new

      @bonus_me.name = Bonus_Battles::Bonus_Battle_ME

      @bonus_me.play if Bonus_Battles::Play_Bonus_Battle_ME

      if $game_party.battle_bonuses != @last_party_bonus

        @last_party_bonus = $game_party.battle_bonuses

      end

    end

  end

  #--------------------------------------------------------------------------

  # * Update Bonus Gauge?

  #--------------------------------------------------------------------------

  def update_bonus_gauge?

    time = Bonus_Battles::Decrease_Time * 60

    result = true

    result &&= @party_command_window.active == false 

    result &&= @message_window.visible == false

    result &&= Graphics.frame_count % time == 0

    return result

  end

end

Note
This script supports only 4 bonuses
1) Double Gold
2) Double EXP
3) Increase chances of finding items
4) Increase chances of preemptive strikes

Also, the algorithm for the gauge rate isn't final yet.

Enjoy!
-Dargor
 

Namio

Member

i'm seem to be having some trouble. When i have more than 7 people in my party (using KGCs Large Party Script) the Bonus Bar won't fill up and has 0%. I have like 10 party members
 
It's probably because you are too strong compared to the enemy troop.
The stronger you are, the lower the gauge rate will be, the weaker you are, the higher it is.
That's how it works.
 
Dargor, the script looks great! I reminisce using KGC's Bonus Gauge script for XP, and certainly enjoyed gaining extra EXP, Gold and getting a higher probability of getting items. ;)
However, whilst having this script in my game, unfortunately, there must had been something wrong with the demoninator definition, "return @denominator / 2" to be specific.
I do apologize if this is not of fullest detail.
 
@Namio 
Right now, it depends on the average agility of the party/troop. In SO3, it depends on the average level but enemies doesn't have a level in VX. I'm will add a really basic enemy level system and update the script today.

@Hyper Wind 
I don't understand what is the problem. In VX, the probability of finding an item is 1/denominator. So if the denominator is 10, you have 10% of finding an item. What I'm doing here is that I'm dividing the denominator by 2, so it multiplies by 2 the chances of finding items. If the denominator is 10 and you have the item bonus, the chances will now be 1/5, 20%
 
Why not add Regenerate HP/MP at the end of each battle as a bonus? Similar to increased regeneration in SO3... but, yeah. :]
 
Yeah, I've exchanged that with the increased preemptive bonus but if you have ideas for new kind of bonuses, feel free to share them!
I'll add this bonus in the next version. :thumb:
 
How about better versions of your current bonuses. I.e. Triple Gold, Triple EXP, Triple Item(Might be to much). 

Here are some new ones though:

Reduced Magic Cost 1/2
Evasion x2
Critical x2 (chance of critical)
Speed x2

I was thinking of enhancing Attack and Defense but this would really unbalance it.
 
Dargor":6rpt96hd said:
@Hyper Wind 
I don't understand what is the problem. In VX, the probability of finding an item is 1/denominator. So if the denominator is 10, you have 10% of finding an item. What I'm doing here is that I'm dividing the denominator by 2, so it multiplies by 2 the chances of finding items. If the denominator is 10 and you have the item bonus, the chances will now be 1/5, 20%

I know that the denominator by 2 multiplies the chances of finding items, I meant to say that the game crashes, pointing to that specific line, and can not understand why it is happening. It's kinda hard to explain, maybe I'll just send a screenshot for an example.
 
Since you're hearing out possible suggestions, I got a few.

- Apply specified state to party, enemies or all.  States can handle a lot of bonuses, though, I don't know how hard is making sure states get removed when the bonus is broken.
- Assign a game variable that stores current bonus combo.  Could be used for quests/HUD/etc.
- Assign a 2nd game variable that stores highest combo attained.  For game records and quests.
 
Hi Dargor.

I love the concept of this script.  :thumb: I'm using this script and didnt understand some point.

(1) What is the percent things in the bottom of the bar? And how to adjust it?
(2) How to on/off a bonus? Like for 'Double Gold & Double EXP' = true. But for 'Increase chances of finding items & Increase chances of preemptive strikes' = false

Suggestion
(1) I think you should made the gauge break if the player try to escape from battle. In this script, I tested, when the party escape its still counted as a battle, so the bonus chain always added when the party encounter monster and escape again. So I think breaking the bonus when the party trying to escape (succeed or not succeed) is a good idea.
(2) I think it would be better if after the gauge bar full filled, it would start form zero again but counted as the second/next chain progression.
(3) Ad a 'vocab'/text that tell the player when the gauge was break.

Thanks before.
 
@Kreytor
Thanks, there are really good.

@Hyper Wind
Assuming it happens when you have the DOuble Items bonus, what is/are the default denominator of the item/s?

@Mr. Bubble
I like the idea of adding states.
The Bonus Combo and Highest Combo will be stored into the Game_System class. They will be accessible by using a script call.

@lahandi

1. The percent is the Gauge Rate. It determines at which rate you gain points. If the rate is 100% and the action you're doing gives you 8 points by default, then you will gain 8 points. If it's 200% you will gain 16 and if it's 50% you will gain 4. This rate drops by 10% at each x seconds (customizable).

2. You can add or remove one of the current 4 bonuses bu using this line of code
Code:
$game_system.battle_bonuses.delete(x)
where X is 1 to 4.
1) Double Gold
2) Double EXP
3) Increase chances of finding items
4) Increase chances of preemptive strikes

About your suggestions:
1. That's an excellent good idea. In fact, I think it was working like that in Star Ocean 3.
2. I'm not sure about that but I can add this as a tooglable feature.
3. Will do.


I'm planing on making a sort of Bonus Editor so that everybody can have it's own set of bonuses.

I'll try to update the script soon.
Thanks for all the suggestions!
-Dargor
 
Can I know approximately when the new version of this script will be released. Is it still long?

I'm using it on my project and I think it would be nice to see the enhancement.

Really sorry for the hassle... Because I like this script :)
 
No touble ;)
I can't say when the next version will be out. In fact, I can't say for all my scripts because I'm working a lot and I only have my weekends to work on them. But you can expect an update soon. Also, I'm planning on releasing a compilation of all my VX scripts and some other unreleased scripts. I will probably do that before I update each scripts individually so that everybody can have an updated version of my scripts at the same time.

Sorry for the wait
-Dargor
 

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