Before Battle Switch
#1
Before Battle Switch 1.0
by Sheol

This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


Last Update
April 20, 2006

How use?
Just paste the code below Scene_Battle (or SDK) and before Main, then change the id of the switch in the first lines of the script
Before the battle start, it turn on the switch "Battle_Switch" and allow the call of events.
To call an event or common event before the battle set them to start if the switch "Battle_Switch" is on.
And don't forget set the switch off when your events finish.

Code Without SDK
Code:
#==============================================================================
# ** Before Battle Switch
#------------------------------------------------------------------------------
# Slipknot
# 1.0
# 04.20.06
#==============================================================================

Battle_Switch = 5

class Scene_Map
  #--------------------------------------------------------------------------
  alias slipknot_battleswitch_main main
  #--------------------------------------------------------------------------
  def main
    @battle_called = false
    slipknot_battleswitch_main
  end
  #--------------------------------------------------------------------------
  def update
    loop do
      $game_map.update
      $game_system.map_interpreter.update
      $game_player.update
      $game_system.update
      $game_screen.update
      unless $game_temp.player_transferring
        break
      end
      transfer_player
      if $game_temp.transition_processing
        break
      end
    end
    @spriteset.update
    @message_window.update
    if $game_temp.gameover
      $scene = Scene_Gameover.new
      return
    end
    if $game_temp.to_title
      $scene = Scene_Title.new
      return
    end
    if $game_temp.transition_processing
      $game_temp.transition_processing = false
      if $game_temp.transition_name == ""
        Graphics.transition(20)
      else
        Graphics.transition(40, "Graphics/Transitions/" +
          $game_temp.transition_name)
      end
    end
    if $game_temp.message_window_showing
      return
    end
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # Added
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    if @battle_called
      $game_temp.map_bgm = $game_system.playing_bgm
      @battle_called = false
      $game_system.bgm_stop
      $game_system.se_play($data_system.battle_start_se)
      $game_system.bgm_play($game_system.battle_bgm)
      $game_player.straighten
      $scene = Scene_Battle.new
      return
    end
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    if $game_player.encounter_count == 0 and $game_map.encounter_list != []
      unless $game_system.map_interpreter.running? or
             $game_system.encounter_disabled
        n = rand($game_map.encounter_list.size)
        troop_id = $game_map.encounter_list[n]
        if $data_troops[troop_id] != nil
          $game_temp.battle_calling = true
          $game_temp.battle_troop_id = troop_id
          $game_temp.battle_can_escape = true
          $game_temp.battle_can_lose = false
          $game_temp.battle_proc = nil
        end
      end
    end
    if Input.trigger?(Input::B)
      unless $game_system.map_interpreter.running? or
             $game_system.menu_disabled
        $game_temp.menu_calling = true
        $game_temp.menu_beep = true
      end
    end
    if $DEBUG and Input.press?(Input::F9)
      $game_temp.debug_calling = true
    end
    unless $game_player.moving?
      if $game_temp.battle_calling
        call_battle
      elsif $game_temp.shop_calling
        call_shop
      elsif $game_temp.name_calling
        call_name
      elsif $game_temp.menu_calling
        call_menu
      elsif $game_temp.save_calling
        call_save
      elsif $game_temp.debug_calling
        call_debug
      end
    end
  end
  #--------------------------------------------------------------------------
  def call_battle
    $game_temp.battle_calling = false
    $game_temp.menu_calling = false
    $game_temp.menu_beep = false
    $game_player.make_encounter_count
    @battle_called = true
    $game_switches[Battle_Switch] = true
    $game_map.need_refresh = true
  end
end

class Scene_Battle
  #--------------------------------------------------------------------------
  alias slipknot_battleswitch_main main
  #--------------------------------------------------------------------------
  def main
    slipknot_battleswitch_main
    $game_switches[Battle_Switch] = false
  end
end


Code With SDK
Code:
#==============================================================================
# ** Before Battle Switch (SDK)
#------------------------------------------------------------------------------
# Slipknot
# 1.0
# 04.20.06
#==============================================================================

Battle_Switch = 5

class Scene_Map
  #--------------------------------------------------------------------------
  alias slipknot_battleswitch_main main
  alias slipknot_battleswitch_updategameover update_game_over?
  #--------------------------------------------------------------------------
  def main
    @battle_called = false
    slipknot_battleswitch_main
  end
  #--------------------------------------------------------------------------
  def update_game_over?
    if @battle_called and not $game_temp.message_window_showing
      $game_temp.map_bgm = $game_system.playing_bgm
      @battle_called = false
      $game_system.bgm_stop
      $game_system.se_play($data_system.battle_start_se)
      $game_system.bgm_play($game_system.battle_bgm)
      $game_player.straighten
      $scene = Scene_Battle.new
      return true
    end
    slipknot_battleswitch_updategameover
  end
  #--------------------------------------------------------------------------
  def call_battle
    $game_temp.battle_calling = false
    $game_temp.menu_calling = false
    $game_temp.menu_beep = false
    $game_player.make_encounter_count
    @battle_called = true
    $game_switches[Battle_Switch] = true
    $game_map.need_refresh = true
  end
end

class Scene_Battle
  #--------------------------------------------------------------------------
  alias slipknot_battleswitch_main main
  #--------------------------------------------------------------------------
  def main
    slipknot_battleswitch_main
    $game_switches[Battle_Switch] = false
  end
end
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  Battle Trophies GoldenShadow 0 2,924 09-07-2006, 01:00 PM
Last Post: GoldenShadow
  Death Switch Vash 0 2,393 08-27-2006, 01:00 PM
Last Post: Vash
  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,606 06-22-2006, 01:00 PM
Last Post: Divinity
  Battle Memory mudgolem 0 2,393 06-21-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
  Little Battle Edit Darkness Seraph 0 2,137 12-26-2005, 01:00 PM
Last Post: Darkness Seraph
  Battle Event List & Pre-Battle Troop Setup SephirothSpawn 0 2,859 12-25-2005, 01:00 PM
Last Post: SephirothSpawn
  Random Battle Music Boss & Final Boss setup Eccid 0 2,357 11-03-2005, 01:00 PM
Last Post: Eccid



Users browsing this thread: 1 Guest(s)