These are code snippets I have made over the course of a few months. Figure they may be of use to other people; posting them before I lose track of them in post counts. I know there are a couple I already have. ;9
Instructions
All Snippets are to be placed in a script slot between Materials and Main
Scripts
Map does not scroll with Player
CODE
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # Map does not scroll with Player # !- You are not required to give credit to anyone for this script -! #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Description: # # This script stops the map from scrolling with the player. Its only use # is to mimic old Zelda style games where the map would scroll when you # would change rooms, otherwise staying still. # # To scroll a map you will have to use the Scroll Map event. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Game_Player #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update last_real_x = @real_x last_real_y = @real_y last_moving = moving? move_by_input super update_vehicle update_nonmoving(last_moving) unless moving? @followers.update end end
Battle Menu At Top of Screen
CODE
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # Battle Menu At Top of Screen # Author: DiamondandPlatinum3 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Description: # # This script puts the battle menu at the top of the screen rather than # at the bottom where it normally is. It also moves the skill and items # box below the battle menu, looks nicer in my opinion. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#============================================================================== # ** Scene_Battle #------------------------------------------------------------------------------ # This class performs battle screen processing. #==============================================================================
class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # * Create Information Display Viewport #-------------------------------------------------------------------------- alias putwindowabove_civ_fjshr3 create_info_viewport def create_info_viewport # Call Original Method putwindowabove_civ_fjshr3
@info_viewport.rect.y = 0 @status_window.viewport = @info_viewport end end
#============================================================================== # ** Window_BattleSkill #------------------------------------------------------------------------------ # This window is for selecting skills to use in the battle window. #==============================================================================
class Window_BattleSkill < Window_SkillList #-------------------------------------------------------------------------- # * Object Initialization # info_viewport : Viewport for displaying information #-------------------------------------------------------------------------- def initialize(help_window, info_viewport) y = (info_viewport.rect.height + help_window.height) super(0, y, Graphics.width, (((info_viewport.rect.height + y) - (help_window.height + 16)))) self.visible = false @help_window = help_window @info_viewport = info_viewport end end
#============================================================================== # ** Window_BattleItem #------------------------------------------------------------------------------ # This window is for selecting items to use in the battle window. #==============================================================================
class Window_BattleItem < Window_ItemList #-------------------------------------------------------------------------- # * Object Initialization # info_viewport : Viewport for displaying information #-------------------------------------------------------------------------- def initialize(help_window, info_viewport) y = (info_viewport.rect.height + help_window.height) super(0, y, Graphics.width, (((info_viewport.rect.height + y) - (help_window.height + 16)))) self.visible = false @help_window = help_window @info_viewport = info_viewport end end
#============================================================================== # ** Window_Help #------------------------------------------------------------------------------ # This window shows skill and item explanations along with actor status. #==============================================================================
class Window_Help < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(line_number = 2) if SceneManager.scene_is?(Scene_Battle) super(0, 120, Graphics.width, fitting_height(line_number)) else super(0, 0, Graphics.width, fitting_height(line_number)) end end end
Play BGM on Loading Menu
CODE
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # Play BGM on loading menu # Author: DiamondandPlatinum3 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Description: # # This script allows you to play BGM on the Loading menu. # When you select 'Continue' from the title screen and are taken to the # file selection screen, new BGM will play instead of the same title screen # music. Similar to Pokemon Gold, Silver, Crystal. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class Scene_Load < Scene_File #====================================== # Editable Region #====================================== BGM_MUSIC_FOR_LOAD_SCREEN = "Scene6" BGM_VOLUME = 100 BGM_PITCH = 100 #======================================
alias play_music_onloadscreen first_savefile_index def first_savefile_index RPG::BGM.new(BGM_MUSIC_FOR_LOAD_SCREEN, BGM_VOLUME, BGM_PITCH).play play_music_onloadscreen end end
Play SE on Critical Hit
CODE
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # Play SE on Critical Hit # Author: DiamondandPlatinum3 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Description: # # This script will allow you to play a Sound Effect when any active battler # Scores a critical hit. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Game_Battler #================================================== # EDITABLE REGION #================================================== CRITICAL_HIT_SE = "Applause1" CRITICAL_HIT_VOLUME = 80 CRITICAL_HIT_PITCH = 100 #==================================================
#-------------------------------------------------------------------------- # * Apply Critical #-------------------------------------------------------------------------- alias playsound_oncritical apply_critical #-------------------------------------------------------------------------- def apply_critical(*args) RPG::SE.new(CRITICAL_HIT_SE, CRITICAL_HIT_VOLUME, CRITICAL_HIT_PITCH).play return playsound_oncritical(*args) end end
Delay Time Transitions
CODE
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # Delay Time Transitions # Author: DiamondandPlatinum3 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Description: # # This script will allow you to delay when the title screen and battle # scene will enter their phase. Its only usefulness is for sound purposes. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
module QueMusicWaitTime #=============================== # Editable Region #===============================
TITLESCREEN_WAIT_TIME = 400 # you'll need to play around with this.
BATTLESCENE_WAIT_TIME = 400 # you'll need to play around with this.
#===============================
end
class Scene_Title < Scene_Base #-------------------------------------------------------------------------- # * Start processing #-------------------------------------------------------------------------- alias quemusicwaittime_scntitl_start_47cn37 start def start # Start Playing Music play_title_music
# Wait for Music Graphics.wait(QueMusicWaitTime::TITLESCREEN_WAIT_TIME)
# Run Original Method quemusicwaittime_scntitl_start_47cn37 end end
class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # * Start Processing #-------------------------------------------------------------------------- alias quemusicwaittime_scnbttl_start_47cn37 start def start # Wait For Music Graphics.wait(QueMusicWaitTime::BATTLESCENE_WAIT_TIME)
# Run Original Method quemusicwaittime_scnbttl_start_47cn37 end end
Remove Vehicle Auto-Change BGM
CODE
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # Remove Vehicle Auto-change BGM # Author: DiamondandPlatinum3 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Description: # # This script will allow you to stop vehicles from changing the bgm that is # currently playing via the use of an event switch. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Game_Vehicle < Game_Character alias dp3_nobgm_during_travel get_on def get_on if $game_switches[DP3_Vehicle_Sound_Options::Event_Switch_ID] @driving = true @walk_anime = true @step_anime = true @walking_bgm = RPG::BGM.last else dp3_nobgm_during_travel end end end
Determine if "in-battle
CODE
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # Determine if "in battle" # Author: DiamondandPlatinum3 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Description: # # This script will allow you to set an event switch that will turn on if # you are in battle, and turn off if you are not. # It's useful for changing what an item does if battling compared to if # not battling. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Scene_Battle < Scene_Base #------------------------ # Editable Part #------------------------
# Event Switch to turn on if in battle ITEM_EVENT_SWITCH_ID = 10
#------------------------
#-------------------------------------------------------------------------- # * Start processing #-------------------------------------------------------------------------- alias evntswitchbtlstart_1g5s start def start evntswitchbtlstart_1g5s $game_switches[ITEM_EVENT_SWITCH_ID] = true end #-------------------------------------------------------------------------- # * Termination Processing #-------------------------------------------------------------------------- alias evntswitchbtlterminate_1g5s terminate def terminate evntswitchbtlterminate_1g5s $game_switches[ITEM_EVENT_SWITCH_ID] = false end end
Control Escape Ratio
CODE
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # Control Escape Ratio # Author: DiamondandPlatinum3 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Description: # # This script will allow you to set a constant rate at which you can escape # from battle, as well as setting an item that will guarantee you can # escape. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ module DP3ESCAPERATIO #========================================================= # EDITABLE REGION #=========================================================
ESCAPE_RATIO = 25 # out of 100 GUARANTEE_ESCAPE_ITEM_ID = 2 # Item ID of item that will guarantee you can escape
#========================================================= end
module BattleManager #-------------------------------------------------------------------------- # * Create Escape Ratio #-------------------------------------------------------------------------- def self.make_escape_ratio @escape_ratio = DP3ESCAPERATIO::ESCAPE_RATIO end #-------------------------------------------------------------------------- # * Modify Escape Ratio ~ New Method #-------------------------------------------------------------------------- def self.mod_escape_ratio( value ) @escape_ratio = value end #-------------------------------------------------------------------------- # * Escape Processing #-------------------------------------------------------------------------- def self.process_escape $game_message.add(sprintf(Vocab::EscapeStart, $game_party.name))
Sound.play_escape if success process_abort else @escape_ratio += 0.1 $game_message.add('\.' + Vocab::EscapeFailure) $game_party.clear_actions end wait_for_message return success end end
class Scene_Battle #-------------------------------------------------------------------------- # * Apply Skill/Item Effect #-------------------------------------------------------------------------- alias dp3_mod_escrat_sb_app_itm_eff_845wc apply_item_effects def apply_item_effects(target, item) # Change Escape Ratio BattleManager.mod_escape_ratio(100) if item.is_a?(RPG::Item) && item.id == DP3ESCAPERATIO::GUARANTEE_ESCAPE_ITEM_ID
# Call Original Method dp3_mod_escrat_sb_app_itm_eff_845wc(target, item) end end