DP3's VX Code Snippets

0 Members and 1 Guest are viewing this topic.

*
*crack*
Rep:
Level 64
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
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 for Play SE on Critical Hit:
Code: [Select]
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#             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 for Delay Time Transitions:
Code: [Select]
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#             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 for Remove Ship Auto-change BGM:
Code: [Select]
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#             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 for Determine if "in battle":
Code: [Select]
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#             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 for Control Escape Ratio:
Code: [Select]
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#             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

Credit


  • DiamondandPlatinum3


Thanks


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.