Battle Event List & Pre-Battle Troop Setup
#1
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given.


Battle Event List & Pre-Battle Troop Setup - Last Updated: 12.25.05


Description:
Battle Event List ~ A window pops up displaying the actions made by both the enemies, and the troops.
Pre-Battle Troop Setup ~ Lets you set up troops before battle, so you could have one person battle, or all 4.

Instructions:
Place code Above Main and below Scene_Battle

The Code:
Code:
#==============================================================================
# Battle Event & Pre-Battle Select
#--------------------------------------------------------------------------
# SephirothSpawn
# Version 1
# 12.25.05
#==============================================================================

#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('Battle Event & Pre-Battle Select', 'SephirothSpawn', 2, '12.25.05')

#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------

if SDK.state('Battle Event & Pre-Battle Select') == true

  #==============================================================================
  # ** Window_Command
  #==============================================================================
  class Window_Command < Window_Selectable
    #--------------------------------------------------------------------------
    # * Public Instance Variables
    #--------------------------------------------------------------------------
    attr_accessor :commands
    #--------------------------------------------------------------------------
    # * Refresh Contents
    #--------------------------------------------------------------------------
    def refresh_contents
      self.contents.dispose
      @item_max = @commands.size
      self.contents = Bitmap.new(width - 32, [@item_max, 1].max * 32)
      refresh
    end
  end
  
  #==============================================================================
  # ** Window_BattleEvent
  #==============================================================================
  class Window_BattleEvent < Window_Base
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
      super(0, 190, 224, 130)
      self.z = 100
      self.opacity = 160
      self.visible = false
      self.contents = Bitmap.new(width - 32, height - 32)
      self.contents.font.size = 14
      @event_list = []
      refresh
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      self.contents.clear
      for i in 0...@event_list.size
        self.contents.draw_text(4, i * 14, contents.width, 14, @event_list[i])
      end
    end
    #--------------------------------------------------------------------------
    # * Add Event
    #--------------------------------------------------------------------------
    def add_event(event_text)
      @event_list.push(event_text)
      @event_list.delete_at(0) if @event_list.size > 7
      refresh
    end
  end
  
  #==============================================================================
  # ** Scene_Battle
  #==============================================================================
  class Scene_Battle
    #--------------------------------------------------------------------------
    # * Alias Listings
    #--------------------------------------------------------------------------
    alias seph_actorplacement_scenebattle_init initialize
    alias seph_actorplacement_scenebattle_main main
    alias seph_actorplacement_scenebattle_startphase1 start_phase1
    alias seph_actorplacement_scenebattle_update update
    alias seph_actorplacement_scenebattle_makebasicaction make_basic_action_result
    alias seph_actorplacement_scenebattle_makeskillaction make_skill_action_result
    alias seph_actorplacement_scenebattle_makeitemaction make_item_action_result
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
      # Old Initilize Method
      seph_actorplacement_scenebattle_init
      # Sets Actor Placement Flag Off
      @actor_placement = false
      # Hold Party to refill at end of battle
      @end_battle_party = $game_party.actors.dup
    end
    #--------------------------------------------------------------------------
    # * Main Processing
    #--------------------------------------------------------------------------
    def main
      # Actors Command Window Commands & Temp Actors Array
      actors, @temp_actors = [], []
      # For each Actor in Game_Party...
      for actor in $game_party.actors.dup
        # Add Actor Name to Commands Array
        actors.push(actor.name)
        # Add Actor to Temp Actors Array
        @temp_actors.push(actor)
        # Removes Actor from Game_Party
        $game_party.remove_actor(actor.id)
      end
      # Temporary Actor Placement Window
      @temp_actor_placement_window = Window_Command.new(200, actors)
        @temp_actor_placement_window.x, @temp_actor_placement_window.y = 32, 96
        @temp_actor_placement_window.height, @temp_actor_placement_window.opacity = 160, 200
        @temp_actor_placement_window.visible = @temp_actor_placement_window.active = false
      # In Battle Actors Window
      @actors_window = Window_Command.new(200, [''])
        @actors_window.x, @actors_window.y = 408, 96
        @actors_window.height, @actors_window.opacity = 160, 200
        @actors_window.visible = @actors_window.active = false
      # Creates Battle Event Window
      @battle_event_window = Window_BattleEvent.new
      # Old Main Method
      seph_actorplacement_scenebattle_main
      # Remove Temp Party Members
      for actor in $game_party.actors.dup
        $game_party.remove_actor(actor.id)
      end
      # Replace old Party Memebers
      for actor in @end_battle_party
        $game_party.add_actor(actor.id)
      end
      # Disposes Battle Event Window
      @battle_event_window.dispose
    end
    #--------------------------------------------------------------------------
    # * Start Pre-Battle Phase
    #--------------------------------------------------------------------------
    def start_phase1
      # Old Start Phase 1 Method
      seph_actorplacement_scenebattle_startphase1
      # Unless You have placed the Actors...
      unless @actor_placement
        # Set Help Window Text
        @help_window.set_text('Select Actors to Add to your party', 1)
        # Turn On Windows
        @temp_actor_placement_window.visible = @temp_actor_placement_window.active =
          @actors_window.visible = true
        # Begin Actor Placement
        @phase = 0
      end
    end
    #--------------------------------------------------------------------------
    # * Frame Update
    #--------------------------------------------------------------------------
    def update
      # Turns on or Off Battle Event Window
      @battle_event_window.visible = (@phase == 4 || @phase == 2) ? true : false
      # Old Update Method
      seph_actorplacement_scenebattle_update
      # Split Current Phase
      if @phase == 0  # Actor Placement Phase
        update_phase0
      end
    end
    #--------------------------------------------------------------------------
    # * Actor Placement Phase
    #--------------------------------------------------------------------------
    def update_phase0
      # Update Windows
      @temp_actor_placement_window.update
      @actors_window.update
      # If L or R is pressed
      if Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)
        # Switch Windows
        if @actors_window.active
          # Set Help Window Text
          @help_window.set_text('Select Actors to Add to your party', 1)
          @actors_window.active = false
          @temp_actor_placement_window.active = true
        else
          # Set Help Window Text
          @help_window.set_text('Select Actors to remove from your party', 1)
          @actors_window.active = true
          @temp_actor_placement_window.active = false
        end
      end
      # If B is Pressed
      if Input.trigger?(Input::B)
        # Unless theres no actors in your party
        unless $game_party.actors.size < 1
          @temp_actor_placement_window.dispose
          @actors_window.dispose
          @help_window.visible = false
          @actor_placement = true
          start_phase1
        end
      end
      # If C is Pressed
      if Input.trigger?(Input::C)
        # If actor placement window is on...
        if @temp_actor_placement_window.active
          actor = @temp_actors[@temp_actor_placement_window.index]
          unless actor == nil
            # Add Actor to Game Party
            $game_party.add_actor(actor.id)
            # Delete Actor from Temp Actors
            @temp_actors.delete(actor)
            # Refresh Actor Placement Window
            temp_actors = []
            for actor in @temp_actors.dup
              temp_actors.push(actor.name)
            end
            @temp_actor_placement_window.commands = temp_actors
            @temp_actor_placement_window.refresh_contents
            @temp_actor_placement_window.index = 0
            # Refresh Actors Window
            actors = []
            for actor in $game_party.actors.dup
              actors.push(actor.name)
            end
            @actors_window.commands = actors
            @actors_window.refresh_contents
            # Make New sprite set
            @spriteset.dispose
            @spriteset = Spriteset_Battle.new
            # Updates Battle Status window
            @status_window.dispose
            @status_window = Window_BattleStatus.new
            return
          end
        # If actors window is on...
        else
          actor = $game_party.actors[@actors_window.index]
          unless actor == nil
            # Remover Actor from Game Party
            $game_party.remove_actor(actor.id)
            # Delete Actor from Temp Actors
            @temp_actors.push(actor)
            # Refresh Actor Placement Window
            temp_actors = []
            for actor in @temp_actors.dup
              temp_actors.push(actor.name)
            end
            @temp_actor_placement_window.commands = temp_actors
            @temp_actor_placement_window.refresh_contents
            # Refresh Actors Window
            actors = []
            for actor in $game_party.actors.dup
              actors.push(actor.name)
            end
            @actors_window.commands = actors
            @actors_window.refresh_contents
            @actors_window.index = 0
            # Make New sprite set
            @spriteset.dispose
            @spriteset = Spriteset_Battle.new
            # Updates Battle Status window
            @status_window.dispose
            @status_window = Window_BattleStatus.new
            return
          end
        end
      end
    end
    #--------------------------------------------------------------------------
    # * Make Basic Action Results
    #--------------------------------------------------------------------------
    def make_basic_action_result
      # If attack
      if @active_battler.current_action.basic == 0
        # If action battler is enemy
        if @active_battler.is_a?(Game_Enemy)
          if @active_battler.restriction == 3
            target = $game_troop.random_target_enemy
          elsif @active_battler.restriction == 2
            target = $game_party.random_target_actor
          else
            index = @active_battler.current_action.target_index
            target = $game_party.smooth_target_actor(index)
          end
        end
        # If action battler is actor
        if @active_battler.is_a?(Game_Actor)
          if @active_battler.restriction == 3
            target = $game_party.random_target_actor
          elsif @active_battler.restriction == 2
            target = $game_troop.random_target_enemy
          else
            index = @active_battler.current_action.target_index
            target = $game_troop.smooth_target_enemy(index)
          end
        end
        text = "#{@active_battler.name} Attacks #{target.name}"
      end
      # If guard
      if @active_battler.current_action.basic == 1
        text = "#{@active_battler.name} Defends"
      end
      # If escape
      if @active_battler.is_a?(Game_Enemy) && @active_battler.current_action.basic == 2
        text = @active_battler.name + 'Escapes'
      end
      # If doing nothing
      if @active_battler.current_action.basic == 3
        text = @active_battler.name + ' Does Nothing'
      end
      # Sets Text In Window
      @battle_event_window.add_event(text)
      # Old Make Basic Action
      seph_actorplacement_scenebattle_makebasicaction
    end
    #--------------------------------------------------------------------------
    # * Make Skill Action Results
    #--------------------------------------------------------------------------
    def make_skill_action_result
      # Get skill
      @skill = $data_skills[@active_battler.current_action.skill_id]
      # Set Text
      @battle_event_window.add_event(@active_battler.name + ' Uses ' + @skill.name)
      # Old Make Skill Action
      seph_actorplacement_scenebattle_makeskillaction
    end
    #--------------------------------------------------------------------------
    # * Make Item Action Results
    #--------------------------------------------------------------------------
    def make_item_action_result
      # Get item
      @item = $data_items[@active_battler.current_action.item_id]
      # Get skill
      @skill = $data_skills[@active_battler.current_action.skill_id]
      # Set Text
      @battle_event_window.add_event(@active_battler.name + ' Uses ' + @item.name)
      # Old Make Skill Action
      seph_actorplacement_scenebattle_makeitemaction
    end
  end

#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end

Works with any scripts. SDK not required.
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  Event dependent Movement Caldaron 0 2,597 10-09-2006, 01:00 PM
Last Post: Caldaron
  Battle Trophies GoldenShadow 0 2,924 09-07-2006, 01:00 PM
Last Post: GoldenShadow
  Obtain Experience as You Battle Tsunokiette 0 2,476 06-28-2006, 01:00 PM
Last Post: Tsunokiette
  Change Cursor with differend commands in Battle Divinity 0 2,608 06-22-2006, 01:00 PM
Last Post: Divinity
  Battle Memory mudgolem 0 2,397 06-21-2006, 01:00 PM
Last Post: mudgolem
  Event Name and ID Search Script Hadriel 0 2,417 06-21-2006, 01:00 PM
Last Post: Hadriel
  Before Battle Switch Sheol 0 2,672 04-20-2006, 01:00 PM
Last Post: Sheol
  Common Event on Terrain Tag mudgolem 0 2,557 03-26-2006, 01:00 PM
Last Post: mudgolem
  After Battle Changes 1.1 Sheol 0 2,503 02-07-2006, 01:00 PM
Last Post: Sheol
  New Battle System V1.5 (Added Side View) Guedez 0 2,817 01-12-2006, 01:00 PM
Last Post: Guedez



Users browsing this thread: 1 Guest(s)