Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> DP3's VX Code Snippets, A Collection of things, no pronz sorry :(
diamondandplatin...
post Oct 4 2012, 01:39 PM
Post #1


Level 5
Group Icon

Group: Member
Posts: 72
Type: Writer
RM Skill: Skilled
Rev Points: 45




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


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.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



#///////////////////////////////////////
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




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
  
  #=========================================================
  
  
  
  
  
  
  
  
  #--------------------------------------------------------------------------
  # * 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.

This post has been edited by diamondandplatinum3: Oct 4 2012, 01:39 PM


__________________________
Go to the top of the page
 
+Quote Post
   
amerk
post Oct 8 2012, 01:08 PM
Post #2


Level 56
Group Icon

Group: Global Mod
Posts: 1,784
Type: None
RM Skill: Undisclosed
Rev Points: 15




Nice, thanks for sharing this. So to confirm the Escape ratio, I could potentially have it set to 100 # out of 100 if I want a person to escape each time. If so, thanks for that, I've been wanting something like that since it makes no sense to me to force a battle if the player doesn't want to fight, assuming escaping is an option.


__________________________
Go to the top of the page
 
+Quote Post
   
diamondandplatin...
post Oct 8 2012, 10:49 PM
Post #3


Level 5
Group Icon

Group: Member
Posts: 72
Type: Writer
RM Skill: Skilled
Rev Points: 45




Yep smile.gif if you set it to 100, the player can escape every battle without fail; provided the player CAN actually escape from battle in the first place though.


__________________________
Go to the top of the page
 
+Quote Post
   
amerk
post Oct 9 2012, 09:02 AM
Post #4


Level 56
Group Icon

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.


__________________________
Go to the top of the page
 
+Quote Post
   
hainkiwanki
post Oct 16 2012, 11:10 PM
Post #5


Level 5
Group Icon

Group: Member
Posts: 69
Type: Event Designer
RM Skill: Beginner




I see that you've put all your scripts in one topic and I like them all smile.gif Great job


__________________________
Signature


Go to the top of the page
 
+Quote Post
   
diamondandplatin...
post Oct 17 2012, 04:11 AM
Post #6


Level 5
Group Icon

Group: Member
Posts: 72
Type: Writer
RM Skill: Skilled
Rev Points: 45




Not quite all of them, just the smaller ones smile.gif But thank you.


__________________________
Go to the top of the page
 
+Quote Post
   
amerk
post Oct 17 2012, 09:02 AM
Post #7


Level 56
Group Icon

Group: Global Mod
Posts: 1,784
Type: None
RM Skill: Undisclosed
Rev Points: 15




Small snippets are always fun. Back in the glory days of VX, there were a lot of these. I tend to enjoy the small snippets more so than the large codes since they generally add small flavor to a game without overcomplicating things.


__________________________
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 21st May 2013 - 08:23 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker