04-20-2006, 01:00 PM
Before Battle Switch 1.0
by Sheol
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 With SDK
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.
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