DP3's VX Code Snippets
Version: ???
Author: DiamondandPlatinum3
Date: ???
Planned Future Versions
- It's pretty much guaranteed
Description
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
[spoiler=Play SE on Critical Hit]
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 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
[/spoiler]
[spoiler=Delay Time Transitions]
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 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
[/spoiler]
[spoiler= Remove Ship Auto-change BGM]
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 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.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#///////////////////////////////////////
module DP3_Vehicle_Sound_Options #//////
#///////////////////////////////////////
# The ID of the switch which turns off changing the BGM on all vehicles
Event_Switch_ID = 10
#//////////////////////////////////////
end # .. // // // .. .. ///
#//////////////////////////////////////
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
[/spoiler]
[spoiler=Determine if "in battle"]
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 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
[/spoiler]
[spoiler=Control Escape Ratio]
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 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
#=========================================================
#--------------------------------------------------------------------------
# * Create Escape Ratio
#--------------------------------------------------------------------------
def make_escape_ratio
@escape_ratio = ESCAPE_RATIO
end
#--------------------------------------------------------------------------
# * Execute Battle Action: Item
#--------------------------------------------------------------------------
alias dp3_mod_escrat_sb_exec_act_itm_845wc execute_action_item
def execute_action_item
# Call Original Method
dp3_mod_escrat_sb_exec_act_itm_845wc
@escape_ratio = 100 if @active_battler.action.item.id == GUARANTEE_ESCAPE_ITEM_ID
end
end
[/spoiler]
Credit
Thanks
- hawkeye7704 (http://www.rpgrevolution.com/forums/index.php?showuser=129115) ~ for requesting this script (http://www.rpgrevolution.com/forums/index.php?showtopic=57390&hl=)
- Twilight Fox (http://www.rpgmakervx.net/index.php?showuser=107715) ~ for requesting this script (http://www.rpgmakervx.net/index.php?showtopic=55787&hl=)
- Rifall (http://www.rpgmakervx.net/index.php?showuser=117077) ~ for requesting this script (http://www.rpgmakervx.net/index.php?showtopic=55756&hl=)
- Venima (http://www.rpgmakervx.net/index.php?showuser=67785) ~ for requesting this script (http://www.rpgmakervx.net/index.php?showtopic=56212&hl=)
- The Invisible Man (http://www.rpgmakervx.net/index.php?showuser=95273) ~ for requesting this script (http://www.rpgmakervx.net/index.php?showtopic=56443&hl=)
Author's Notes
I will be posting more here as I finish them.
Terms of Use
Free for use in commercial or non-commercial projects with credit towards me. You may not claim any of these snippets as your own.