Advertisement
Rafael_Sol_Maker

RAFAEL_SOL_MAKER's ACE TRANSITION SET v1.0

Dec 5th, 2011
4,037
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 7.82 KB | None | 0 0
  1. #===============================================================================
  2. #               RAFAEL_SOL_MAKER's ACE TRANSITION SET v1.0
  3. #-------------------------------------------------------------------------------
  4. #  Description  | With this script you can use a set of multiple customized
  5. #               | transitions in the teleport, or at the beginning or end of  
  6. #               | battles. You can configure in and out transitions, so a total
  7. #               | of six different transitions can be used within your game.
  8. #-------------------------------------------------------------------------------
  9. # Script Usage  | To change the transitions in-game use the following command:
  10. #               |
  11. #            -> |   set_transition (transition, filename)
  12. #               |
  13. #               | Where 'transition' accepts the following values: MAP_IN,
  14. #               | MAP_OUT, BATTLE_IN, BATTLE_OUT, BATTLE_END_IN, BATTLE_END_OUT;
  15. #               | And 'filename' is the name of the bitmap used for transition,
  16. #               | which should be in the folder 'Graphics/Transitions/'.
  17. #               | If you prefer to use the fade effect instead, just use a blank
  18. #               | filename, a empty quote: "" ;
  19. #               |
  20. #            -> |   set_transition_wait (duration)
  21. #               |
  22. #               | To set the transition's delay time, in frames.
  23. #               |  
  24. #            -> | OBS.: Also uses a teleport sound effect that can be configured
  25. #               | by Sound module. The settings and default values can be found
  26. #               | in the configurable module.
  27. #-------------------------------------------------------------------------------
  28. # Special Thanks: Angel Ivy-chan
  29. #-------------------------------------------------------------------------------
  30. #===============================================================================
  31.  
  32. #===============================================================================
  33. #                               VERSION HISTORY
  34. #-------------------------------------------------------------------------------
  35. # ACE TRANSITION SET v1.0 - 04/12/2011(dd/mm/yyyy)
  36. # * Initial release (and my very first script in RGSS3!)
  37. #-------------------------------------------------------------------------------
  38. #===============================================================================
  39.  
  40. module PPVXAce_General_Configs  
  41.   # TRANSITION BETWEEN THE SCENES
  42.   Transition_In =  'Blind01'    # Map Transition (in)
  43.   Transition_Out = 'Blind02'    # Map Transition (out)
  44.   Battle_In =      'Blind03'    # Battle Transition (in)
  45.   Battle_Out =     'Blind04'    # Battle Transition (out)
  46.   Battle_End_In =  'Brick01'    # Battle End Transition (in)
  47.   Battle_End_Out = 'Brick02'    # Battle End Transition (out)  
  48.   Transition_Wait = 60          # Transition Delay, in Frames  
  49. end
  50.  
  51. module Cache  
  52.   # Preparation of Transitions in Cache
  53.   def self.transition(filename)
  54.     load_bitmap('Graphics/Transitions/', filename)
  55.   end  
  56. end
  57.  
  58. module Sound  
  59.   # Teleport's Sound Effect
  60.   def self.play_teleport
  61.     Audio.se_play('Audio/SE/Run', 25, 50)
  62.   end
  63. end
  64.  
  65. class Game_Interpreter
  66. include PPVXAce_General_Configs
  67.  
  68.   MAP_IN =    1       #Transition: Map In
  69.   MAP_OUT =    2      #Transition: Map Out
  70.   BATTLE_IN =   3     #Transition: Battle In
  71.   BATTLE_OUT =   4    #Transition: Battle Out
  72.   BATTLE_END_IN = 5   #Transition: End of Battle In
  73.   BATTLE_END_OUT = 6  #Transition: End of Battle Out
  74.  
  75.   #--------------------------------------------------------------------------
  76.   # Change Transitions Between Scenes
  77.   #--------------------------------------------------------------------------  
  78.   def set_transition (transition = MAP_IN, filename = '')
  79.     # Selects which transition will be changed
  80.     case transition
  81.       when MAP_IN
  82.         $game_system.map_in = filename
  83.       when MAP_OUT
  84.         $game_system.map_out = filename
  85.       when BATTLE_IN
  86.         $game_system.battle_in = filename
  87.       when BATTLE_OUT
  88.         $game_system.battle_out = filename
  89.       when BATTLE_END_IN
  90.         $game_system.battle_end_in = filename
  91.       when BATTLE_END_OUT
  92.         $game_system.battle_end_out = filename
  93.     end
  94.   end
  95.  
  96.   #--------------------------------------------------------------------------
  97.   # Change the Transition Delay
  98.   #--------------------------------------------------------------------------
  99.   def set_transition_wait (duration = 45)
  100.     $game_system.transition_wait = duration
  101.   end  
  102.  
  103. end
  104.  
  105. class Game_System
  106. include PPVXAce_General_Configs
  107.  
  108.   attr_accessor :map_in
  109.   attr_accessor :map_out    
  110.   attr_accessor :battle_in
  111.   attr_accessor :battle_out  
  112.   attr_accessor :battle_end_in
  113.   attr_accessor :battle_end_out  
  114.   attr_accessor :transition_wait  
  115.   attr_accessor :was_in_battle
  116.  
  117.   alias solmaker_transition_initialize initialize
  118.   def initialize
  119.     solmaker_transition_initialize
  120.     load_transitions      
  121.   end
  122.  
  123.   def load_transitions
  124.     @map_in = Transition_In
  125.     @map_out = Transition_Out
  126.     @battle_in  = Battle_In
  127.     @battle_out = Battle_Out
  128.     @battle_end_in  = Battle_End_In
  129.     @battle_end_out = Battle_End_Out
  130.     @transition_wait = Transition_Wait
  131.     @was_in_battle = false
  132.   end
  133.  
  134. end
  135.  
  136. class Scene_Map < Scene_Base  
  137.  
  138.   def pre_transfer    
  139.     @map_name_window.close
  140.     case $game_temp.fade_type
  141.     when 0
  142.       perform_map_transition_out
  143.     when 1
  144.       white_fadeout(fadeout_speed)
  145.     end
  146.   end
  147.  
  148.   def post_transfer
  149.     case $game_temp.fade_type
  150.     when 0
  151.       perform_map_transition_in
  152.     when 1
  153.       white_fadein(fadein_speed)
  154.     end
  155.     @map_name_window.open
  156.   end  
  157.  
  158.   def perform_transition
  159.     if Graphics.brightness == 0
  160.       Graphics.transition(0)
  161.       fadein(fadein_speed)
  162.     else
  163.       $game_system.was_in_battle ? perform_battle_end_transition : super    
  164.     end
  165.   end  
  166.  
  167.   def perform_battle_transition
  168.     filename = ""
  169.     if $game_system.battle_out != ""
  170.       filename = 'Graphics/Transitions/'+ $game_system.battle_out
  171.     end
  172.     Graphics.transition($game_system.transition_wait, filename)
  173.     Graphics.freeze    
  174.   end  
  175.  
  176.   def perform_battle_end_transition
  177.     $game_system.was_in_battle = false
  178.     filename = ""
  179.     if $game_system.battle_end_in != ""
  180.       filename = 'Graphics/Transitions/' + $game_system.battle_end_in
  181.     end
  182.     Graphics.transition($game_system.transition_wait, filename)
  183.   end
  184.      
  185.   def perform_map_transition_out
  186.     Graphics.freeze
  187.     @spriteset.dispose
  188.     filename = ""
  189.     if $game_system.map_out != ""
  190.       filename = 'Graphics/Transitions/' + $game_system.map_out
  191.     end
  192.     Graphics.transition($game_system.transition_wait, filename)  
  193.   end
  194.  
  195.   def perform_map_transition_in
  196.     Graphics.wait($game_system.transition_wait / 2)      
  197.     Graphics.freeze
  198.     @spriteset = Spriteset_Map.new
  199.     filename = ""
  200.     if $game_system.map_in != ""
  201.       filename = 'Graphics/Transitions/' + $game_system.map_in
  202.     end
  203.     Graphics.transition($game_system.transition_wait, filename)
  204.   end
  205.  
  206. end
  207.  
  208. class Scene_Battle < Scene_Base
  209.  
  210.   def perform_transition
  211.     filename = ""
  212.     if $game_system.battle_in != ""
  213.       filename = 'Graphics/Transitions/'+ $game_system.battle_in
  214.     end
  215.     Graphics.transition($game_system.transition_wait, filename)
  216.   end  
  217.  
  218.   def pre_terminate
  219.     super
  220.     $game_system.was_in_battle = true    
  221.     perform_map_transition if SceneManager.scene_is?(Scene_Map)  
  222.     Graphics.fadeout(60) if SceneManager.scene_is?(Scene_Title)
  223.   end
  224.  
  225.   def perform_map_transition
  226.     Graphics.freeze      
  227.     @spriteset.dispose
  228.     filename = ""
  229.     if $game_system.battle_end_out != ""
  230.       filename = 'Graphics/Transitions/' + $game_system.battle_end_out
  231.     end
  232.     Graphics.transition($game_system.transition_wait, filename)
  233.   end
  234.  
  235. end
  236.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement