#==============================================================================
# ** Laura's Escape Bar Removal Code (DBS version)
# by DerVVulfman
# Version 1.5
# 04-11-07
#
#------------------------------------------------------------------------------
#
# INTRODUCTION AND BASIC USAGE:
#
# This script effectively 'replaces' key sections of Scene_Battle that involve
# the display and use of the Escape bar that appears at the top of the window
# when combat begins.
#
# As such, this script should be placed above any other custom script in your
# system that relates to or edits the battle system in your game, preferrably
# just below Scene_Debug.
#
# This, of course, assumes that no 'DIRECT' editing of Scene_Battle's code has
# been initiated.
#
#
#------------------------------------------------------------------------------
#
# REGARDING ELADIA'S BATTLE EQUIPMENT MENU:
# This system is compatible with said system. Both IT and this system uses
# a modified version of XRXS's Window Module, and the placement of the scripts
# influences the options position. If this script is placed 'BELOW' Eladia's
# script, then the 'Escape' option will be below the 'Equip' option... and
# visa versa.
#
#------------------------------------------------------------------------------
#
# EDITABLES:
#
# The script alters the command window to accept a fifth command option to re-
# place the Escape Bar at the start of each turn. Also, it repositions the
# command window accordingly for the additional option.
#
# ESCAPE_TEXT:
# The text that is shown in the fifth option can be altered by editing the
# ESCAPE_TEXT constant, right below these instructions. Most people would
# probably leave it as 'Escape', but have some fun with it.
#
#==============================================================================
# Command Window size controls
$command_height = 160 # Sets how many options are visible (nil auto-resizes)
$command_y_pos = 160 # Sets the height position (160 is default, nil is auto)
# EDITABLE CONSTANT:
ESCAPE_TEXT = "Run!!!" # Text that shows in the command window.
#==============================================================================
# ** Scene_Battle (part 1)
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Add Escape
#--------------------------------------------------------------------------
alias escape_sp1 start_phase1
def start_phase1
# Original Call
escape_sp1
# Get index of Equip Command
@escape_actor_command_index = @actor_command_window.height / 32 - 1
# Add the Equip Command
@actor_command_window.add_command(ESCAPE_TEXT)
if $game_temp.battle_can_escape == false
@actor_command_window.disable_item(@actor_command_window.height / 32 - 1)
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# If battle event is running
if $game_system.battle_interpreter.running?
# 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?
# Rerun battle event set up if battle continues
unless judge
setup_battle_event
end
end
# If not after battle phase
if @phase != 5
# Refresh status window
@status_window.refresh
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
@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 effect is showing
if @spriteset.effect?
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 waiting
if @wait_count > 0
# Decrease wait count
@wait_count -= 1
return
end
# If battler forcing an action doesn't exist,
# and battle event is running
if $game_temp.forcing_battler == nil and
$game_system.battle_interpreter.running?
return
end
# Branch according to phase
case @phase
when 1 # pre-battle phase
update_phase1
when 2 # party command phase
update_phase2
when 3 # actor command phase
update_phase3
when 4 # main phase
update_phase4
when 5 # after battle phase
update_phase5
end
end
#--------------------------------------------------------------------------
# * Start Party Command Phase
#--------------------------------------------------------------------------
def start_phase2
# Shift to phase 2
@phase = 2
# Set actor to non-selecting
@actor_index = -1
@active_battler = nil
# Disable actor command window
@actor_command_window.active = false
@actor_command_window.visible = false
# Clear main phase flag
$game_temp.battle_main_phase = false
# Clear all party member actions
$game_party.clear_actions
# If impossible to input command
unless $game_party.inputable?
# Start main phase
start_phase4
end
end
#--------------------------------------------------------------------------
# * Frame Update (party command phase)
#--------------------------------------------------------------------------
def update_phase2
start_phase3
end
#--------------------------------------------------------------------------
# * Actor Command Window Setup
#--------------------------------------------------------------------------
def phase3_setup_command_window
# Enable actor command window
@actor_command_window.active = true
@actor_command_window.visible = true
# Set actor command window position
@actor_command_window.x = @actor_index * 160
# Set index to 0
@actor_command_window.index = 0
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : basic command)
#--------------------------------------------------------------------------
alias escape_update_phase3_basic_command update_phase3_basic_command
def update_phase3_basic_command
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by actor command window cursor position
case @actor_command_window.index
when @escape_actor_command_index # Escape
# Play Decision SE
$game_system.se_play($data_system.decision_se)
if $game_temp.battle_can_escape == false
# Play Buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 2
phase3_next_actor
return
end
end
# Original Call
escape_update_phase3_basic_command
end
#--------------------------------------------------------------------------
# * Start Main Phase
#--------------------------------------------------------------------------
def start_phase4
# Shift to phase 4
@phase = 4
# Turn count
$game_temp.battle_turn += 1
# Search all battle event pages
for index in 0...$data_troops[@troop_id].pages.size
# Get event page
page = $data_troops[@troop_id].pages[index]
# If this page span is [turn]
if page.span == 1
# Clear action completed flags
$game_temp.battle_event_flags[index] = false
end
end
# Set actor as unselectable
@actor_index = -1
@active_battler = nil
# Disable actor command window
@actor_command_window.active = false
@actor_command_window.visible = false
# Set main phase flag
$game_temp.battle_main_phase = true
# Make enemy action
for enemy in $game_troop.enemies
enemy.make_action
end
# Make action orders
make_action_orders
# Shift to step 1
@phase4_step = 1
end
#--------------------------------------------------------------------------
# * Make Basic Action Results
#--------------------------------------------------------------------------
def make_basic_action_result
# If attack
if @active_battler.current_action.basic == 0
# Set anaimation ID
@animation1_id = @active_battler.animation1_id
@animation2_id = @active_battler.animation2_id
# 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
# Set array of targeted battlers
@target_battlers = [target]
# Apply normal attack results
for target in @target_battlers
target.attack_effect(@active_battler)
end
return
end
# If guard
if @active_battler.current_action.basic == 1
# Display "Guard" in help window
@help_window.set_text($data_system.words.guard, 1)
return
end
# If escape
if @active_battler.is_a?(Game_Enemy) and
@active_battler.current_action.basic == 2
# Display "Escape" in help window
@help_window.set_text("Run!", 1)
# Escape
@active_battler.escape
return
end
# If escape (Actor)
if @active_battler.is_a?(Game_Actor) and
@active_battler.current_action.basic == 2
# Escape
update_phase2_escape
return
end
# If doing nothing
if @active_battler.current_action.basic == 3
# Clear battler being forced into action
$game_temp.forcing_battler = nil
# Shift to step 1
@phase4_step = 1
return
end
end
end
#==============================================================================
# --- XRXS.Command Window Add-On Module ---
#==============================================================================
module XRXS_Window_Command
#--------------------------------------------------------------------------
# * Add Command
# command : command text string being added
#--------------------------------------------------------------------------
def add_command(command)
#
# Creates an empty @disabled array when first called.
#
@disabled = [] if @disabled.nil?
if @commands.size != @disabled.size
for i in
0...@commands.size
@disabled
= false
end
end
#
# Add Command
#
@commands.push(command)
@disabled.push(false)
@item_max = @commands.size
# Position the command window
if $command_y_pos == nil
self.y -= 32
else
self.y = $command_y_pos
end
# Set the command window height
if $command_height == nil
self.height += 32
else
self.height = $command_height
end
self.contents.dispose
self.contents = nil
self.contents = Bitmap.new(self.width - 32, @item_max * 32)
refresh
for i in 0...@commands.size
if @disabled
disable_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
@disabled = [] if @disabled.nil?
@disabled[index] = true
draw_item(index, disabled_color)
end
#--------------------------------------------------------------------------
# * Enable Item
# index : item number
#--------------------------------------------------------------------------
def enable_item(index)
@disabled = [] if @disabled.nil?
@disabled[index] = false
draw_item(index, normal_color)
end
end
class Window_Command < Window_Selectable
#--------------------------------------------------------------------------
# ** Include
#--------------------------------------------------------------------------
include XRXS_Window_Command
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
super
end
end
#==============================================================================
# --- Edited Copy of Include for SoulRage script ---
#==============================================================================
class Window_Command_Enhanced < Window_Selectable
#--------------------------------------------------------------------------
# ** Include
#--------------------------------------------------------------------------
include XRXS_Window_Command
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
super
end
end