Change Battle Transition
Version: 1.0
Author: modern algebra
Date: October 29, 2009
Version History
- <Version 1.0> 10.29.2009 - Original Release
Description
This script allows you to change the transition graphic in-game, so you can have multiple different transitions and can even randomize between them.
Features
- Can easily change battle transitions in-game with a simple call script
- Can set the battle transitions in an array for easy access through IDs
- Can randomize between all battle transitions in the array
Instructions
Place this script into the editor above Main and above any other scripts that modify the perform_battle_transition method of Scene_Map. All transition graphics you want to use MUST be in the System folder of Graphics.
For instructions on how to change the battle transitions in-game, see the header and editable regions.
Script
#==============================================================================
# Change Battle Transition
# Version: 1.0
# Author: modern algebra
# Date: October 29, 2009
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Description:
#
# This script allows you to change the transition graphic in-game, so you
# can have multiple different transitions and can even randomize between them
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Instructions:
#
# Place this script into the editor above Main and above any other scripts
# that modify the perform_battle_transition method of Scene_Map. All
# transition graphics you want to use MUST be in the System folder of
# Graphics.
#
# To change the battle transition, use this code in a call script event
# command:
#
# change_battle_transition (new_transition)
# new_transition : either the name of the file in quotations, or the ID
# of the graphic as it appears in the TRANSITIONS_ARRAY constant,
# which can be configured below at line 46. If you set it to a
# negative number, then it will select a graphic randomly from the
# TRANSITIONS_ARRAY.
#
# By default, the battle_transition is set to -1, meaning that it will
# randomize between the elements of TRANSITIONS_ARRAY
#==============================================================================
#==============================================================================
# ** Game System
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new constant - TRANSITIONS_ARRAY
# new accessor variable - battle_transition
# aliased method - initialize
#==============================================================================
class Game_System
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Constant
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# EDITABLE REGION
#
# TRANSITIONS_ARRAY holds the names of transitions graphics so they can
# be accessed by ID. The primary purpose of it is for when you want to
# randomize the transition to be chosen, but it can also be useful for
# identifying battle transitions simply by ID rather than remembering the
# exact name when wanting to change it.
#
# To set it up, simply list them in the array like so:
# TRANSITIONS_ARRAY = ["trans 1", "trans 2", ..., "trans n"]
# They do not have to have a naming scheme. To be included in this
# array is sufficient.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TRANSITIONS_ARRAY = ["BattleStart"]
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# END EDITABLE REGION
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_writer :battle_transition # The ID of the battle transition
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mara_chngbtltrans_init_9ij3 initialize
def initialize (*args)
@battle_transition = -1
# Run Original Method
mara_chngbtltrans_init_9ij3 (*args)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Battle Transition
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def battle_transition
return @battle_transition if @battle_transition.is_a? (String)
return TRANSITIONS_ARRAY[@battle_transition] if @battle_transition.between? (0, TRANSITIONS_ARRAY.size - 1)
return TRANSITIONS_ARRAY[rand(TRANSITIONS_ARRAY.size)]
end
end
#==============================================================================
# ** Game Interpreter
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new method - change_battle_transition
#==============================================================================
class Game_Interpreter
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Change Battle Transition
# new_transition : the name or ID of a transition
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def change_battle_transition (new_transition = -1)
$game_system.battle_transition = new_transition
end
end
#==============================================================================
# ** Scene Map
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# overwritten method - perform_battle_transition
#==============================================================================
class Scene_Map
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Execute Pre-battle Transition
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def perform_battle_transition
Graphics.transition(80, "Graphics/System/#{$game_system.battle_transition}", 80)
Graphics.freeze
end
end
Credit
Support
Please post in this topic at rmrk.net if you encounter any problems or have suggestions for improvement. Do not PM me.
Known Compatibility Issues
It overwrites the perform_battle_transition method of Scene_Map, which could potentially cause problems with other scripts. If you run into a problem, try placing this script above the problematic scripts and that will fix it as long as the other scripts alias and do not overwrite that method. Otherwise, contact me with the other script and I will get them to work together.
Demo
A demo would be an insult to your intelligence, or else an insult to my explanation skills.
This script by
modern algebra is licensed under a
Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.