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.

RTAB Demo or Script

Title.
Looking for the one that Dervv hosted/edited, but the link is broken in the script archives.
Anyone who's been around for awhile knows what I'm talking about.
 
Here it is.


# Real time active battle (RTAB)  Ver 1.16
# Distribution original support URL
# http://members.jcom.home.ne.jp/cogwheel/

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Open instance variable
  #--------------------------------------------------------------------------
  attr_reader  :status_window            # Status Window
  attr_reader  :spriteset                # Battle sprite
  attr_reader  :scroll_time              # Screen portable basic time
  attr_reader  :zoom_rate                # Enemy battler basic position
  attr_reader  :drive                    # Camera drive
  attr_accessor :force                    # Degree of action forcing
  attr_accessor :camera                  # Present camera possession person
  #--------------------------------------------------------------------------
  # * ATB fundamental setup
  #--------------------------------------------------------------------------
  def atb_setup
    # ATB initialization
    #
    # speed  : Battle speed decision. The lower the value, the faster the system
    #
    # @active : Degree of active setting
    #          3 : Always active state
    #          2 : ATB pauses when selecting skill/item
    #          1 : Same as 2, but pauses during target selection
    #          0 : Same as 1, but pauses during command window selection.
    #
    # @action : Others while acting is the fact that by their causes conduct permitted?
    #          3 : If by his is not incapacitation, limited to you permit
    #          2 : If by his has not received the damage, you permit
    #          1 : In addition to the state of 2, if the target has not acted, you permit
    #          0 : Conduct is not permitted. Until it finishes to act in order, it waits
    #
    # @anime_wait : When it makes true, during battle animation damage indicating wait catches
    # @damage_wait : Damage indicatory waiting (as for unit frame)
    #
    # @after_wait : At the time of ally enemy total loss,  until moves to next processing, waiting
    #              [a, b]  a) At the time of party total loss,  b) At time of enemy total loss (unit frame)
    #
    # @enemy_speed : Thought speed of enemy. If 1 immediately conduct.
    #                In every frame, conduct is caused with the probability of 1/@enemy_speed
    #
    # @force : With forced action forced condition at time of skill use
    #          2: As for skill everything not to reside permanently, by all means immediately execution
    #          1: As for independent skill to reside permanently, only cooperation skill immediately execution
    #          0: All the skill permanent residence just are done
    #
    # ($scene.force = Usually by making x, from the script of the event modification possibility)
    #
    # CAMERA DRIVE SYSTEM:  This system moves the Camera POV to the currently moving battler
    # @drive      : Camera drive system ON/OFF.  When true, drive ON, when false drive OFF
    # @scroll_time : Time it takes to scroll/move the camera POV during battle
    #
    # @zoom_rate = [i, j] : Zoom ratio of enemy
    #                      i) When arranging in the picture first section, enlargement ratio
    #                      j) When arranging in the picture lowest section, enlargement ratio
    #                      1  When liking to make time, 1.0 be sure to set with decimal
    speed = 150            # IN FRAMES / FOR ATB SYSTEM
    @active = 3            # Active Setting (Range of 0 - 3)
    @action = 0            # Action Setting (Range of 0 - 3)
    @anime_wait = false    #
    @damage_wait = 10      #
    @after_wait = [80, 0]  #
    @enemy_speed = 140      #
    @force = 2              #
    @drive = false          # Turns camera system on/off
    @scroll_time = 15      # Speed of camera system
    @zoom_rate = [0.2, 2.0] # Controls perspective of battlers on screen
    @help_time = 40        #
    @escape == false        #
    @camera = nil          # Used by system:  Determines camera
    @max = 0                # 
    @turn_cnt = 0          # Turns
    @help_wait = 0          #
    @action_battlers = []  # Used by system to hold battlers
    @synthe = []            # Used by system: For Cooperative Skills & such
    @spell_p = {}          #
    @spell_e = {}          #
    @command_a = false      #
    @command = []          #
    @party = false          #
    for battler in $game_party.actors + $game_troop.enemies
      spell_reset(battler)
      battler.at = battler.agi * rand(speed / 2)
      battler.damage_pop = {}
      battler.damage = {}
      battler.damage_sp = {}
      battler.critical = {}
      battler.recover_hp = {}
      battler.recover_sp = {}
      battler.state_p = {}
      battler.state_m = {}
      battler.animation = []
      if battler.is_a?(Game_Actor)
        @max += battler.agi
      end
    end
    @max *= speed
    @max /= $game_party.actors.size

    for battler in $game_party.actors + $game_troop.enemies
      battler.atp = 100 * battler.at / @max
    end
  end

  #--------------------------------------------------------------------------
  # * Full AT Gauge SE
  #--------------------------------------------------------------------------
  def fullat_se
    Audio.se_play("Audio/SE/033-switch02", 80, 100)
  end

  #--------------------------------------------------------------------------
  # * Leveling Up SE
  #--------------------------------------------------------------------------
  def levelup_se
    Audio.se_play("Audio/SE/056-Right02", 80, 100)
  end

  #--------------------------------------------------------------------------
  # * Skill Acquisition SE
  #--------------------------------------------------------------------------
  def skill_se
    Audio.se_play("Audio/SE/056-Right02", 80, 150)
  end
end

class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Draw Actor ATG
  #    actor : Actor
  #    x    : draw spot x-coordinate
  #    y    : draw spot y-coordinate
  #    width : draw spot width
  #--------------------------------------------------------------------------
  def draw_actor_atg(actor, x, y, width = 144)
    if @at_gauge == nil
      # plus_x:    revised x-coordinate
      # rate_x:    revised X-coordinate as (%)
      # plus_y:    revised y-coordinate
      # plus_width: revised width
      # rate_width: revised width as (%)
      # height:    Vertical width
      # align1: Type 1 ( 0: left justify  1: center justify 2: right justify )
      # align2: Type 2 ( 0: Upper stuffing 1: Central arranging  2:Lower stuffing )
      # align3: Gauge type 0:Left justify 1: Right justify
      @plus_x = 0
      @rate_x = 0
      @plus_y = 16
      @plus_width = 0
      @rate_width = 100
      @width = @plus_width + width * @rate_width / 100
      @height = 16
      @align1 = 0
      @align2 = 1
      @align3 = 0
      # Gradation settings:  grade1: Empty gauge  grade2:Actual gauge
      # (0:On side gradation  1:Vertically gradation    2: Slantedly gradation)
      grade1 = 1
      grade2 = 0
      # Color setting. color1: Outermost framework, color2: Medium framework
      # color3: Empty framework dark color, color4: Empty framework light/write color
      color1 = Color.new(0, 0, 0)
      color2 = Color.new(255, 255, 192)
      color3 = Color.new(0, 0, 0, 192)
      color4 = Color.new(0, 0, 64, 192)
      # Color setting of gauge
      # Usually color setting of the time
      color5 = Color.new(0, 64, 80)
      color6 = Color.new(0, 128, 160)
      # When gauge is MAX, color setting
      color7 = Color.new(80, 0, 0)
      color8 = Color.new(240, 0, 0)
      # Color setting at time of cooperation skill use
      color9 = Color.new(80, 64, 32)
      color10 = Color.new(240, 192, 96)
      # Color setting at time of skill permanent residence
      color11 = Color.new(80, 0, 64)
      color12 = Color.new(240, 0, 192)
      # Drawing of gauge
      gauge_rect_at(@width, @height, @align3, color1, color2,
                  color3, color4, color5, color6, color7, color8,
                  color9, color10, color11, color12, grade1, grade2)
    end
    # Variable at substituting the width of the gauge which is drawn
    if actor.rtp == 0
      at = (width + @plus_width) * actor.atp * @rate_width / 10000
    else
      at = (width + @plus_width) * actor.rt * @rate_width / actor.rtp / 100
    end
    if at > width
      at = width
    end
    # Revision such as the left stuffing central posture of gauge
    case @align1
    when 1
      x += (@rect_width - width) / 2
    when 2
      x += @rect_width - width
    end
    case @align2
    when 1
      y -= @height / 2
    when 2
      y -= @height
    end
    self.contents.blt(x + @plus_x + width * @rate_x / 100, y + @plus_y,
                      @at_gauge, Rect.new(0, 0, @width, @height))
    if @align3 == 0
      rect_x = 0
    else
      x += @width - at - 1
      rect_x = @width - at - 1
    end
    # Color setting of gauge
    if at == width
        # Gauge drawing at the time of MAX
      self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
                        @at_gauge, Rect.new(rect_x, @height * 2, at, @height))
    else
      if actor.rtp == 0
        # Usually gauge drawing of the time
        self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
                          @at_gauge, Rect.new(rect_x, @height, at, @height))
      else
        if actor.spell == true
          #Gauge drawing at time of cooperation skill use
          self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
                        @at_gauge, Rect.new(rect_x, @height * 3, at, @height))
        else
          # Gauge drawing at time of skill permanent residence
          self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
                        @at_gauge, Rect.new(rect_x, @height * 4, at, @height))
        end
      end
    end
  end
end

#==============================================================================
# ** Scene_Battle (part 1)
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Initialize each kind of temporary battle data
    $game_temp.in_battle = true
    $game_temp.battle_turn = 0
    $game_temp.battle_event_flags.clear
    $game_temp.battle_abort = false
    $game_temp.battle_main_phase = false
    $game_temp.battleback_name = $game_map.battleback_name
    $game_temp.forcing_battler = nil
    # Initialize battle event interpreter
    $game_system.battle_interpreter.setup(nil, 0)
    # Prepare troop
    @troop_id = $game_temp.battle_troop_id
    $game_troop.setup(@troop_id)
    atb_setup
    # Make actor command window
    s1 = $data_system.words.attack
    s2 = $data_system.words.skill
    s3 = $data_system.words.guard
    s4 = $data_system.words.item
    @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
    @actor_command_window.y = 160
    @actor_command_window.back_opacity = 160
    @actor_command_window.active = false
    @actor_command_window.visible = false
    # Make other windows
    @party_command_window = Window_PartyCommand.new
    @help_window = Window_Help.new
    @help_window.back_opacity = 160
    @help_window.visible = false
    @status_window = Window_BattleStatus.new
    @message_window = Window_Message.new
    # Make sprite set
    @spriteset = Spriteset_Battle.new
    # Initialize wait count
    @wait_count = 0
    # Execute transition
    if $data_system.battle_transition == ""
      Graphics.transition(20)
    else
      Graphics.transition(40, "Graphics/Transitions/" +
        $data_system.battle_transition)
    end
    # Start pre-battle phase
    start_phase1
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Refresh map
    $game_map.refresh
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @actor_command_window.dispose
    @party_command_window.dispose
    @help_window.dispose
    @status_window.dispose
    @message_window.dispose
    if @skill_window != nil
      @skill_window.dispose
    end
    if @item_window != nil
      @item_window.dispose
    end
    if @result_window != nil
      @result_window.dispose
    end
    # Dispose of spriteset
    @spriteset.dispose
    # If switching to title screen
    if $scene.is_a?(Scene_Title)
      # Fade out screen
      Graphics.transition
      Graphics.freeze
    end
    # If switching from battle test to any screen other than game over screen
    if $BTEST and not $scene.is_a?(Scene_Gameover)
      $scene = nil
    end
  end
  #--------------------------------------------------------------------------
  # * Determine Battle Win/Loss Results
  #--------------------------------------------------------------------------
  def judge
    # If all dead determinant is true, or number of members in party is 0
    if $game_party.all_dead? or $game_party.actors.size == 0
      # If possible to lose
      if $game_temp.battle_can_lose
        # Return to BGM before battle starts
        $game_system.bgm_play($game_temp.map_bgm)
        # Battle end
        battle_end(2)
        # Return true
        return true
      end
      # Setting the game over flag
      $game_temp.gameover = true
      # Return true
      return true
    end
    # Return false if even 1 enemy exists
    for enemy in $game_troop.enemies
      if enemy.exist?
        return false
      end
    end
    # Start after battle phase (win)
    start_phase5
    # Return true
    return true
  end
  #--------------------------------------------------------------------------
  # * Frame renewal
  #--------------------------------------------------------------------------
  def update
    # If battle event is running
    if $game_system.battle_interpreter.running?
      if @command.size > 0
        @command_a = false
        @command = []
        command_delete
      end
      @status_window.at_refresh
      # Update interpreter
      $game_system.battle_interpreter.update
      # If a battler which is forcing actions doesn't exist
      if $game_temp.forcing_battler == nil
        # If battle event has finished running
        unless $game_system.battle_interpreter.running?
          # Refresh status window
          @status_window.refresh
          setup_battle_event
        end
      end
    end
    # Update system (timer) and screen
    $game_system.update
    $game_screen.update
    # If timer has reached 0
    if $game_system.timer_working and $game_system.timer == 0
      # Abort battle
      $game_temp.battle_abort = true
    end
    # Update windows
    @help_window.update
    @party_command_window.update
    @actor_command_window.update
    @status_window.update
    @message_window.update
    # Update sprite set
    @spriteset.update
    # If transition is processing
    if $game_temp.transition_processing
      # Clear transition processing flag
      $game_temp.transition_processing = false
      # Execute transition
      if $game_temp.transition_name == ""
        Graphics.transition(20)
      else
        Graphics.transition(40, "Graphics/Transitions/" +
          $game_temp.transition_name)
      end
    end
    # If message window is showing
    if $game_temp.message_window_showing
      return
    end
    # If game over
    if $game_temp.gameover
      # Switch to game over screen
      $scene = Scene_Gameover.new
      return
    end
    # If returning to title screen
    if $game_temp.to_title
      # Switch to title screen
      $scene = Scene_Title.new
      return
    end
    # If battle is aborted
    if $game_temp.battle_abort
      # Return to BGM used before battle started
      $game_system.bgm_play($game_temp.map_bgm)
      # Battle ends
      battle_end(1)
      return
    end
    # If help window is waiting
    if @help_wait > 0
      @help_wait -= 1
      if @help_wait == 0
        # Hide help window
        @help_window.visible = false
      end
    end
    # When the battler forced into action doesn't exist
    # while the battle event is in the midst of executing
    if $game_temp.forcing_battler == nil and
      $game_system.battle_interpreter.running?
      return
    end
    # Branch according to phase
    case @phase
    when 0  # AT gauge renewal phase
      if anime_wait_return
        update_phase0
      end
    when 1  # pre-battle phase
      update_phase1
      return
    when 2  # party command phase
      update_phase2
      return
    when 5  # after battle phase
      update_phase5
      return
    end
    if $scene != self
      return
    end
    if @phase == 0
      if @command.size != 0  # Actor command phase
        if @command_a == false
          start_phase3
        end
        update_phase3
      end
      # If waiting
      if @wait_count > 0
        # Decrease wait count
        @wait_count -= 1
        return
      end
      update_phase4
    end
  end

#==============================================================================
# ** Scene_Battle (part 2)
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

  #--------------------------------------------------------------------------
  # * Frame renewal (AT gauge renewal phase)
  #--------------------------------------------------------------------------
  def update_phase0
    if $game_temp.battle_turn == 0
      $game_temp.battle_turn = 1
    end
    # If B button was pressed
    if @command_a == false and @party == false
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        @party = true
      end
    end
    if @party == true and
        ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
        (@action_battlers.empty? or @action_battlers[0].phase == 1)))
      # Start party command phase
      start_phase2
      return
    end
    # AT gauge increase processing
    cnt = 0
    for battler in $game_party.actors + $game_troop.enemies
      active?(battler)
      if battler.rtp == 0
        if battler.at >= @max
          if battler.is_a?(Game_Actor)
            if battler.inputable?
              unless @action_battlers.include?(battler) or
                  @command.include?(battler) or @escape == true
                if battler.current_action.forcing
                  fullat_se
                  force_action(battler)
                  action_start(battler)
                else
                  fullat_se
                  @command.push(battler)
                end
              end
            else
              unless @action_battlers.include?(battler) or
                      battler == @command[0]
                battler.current_action.clear
                if @command.include?(battler)
                  @command.delete(battler)
                else
                  if battler.movable?
                    fullat_se
                  end
                end
                action_start(battler)
              end
            end
          else
            unless @action_battlers.include?(battler)
              if battler.current_action.forcing
                force_action(battler)
                action_start(battler)
              else
                if @enemy_speed != 0
                  if rand(@enemy_speed) == 0
                    number = cnt - $game_party.actors.size
                    enemy_action(number)
                  end
                else
                  number = cnt - $game_party.actors.size
                  enemy_action(number)
                end
              end
            end
          end
        else
          battler.at += battler.agi
          if battler.guarding?
            battler.at += battler.agi
          end
          if battler.movable?
            battler.atp = 100 * battler.at / @max
          end
        end
      else
        if battler.rt >= battler.rtp
          speller = synthe?(battler)
          if speller != nil
            battler = speller[0]
          end
          unless @action_battlers.include?(battler)
            if battler.is_a?(Game_Actor)
              fullat_se
            end
            battler.rt = battler.rtp
            action_start(battler)
          end
        else
          battler.rt += battler.agi
          speller = synthe?(battler)
          if speller != nil
            for spell in speller
              if spell != battler
                spell.rt += battler.agi
              end
            end
          end
        end
      end
      cnt += 1
    end
    # Refresh AT gauge
    @status_window.at_refresh
    # Escape processing
    if @escape == true and
        ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
        (@action_battlers.empty? or @action_battlers[0].phase == 1)))
      temp = false
      for battler in $game_party.actors
        if battler.inputable?
          temp = true
        end
      end
      if temp == true
        for battler in $game_party.actors
          if battler.at < @max and battler.inputable?
            temp = false
            break
          end
        end
        if temp == true
          @escape = false
          for battler in $game_party.actors
            battler.at %= @max
          end
          $game_temp.battle_main_phase = false
          update_phase2_escape
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Start Party Command Phase
  #--------------------------------------------------------------------------
  def start_phase2
    # Shift to phase 2
    @phase = 2
    @party = false
    # Enable party command window
    @party_command_window.active = true
    @party_command_window.visible = true
    # Set actor to non-selecting
    @actor_index = -1
    # Disable actor command window
    @actor_command_window.active = false
    @actor_command_window.visible = false
    if @command.size != 0
      # Actor blink effect OFF
      if @active_actor != nil
        @active_actor.blink = false
      end
    end
    # Camera set
    @camera == "party"
    @spriteset.screen_target(0, 0, 1)
    # Clear main phase flag
    $game_temp.battle_main_phase = false
  end
  #--------------------------------------------------------------------------
  # * Frame renewal (party command phase)
  #--------------------------------------------------------------------------
  def update_phase2
    # When C button is pushed
    if Input.trigger?(Input::C)
      # It diverges at cursor position of the party command window
      case @party_command_window.index
      when 0  # It fights
        # Nullifying the party command window
        @party_command_window.active = false
        @party_command_window.visible = false
        # Performing decision SE
        $game_system.se_play($data_system.decision_se)
        @escape = false
        @phase = 0
        if $game_temp.battle_turn == 0
          $game_temp.battle_turn = 1
        end
        if @command_a == true
          # Actor command phase start
          start_phase3
        else
          $game_temp.battle_main_phase = true
        end
      when 1  # It escapes
        # When it is not flight possible,
        if $game_temp.battle_can_escape == false
          # Performing buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Performing decision SE
        $game_system.se_play($data_system.decision_se)
        @phase = 0
        # Nullifying the party command window
        @party_command_window.active = false
        @party_command_window.visible = false
        $game_temp.battle_main_phase = true
        if $game_temp.battle_turn == 0
          update_phase2_escape
          $game_temp.battle_turn = 1
          for battler in $game_party.actors
            battler.at -= @max / 2
          end
          return
        end
        # Performing decision SE
        $game_system.se_play($data_system.decision_se)
        @escape = true
        for battler in $game_party.actors
          @command_a = false
          @command.delete(battler)
          @action_battlers.delete(battler)
          skill_reset(battler)
        end
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame renewal (party command phase: It escapes)
  #--------------------------------------------------------------------------
  def update_phase2_escape
    # The enemy it is fast, calculating mean value
    enemies_agi = 0
    enemies_number = 0
    for enemy in $game_troop.enemies
      if enemy.exist?
        enemies_agi += enemy.agi
        enemies_number += 1
      end
    end
    if enemies_number > 0
      enemies_agi /= enemies_number
    end
    # The actor it is fast, calculating mean value
    actors_agi = 0
    actors_number = 0
    for actor in $game_party.actors
      if actor.exist?
        actors_agi += actor.agi
        actors_number += 1
      end
    end
    if actors_number > 0
      actors_agi /= actors_number
    end
    # Flight success decision
    success = rand(100) < 50 * actors_agi / enemies_agi
    # In case of flight success
    if success
      # Performing flight SE
      $game_system.se_play($data_system.escape_se)
      # You reset to BGM before the battle starting
      $game_system.bgm_play($game_temp.map_bgm)
      # Battle end
      battle_end(1)
    # In case of failure of flight
    else
      @help_window.set_text("Cannot escape", 1)
      @help_wait = @help_time
      # Clearing the action of party everyone
      $game_party.clear_actions
      # Main phase start
      start_phase4
    end
  end
  #--------------------------------------------------------------------------
  # * After battle phase start
  #--------------------------------------------------------------------------
  def start_phase5
    # It moves to phase 5
    @phase = 5
    # Performing battle end ME
    $game_system.me_play($game_system.battle_end_me)
    # You reset to BGM before the battle starting
    $game_system.bgm_play($game_temp.map_bgm)
    # Initializing EXP, the gold and the treasure
    exp = 0
    gold = 0
    treasures = []
    if @active_actor != nil
      @active_actor.blink = false
    end
    # Setting the main phase flag
    $game_temp.battle_main_phase = true
    # Nullifying the party command window
    @party_command_window.active = false
    @party_command_window.visible = false
    # Nullifying the actor command window
    @actor_command_window.active = false
    @actor_command_window.visible = false
    if @skill_window != nil
      # Releasing the skill window
      @skill_window.dispose
      @skill_window = nil
    end
    if @item_window != nil
      # Releasing the item window
      @item_window.dispose
      @item_window = nil
    end
    # The help window is hidden
    @help_window.visible = false if @help_wait == 0
    # Loop
    for enemy in $game_troop.enemies
      # When the enemy hides and it is not state,
      unless enemy.hidden
        # Adding acquisition EXP and the gold
        exp += enemy.exp
        gold += enemy.gold
        # Treasure appearance decision
        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
    # It limits the number of treasures up to 6
    treasures = treasures[0..5]
    # EXP acquisition
    for i in 0...$game_party.actors.size
      actor = $game_party.actors
      if actor.cant_get_exp? == false
        last_level = actor.level
        actor.exp += exp
        if actor.level > last_level
          @status_window.level_up(i)
          actor.damage[[actor, -1]] = "Level up!"
          actor.up_level = actor.level - last_level
        end
      end
    end
    # Gold acquisition
    $game_party.gain_gold(gold)
    # Treasure acquisition
    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
    # Drawing up the battle result window
    @result_window = Window_BattleResult.new(exp, gold, treasures)
    # Setting wait count
    @phase5_wait_count = 100
  end
  #--------------------------------------------------------------------------
  # * Frame renewal (after battle phase)
  #--------------------------------------------------------------------------
  def update_phase5
    # When wait count is larger than 0,
    if @phase5_wait_count > 0
      # Wait count is decreased
      @phase5_wait_count -= 1
      # When wait count becomes 0,
      if @phase5_wait_count == 0
        # Indicating the result window
        @result_window.visible = true
        # Clearing the main phase flag
        $game_temp.battle_main_phase = false
        # Refreshing the status window
        @status_window.refresh
        for actor in $game_party.actors
          if actor.damage.include?([actor, 0])
            @phase5_wait_count = 20
            actor.damage_pop[[actor, 0]] = true
          end
          if actor.damage.include?([actor, -1])
            @phase5_wait_count = 20
            actor.damage_pop[[actor, -1]] = true
            for level in actor.level - actor.up_level + 1..actor.level
              for skill in $data_classes[actor.class_id].learnings
                if level == skill.level and not actor.skill_learn?(skill.id)
                  actor.damage[[actor, 0]] = "New Skill!"
                  break
                end
              end
            end
          end
        end
      end
      return
    end
    # When C button is pushed,
    if Input.trigger?(Input::C)
      # Battle end
      battle_end(0)
    end
  end

#==============================================================================
# ** Scene_Battle (Part 3)
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

  #--------------------------------------------------------------------------
  # * Actor command phase start
  #--------------------------------------------------------------------------
  def start_phase3
    if victory?
      return
    end
    # Clearing the main phase flag
    $game_temp.battle_main_phase = false
    @command_a = true
    @active_actor = @command[0]
    cnt = 0
    for actor in $game_party.actors
      if actor == @active_actor
        @actor_index = cnt
      end
      cnt += 1
    end
    @active_actor.blink = true
    unless @active_actor.inputable?
      @active_actor.current_action.clear
      phase3_next_actor
      return
    end
    phase3_setup_command_window
    # Setting of camera
    @camera = "command"
    plus = ($game_party.actors.size - 1) / 2.0 - @actor_index
    y = [(plus.abs - 1.5) * 10 , 0].min
    @spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002)
  end
  #--------------------------------------------------------------------------
  # * Command input end of actor
  #--------------------------------------------------------------------------
  def phase3_next_actor
    @command.shift
    @command_a = false
    # Setting the main phase flag
    $game_temp.battle_main_phase = true
    # Nullifying the actor command window
    @actor_command_window.active = false
    @actor_command_window.visible = false
    # Blinking effect OFF of actor
    if @active_actor != nil
      @active_actor.blink = false
    end
    action_start(@active_actor)
    # You reset on the basis of the camera
    if @camera == "command"
      @spriteset.screen_target(0, 0, 1)
    end
    return
  end
  #--------------------------------------------------------------------------
  # * Setup of actor command window
  #--------------------------------------------------------------------------
  def phase3_setup_command_window
    # Nullifying the party command window
    @party_command_window.active = false
    @party_command_window.visible = false
    # Enabling the actor command window
    @actor_command_window.active = true
    @actor_command_window.visible = true
    # Setting the position of the actor command window
    @actor_command_window.x = @actor_index * 160 +
                              (4 - $game_party.actors.size) * 80
    # Setting the index to 0
    @actor_command_window.index = 0
  end
  #--------------------------------------------------------------------------
  # * Enemy action compilation
  #--------------------------------------------------------------------------
  def enemy_action(number)
    enemy = $game_troop.enemies[number]
    unless enemy.current_action.forcing
      enemy.make_action
    end
    action_start(enemy)
  end
  #--------------------------------------------------------------------------
  # * Frame renewal (actor command phase)
  #--------------------------------------------------------------------------
  def update_phase3
    if victory? and @command_a
      command_delete
      @command.push(@active_actor)
      return
    end
    # When the enemy arrow is effective,
    if @enemy_arrow != nil
      update_phase3_enemy_select
    # When the actor arrow is effective,
    elsif @actor_arrow != nil
      update_phase3_actor_select
    # When the skill window is effective,
    elsif @skill_window != nil
      update_phase3_skill_select
    # When the item window is effective
    elsif @item_window != nil
      update_phase3_item_select
    # When the actor command window is effective,
    elsif @actor_command_window.active
      update_phase3_basic_command
    end
  end
  #--------------------------------------------------------------------------
  # * Frame renewal (actor command phase: Basic command)
  #--------------------------------------------------------------------------
  def update_phase3_basic_command
    unless @active_actor.inputable?
      @active_actor.current_action.clear
      phase3_next_actor
      return
    end
    # The B when button is pushed,
    if Input.trigger?(Input::B) and @party == false
      # Performing cancellation SE
      $game_system.se_play($data_system.cancel_se)
      @party = true
    end
    if @party == true and
        ((@action > 0 and @action_battlers.empty?) or (@action == 0 and
        (@action_battlers.empty? or @action_battlers[0].phase == 1)))
      # To party command phase
      start_phase2
      return
    end
    # When C button is pushed,
    if Input.trigger?(Input::C)
      @party = false
      # It diverges at cursor position of the actor command window
      case @actor_command_window.index
      when 0  # Attack
        # Performing decision SE
        $game_system.se_play($data_system.decision_se)
        # Starting the selection of the enemy
        start_enemy_select
      when 1  # Skill
        # Performing decision SE
        $game_system.se_play($data_system.decision_se)
        # Starting the selection of skill
        start_skill_select
      when 2  # Defense
        # Performing decision SE
        $game_system.se_play($data_system.decision_se)
        # Setting action
        @active_actor.current_action.kind = 0
        @active_actor.current_action.basic = 1
        # To command input of the following actor
        phase3_next_actor
      when 3  # Item
        # Performing decision SE
        $game_system.se_play($data_system.decision_se)
        # Starting the selection of the item
        start_item_select
      end
      return
    end
    # Change Character
    if @command.size > 1
      # When the R when button is pushed,
      if Input.trigger?(Input::R)
        $game_system.se_play($data_system.cursor_se)
        @party = false
        # Blinking effect OFF of actor
        if @active_actor != nil
          @active_actor.blink = false
        end
        @command.push(@command[0])
        @command.shift
        @command_a = false
        # Start-up of new command window
        start_phase3
      end
      # When the L when button is pushed,
      if Input.trigger?(Input::L)
        $game_system.se_play($data_system.cursor_se)
        @party = false
        # Blinking effect OFF of actor
        if @active_actor != nil
          @active_actor.blink = false
        end
        @command.unshift(@command[@command.size - 1])
        @command.delete_at(@command.size - 1)
        @command_a = false
        # Start-up of new command window
        start_phase3
      end
    # When the right button is pushed,
      if Input.trigger?(Input::RIGHT)
        $game_system.se_play($data_system.cursor_se)
        @party = false
        # Blinking effect OFF of actor
        if @active_actor != nil
          @active_actor.blink = false
        end
        actor = $game_party.actors[@actor_index]
        while actor == @command[0] or (not @command.include?(actor))
          @actor_index += 1
          @actor_index %= $game_party.actors.size
          actor = $game_party.actors[@actor_index]
          if actor == @command[0]
            break
          end
        end
        while actor != @command[0]
          @command.push(@command.shift)
        end
        @command_a = false
        # Start-up of new command window
        start_phase3
      end
    # When the left button is pushed,
      if Input.trigger?(Input::LEFT)
        $game_system.se_play($data_system.cursor_se)
        @party = false
        # Blinking effect OFF of actor
        if @active_actor != nil
          @active_actor.blink = false
        end
        actor = $game_party.actors[@actor_index]
        while actor == @command[0] or (not @command.include?(actor))
          @actor_index -= 1
          @actor_index %= $game_party.actors.size
          actor = $game_party.actors[@actor_index]
          if actor == @command[0]
            break
          end
        end
        while actor != @command[0]
          @command.push(@command.shift)
        end
        @command_a = false
        # Start-up of new command window
        start_phase3
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Frame renewal (actor command phase: Skill selection)
  #--------------------------------------------------------------------------
  def update_phase3_skill_select
    # During command selecting when it becomes incapacitation,
    unless @active_actor.inputable?
      @active_actor.current_action.clear
      command_delete
      # To command input of the following actor
      phase3_next_actor
      return
    end
    # The skill window is put in visible state
    @skill_window.visible = true
    # Renewing the skill window
    @skill_window.update
    # The B when button is pushed,
    if Input.trigger?(Input::B)
      # Performing cancellation SE
      $game_system.se_play($data_system.cancel_se)
      # End selection of skill
      end_skill_select
      return
    end
    # When C button is pushed,
    if Input.trigger?(Input::C)
      # Acquiring t
 

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