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
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 = "Applause" CRITICAL_HIT_VOLUME = 80 CRITICAL_HIT_PITCH = 100 #==================================================
alias playsound_oncritical make_attack_damage_value def make_attack_damage_value(*args) playsound_oncritical(*args) RPG::SE.new(CRITICAL_HIT_SE, CRITICAL_HIT_VOLUME, CRITICAL_HIT_PITCH).play if @critical 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 #-------------------------------------------------------------------------- def start super load_database # Load database create_game_objects # Create game objects check_continue # Determine if continue is enabled play_title_music # Play title screen music Graphics.wait(QueMusicWaitTime::TITLESCREEN_WAIT_TIME) # Que for music create_title_graphic # Create title graphic create_command_window # Create command window end end
class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # * Start processing #-------------------------------------------------------------------------- def start super Graphics.wait(QueMusicWaitTime::BATTLESCENE_WAIT_TIME) $game_temp.in_battle = true @spriteset = Spriteset_Battle.new @message_window = Window_BattleMessage.new @action_battlers = [] create_info_viewport end end
Remove Ship Auto-change BGM
CODE
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # Remove Ship 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] == true @driving = true @walk_anime = true @step_anime = true if @type == 2 # If airship @priority_type = 2 # Change priority to "Above Characters" end 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. # Its 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. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Scene_Battle
#========================================================= # EDITABLE REGION #=========================================================
ESCAPE_RATIO = 25 # out of 100 GUARANTEE_ESCAPE_ITEM_ID = 2 # Item ID of item that will guarantee you can escape
Group: Global Mod
Posts: 1,784
Type: None
RM Skill: Undisclosed
Rev Points: 15
Then like I said, awesome. It's the one thing I've always hated, being caught in the middle of a dungeon with no way to save, and having to head off to school or work or wherever, and having to crawl back out of the dungeon in a hurry, but getting hit by random encounters with no means of assured escape.
This may make randome encounters a bit more enjoyable for the casual gamer.