Advertisement
Rafael_Sol_Maker

RAFAEL_SOL_MAKER's VX TRANSITION SET v1.1

Nov 17th, 2011
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 7.34 KB | None | 0 0
  1. #===============================================================================
  2. #                 RAFAEL_SOL_MAKER's VX TRANSITION SET v1.1
  3. #-------------------------------------------------------------------------------
  4. # Description:   With this script you can use a set of multiple
  5. #                customized transitions in the teleport, or at the beginning or
  6. #                end of battles. You can configure in and out transitions, and a
  7. #                total of six different transitions that can be used. To change
  8. #                the transition graphic in-game use the command:
  9. #                
  10. #                  set_transition (transition, filename)
  11. #
  12. #                Where 'transition' accepts the following values: MAP_IN,
  13. #                MAP_OUT, BATTLE_IN, BATTLE_OUT, BATTLE_END_IN, BATTLE_END_OUT;
  14. #                And 'filename' is the name of the bitmap used for transition,
  15. #                which should be in the folder 'Graphics/Transitions/'.
  16. #                If you prefer to use the fade effect instead, just use a blank
  17. #                filename, a empty quote: "" (can be single or double);
  18. #
  19. #                  set_transition_wait (duration)
  20. #
  21. #                To set the transition's delay time, in frames.
  22. #  
  23. #                OBS.: Also uses a teleport sound effect that can be configured
  24. #                by Sound module. The settings and default values can be found
  25. #                in the configurable module.            
  26. #-------------------------------------------------------------------------------
  27. # How to Use: -
  28. #-------------------------------------------------------------------------------
  29. # Special Thanks: Angel Ivy-chan
  30. #-------------------------------------------------------------------------------
  31. #===============================================================================
  32.  
  33. module PowerPackVX_General_Configs  
  34.   # TRANSITION BETWEEN THE SCENES
  35.   Transition_In =  'Blind02'    # Map Transition (in)
  36.   Transition_Out = 'Blind02'    # Map Transition (out)
  37.   Battle_In =      'Blind03'    # Battle Transition (in)
  38.   Battle_Out =     'Blind03'    # Battle Transition (out)
  39.   Battle_End_In =  'Blind04'    # Battle End Transition (in)
  40.   Battle_End_Out = 'Blind04'    # Battle End Transition (out)  
  41.   Transition_Wait = 60          # Transition Delay, in Frames  
  42. end
  43.  
  44. module Cache  
  45.   # Preparation of Transitions in Cache
  46.   def self.transition(filename)
  47.     load_bitmap('Graphics/Transitions/', filename)
  48.   end  
  49. end
  50.  
  51. module Sound  
  52.   # Teleport's Sound Effect
  53.   def self.play_teleport
  54.     Audio.se_play('Audio/SE/Run', 25, 50)
  55.   end
  56. end
  57.  
  58. class Game_Interpreter
  59. include PowerPackVX_General_Configs
  60.  
  61.   MAP_IN =    1       #Transition: Map In
  62.   MAP_OUT =    2      #Transition: Map Out
  63.   BATTLE_IN =   3     #Transition: Battle In
  64.   BATTLE_OUT =   4    #Transition: Battle Out
  65.   BATTLE_END_IN = 5   #Transition: End of Battle In
  66.   BATTLE_END_OUT = 6  #Transition: End of Battle Out
  67.  
  68.   #--------------------------------------------------------------------------
  69.   # Change Transitions Between Scenes
  70.   #--------------------------------------------------------------------------  
  71.   def set_transition (transition = MAP_IN, filename = '')
  72.     # Selects which transition will be changed
  73.     case transition
  74.       when MAP_IN
  75.         $game_system.map_in = filename
  76.         when MAP_OUT
  77.         $game_system.map_out = filename
  78.       when BATTLE_IN
  79.         $game_system.battle_in = filename
  80.       when BATTLE_OUT
  81.         $game_system.battle_out = filename
  82.       when BATTLE_END_IN
  83.         $game_system.battle_end_in = filename
  84.       when BATTLE_END_OUT
  85.         $game_system.battle_end_out = filename
  86.     end
  87.   end
  88.  
  89.   #--------------------------------------------------------------------------
  90.   # Change the Transition Delay
  91.   #--------------------------------------------------------------------------
  92.   def set_transition_wait (duration = 45)
  93.     $game_system.transition_wait = duration
  94.   end
  95.  
  96. end
  97.  
  98. class Game_System
  99. include PowerPackVX_General_Configs
  100.  
  101.   attr_accessor :map_in
  102.   attr_accessor :map_out    
  103.   attr_accessor :battle_in
  104.   attr_accessor :battle_out  
  105.   attr_accessor :battle_end_in
  106.   attr_accessor :battle_end_out  
  107.   attr_accessor :transition_wait
  108.  
  109.   alias solmaker_transition_initialize initialize unless $@
  110.   def initialize
  111.     solmaker_transition_initialize
  112.     load_transitions      
  113.   end
  114.  
  115.   def load_transitions
  116.     @map_in = Transition_In
  117.     @map_out = Transition_Out
  118.     @battle_in  = Battle_In
  119.     @battle_out = Battle_Out
  120.     @battle_end_in  = Battle_End_In
  121.     @battle_end_out = Battle_End_Out
  122.     @transition_wait = Transition_Wait
  123.   end
  124.  
  125. end
  126.  
  127. class Scene_Map
  128.  
  129.   def perform_transition
  130.     if Graphics.brightness == 0
  131.       if $game_temp.in_battle == true      
  132.         $game_temp.in_battle = false
  133.         Graphics.freeze
  134.         Graphics.brightness = 255
  135.         filename = ""
  136.         if $game_system.battle_end_in != ""
  137.           filename = 'Graphics/Transitions/' + $game_system.battle_end_in
  138.         end  
  139.         Graphics.transition($game_system.transition_wait, filename)  
  140.       else
  141.         fadein(30)  
  142.       end
  143.     else                              
  144.       Graphics.transition(15)
  145.     end
  146.   end
  147.  
  148.   def update_transfer_player    
  149.     return unless $game_player.transfer?  
  150.     Sound.play_teleport;
  151.     Graphics.freeze; @spriteset.dispose    
  152.     $game_player.perform_transfer; $game_map.autoplay; $game_map.update
  153.     filename = ""
  154.     if $game_system.map_out != ""
  155.       filename = 'Graphics/Transitions/' + $game_system.map_out
  156.     end
  157.     Graphics.transition($game_system.transition_wait, filename)
  158.     Input.update; Graphics.freeze; @spriteset = Spriteset_Map.new  
  159.     filename = ""
  160.     if $game_system.map_in != ""
  161.       filename = 'Graphics/Transitions/' + $game_system.map_in
  162.     end
  163.     Graphics.transition($game_system.transition_wait, filename)
  164.   end    
  165.    
  166.   def perform_battle_transition    
  167.     filename = ""
  168.     if $game_system.battle_out != ""
  169.       filename = 'Graphics/Transitions/'+ $game_system.battle_out
  170.     end
  171.     Graphics.transition($game_system.transition_wait, filename)
  172.     Graphics.freeze    
  173.   end  
  174.  
  175. end
  176.  
  177. class Scene_Battle < Scene_Base
  178.  
  179.   def perform_transition
  180.     filename = ""
  181.     if $game_system.battle_in != ""
  182.       filename = 'Graphics/Transitions/'+ $game_system.battle_in
  183.     end
  184.     Graphics.transition($game_system.transition_wait, filename)
  185.   end  
  186.  
  187.   def battle_end(result)
  188.     if result == 2 and not $game_troop.can_lose
  189.       call_gameover
  190.       $game_temp.in_battle = false
  191.     else
  192.       $game_party.clear_actions
  193.       $game_party.remove_states_battle
  194.       $game_troop.clear
  195.       if $game_temp.battle_proc != nil
  196.         $game_temp.battle_proc.call(result)
  197.         $game_temp.battle_proc = nil
  198.       end      
  199.       @message_window.clear
  200.       Graphics.freeze
  201.       @message_window.visible = false
  202.       @spriteset.dispose
  203.       filename = ""
  204.       if $game_system.battle_end_out != ""
  205.         filename = 'Graphics/Transitions/' + $game_system.battle_end_out
  206.       end    
  207.       Graphics.transition($game_system.transition_wait, filename)
  208.       unless $BTEST
  209.         $game_temp.map_bgm.play
  210.         $game_temp.map_bgs.play
  211.       end
  212.       $scene = Scene_Map.new
  213.       Graphics.brightness = 0    
  214.     end
  215.   end
  216.  
  217. end
  218.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement