SHARE
TWEET

Slide Effect (VX-Ace) v1.3

jesterruby Feb 18th, 2013 (edited) 709 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #~ Slide Effect (VX-Ace) v1.3 by Lain (formerly Jester)
  2.  
  3. #~ Version History:
  4. #~ 18.FEB.2013 -> 1.0  -> Initial Release
  5. #~ 09.MAR.2013 -> 1.1  -> Compatibility Improvement and Fixes
  6. #~ 12.MAR.2013 -> 1.2  -> Added Compatibility-options to the Customization section
  7. #~ 14.MAR.2013 -> 1.3  -> Picture and Balloon fix! And more supported Scripts
  8.  
  9. #~ Features:
  10. #~ Slide-Effect when transfering, just like in the topdown Zelda games.
  11. #~ It is originally designed as addition to my Script: Map Edge Transfer.
  12.  
  13. #~ This Script is semi-Plug'n'Play and has optional Compatibility fixes.
  14. #~ Take a look at the Customization section.
  15.  
  16. #~ Bugs:
  17. #~ (no known issues)
  18.  
  19. #~ Conflicts:
  20. #~ Victor Sant's Light Effects <- Seems nearly impossible to fix =<
  21. #~ I am fine with Compatibility fix requests if you say "PLEEAASEEEE!!!"
  22.  
  23. #~ Feel free to report any Bugs and Conflicts that are not listed above.
  24. #~ I am available for feedback at rmrk.net and rpgmakervxace.net.
  25. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  26. $jimported ||= {} #<- DON'T TOUCH ME!!!
  27. $jimported[:jms_sef] = 1.3 #<- DON'T TOUCH ME!!!
  28. module JMSC # Jester Mini-Script Customization
  29.   module SEF # Slide EFfect
  30. #~~~~~~~~~~~~~~~~~~~~~~~~~Customization~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  31.  
  32. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #  
  33. # Slide Effect Options:      
  34.   # The speed of the Slide Effect (default: 12):
  35.     Slide_Speed = 12
  36.    
  37.   # In-game Switch to temporarly disable the Slide Effect:
  38.     Disable_Sliding_Switch = 22
  39.    
  40.   # Set this to false, if you DON'T want a Slide Effect for normal Transfer
  41.   # (only relevant when using "Map Edge Transfer".)
  42.   # Set to true, if you are confused right now:
  43.     Evented_Sliding = true
  44. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
  45.  
  46. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
  47. # Compatibility Options:
  48.   # Set to true, if you use the specific Script:
  49.     SES_Time_Clock = false #SES Dynamic Time "Clock Extension"
  50.     XAS_HUD = false #XAS HUD
  51.     XS_Variable_HUD = false #XS Variable HUD
  52.     XS_Alignment_HUD = false # XS Alignment HUD
  53.     MA_HoverAlert = false #Modern Algebra's Hover Alert. (Overwrites Sprite_HoverAlert update!)
  54.     Pearl_Life_Bars = false #falcao's Pearl v2 "Life Bar"
  55.     Pearl_Skillbar = false #falcao's Pearl v2 "Skillbar"
  56. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
  57.  
  58. # END OF CUSTOMIZATION!
  59. #~~~~~~~~~~~~~~~~~~~~~~~Main Script~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  60. # Don't edit anything below, unless you know what you are doing:
  61.   end #module SEF
  62. end #module JMSC
  63.  
  64.  
  65. #==============================================================================
  66. # ** Game_Player
  67. #==============================================================================
  68. class Game_Player < Game_Character
  69.   #--------------------------------------------------------------------------
  70.   # * Public Instance Variables (existing variables)
  71.   #--------------------------------------------------------------------------
  72.   attr_accessor :vehicle_type
  73. end
  74.  
  75. #==============================================================================
  76. # ** Game_Temp
  77. #==============================================================================
  78. class Game_Temp
  79.  
  80.   #--------------------------------------------------------------------------
  81.   # * Public Instance Variables (new variables)
  82.   #--------------------------------------------------------------------------
  83.   attr_accessor :jms_met_sliding
  84.   attr_accessor :jms_met_slidex
  85.   attr_accessor :jms_met_slidey
  86.  
  87.   #--------------------------------------------------------------------------
  88.   # * [Alias] initialize
  89.   # *   Initializing the new Variables
  90.   #--------------------------------------------------------------------------
  91.   alias jms_MapEdgeTransfer_GameTemp_init initialize
  92.   def initialize
  93.     jms_MapEdgeTransfer_GameTemp_init
  94.     @jms_met_sliding = false
  95.     @jms_met_slidex = 0
  96.     @jms_met_slidey = 0
  97.   end
  98. end #Game_Temp
  99.  
  100. #==============================================================================
  101. # ** Sprite_Character
  102. #==============================================================================
  103. class Sprite_Character < Sprite_Base
  104.  
  105.   #--------------------------------------------------------------------------
  106.   # * [Alias] update
  107.   # *   Redifining the position of the player while sliding the bitmaps
  108.   #--------------------------------------------------------------------------
  109.   alias jms_MapEdgeTransfer_SpriteCharacter_update update
  110.   def update
  111.     jms_MapEdgeTransfer_SpriteCharacter_update
  112.     if $game_temp.jms_met_sliding
  113.       self.x = @character.screen_x + $game_temp.jms_met_slidex
  114.       self.y = @character.screen_y + $game_temp.jms_met_slidey
  115.     end
  116.   end
  117.  
  118.   #--------------------------------------------------------------------------
  119.   # * [Alias] start_balloon
  120.   # *   Prevent Balloon animations from starting during the Slide-Effect
  121.   #--------------------------------------------------------------------------
  122.   alias jms_MapEdgeTransfer_SpriteCharacter_startballoon start_balloon
  123.   def start_balloon
  124.     return if $game_temp.jms_met_sliding
  125.     jms_MapEdgeTransfer_SpriteCharacter_startballoon
  126.   end
  127. end #Sprite_Character
  128.  
  129. #==============================================================================
  130. # ** Spriteset_Map
  131. #==============================================================================
  132.  
  133. class Spriteset_Map
  134.  
  135.   #--------------------------------------------------------------------------
  136.   # * Public Instance Variables (existing variables)
  137.   #--------------------------------------------------------------------------
  138.   attr_accessor :tilemap
  139.  
  140. end #Spriteset_Map
  141.  
  142. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  143. # Method-chain: Slide Effect
  144.  
  145. # Relevant Methods:
  146. # jms_met_slideprocessing <- Perform a Slide Transfer into the player direction
  147. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  148. #==============================================================================
  149. # ** Scene_Map
  150. #==============================================================================
  151.  
  152. class Scene_Map < Scene_Base
  153.   #--------------------------------------------------------------------------
  154.   # * [Alias] update_transfer_player
  155.   # *   Redirecting, if Slide Effect is possible
  156.   #--------------------------------------------------------------------------
  157.   alias jms_MapEdgeTransfer_SceneMap_updatetrpl update_transfer_player
  158.   def update_transfer_player
  159.     $game_temp.jms_met_sliding = true if $game_player.transfer? && JMSC::SEF::Evented_Sliding && !$game_switches[JMSC::SEF::Disable_Sliding_Switch]
  160.     jms_MapEdgeTransfer_SceneMap_updatetrpl if !$game_temp.jms_met_sliding && $game_player.transfer?
  161.     jms_met_slideprocessing if $game_player.transfer? && $game_temp.jms_met_sliding
  162.   end
  163.  
  164.   #--------------------------------------------------------------------------
  165.   # * [New Method] jms_met_slideprocessing
  166.   # *   Setting up the Slide Effect Processing
  167.   #--------------------------------------------------------------------------
  168.   def jms_met_slideprocessing
  169.     trans_slide = true
  170.     if $jimported[:jms_met]
  171.       trans_slide = false unless $game_player.jms_met_overedge? == 0
  172.     end
  173.     $game_player.transparent = true if $game_player.vehicle_type == :walk && trans_slide
  174.     @spriteset.update
  175.     @spriteset.dispose_pictures
  176.     @slidemap = Sprite.new
  177.     @slidemap.bitmap = Graphics.snap_to_bitmap
  178.     @slidemap.z = 1
  179.     @spriteset.create_pictures
  180.     jms_met_pretransfer #pre-transfer
  181.     $game_temp.fade_type = 666
  182.     perform_transfer
  183.     $game_map.autoplay
  184.     $game_map.update
  185.     @spriteset.create_characters
  186.     @spriteset = Spriteset_Map.new
  187.     jms_met_preslide #pre-slide
  188.     $game_player.transparent = false if $game_player.vehicle_type == :walk
  189.     jms_met_performslide($game_player.direction)
  190.     @slidemap.dispose
  191.     @spriteset.update
  192.     Input.update
  193.     $game_temp.jms_met_slidex = 0
  194.     $game_temp.jms_met_slidey = 0
  195.     $game_temp.jms_met_sliding = false
  196.   end
  197.  
  198.   #--------------------------------------------------------------------------
  199.   # * [New Method] jms_met_performslide(d)
  200.   # *   Executing the Slide Effect into cardinal direction "d"
  201.   # *   Credits: OriginalWiJ
  202.   #--------------------------------------------------------------------------
  203.   def jms_met_performslide(d)
  204.     w = Graphics.width
  205.     h = Graphics.height
  206.     speed = JMSC::SEF::Slide_Speed
  207.     case d
  208.       when 2
  209.         @spriteset.tilemap.oy += h + ($game_map.height * 32 - h) * 2
  210.         $game_temp.jms_met_slidex = 0
  211.         $game_temp.jms_met_slidey = h
  212.         for i in 0...h / speed
  213.           @slidemap.oy += speed
  214.           @spriteset.tilemap.oy += speed
  215.           $game_temp.jms_met_slidey -= speed
  216.           @spriteset.update_characters
  217.           Graphics.update
  218.       end
  219.       when 4
  220.         @spriteset.tilemap.ox -= w + ($game_map.width * 32 - w) * 2
  221.         $game_temp.jms_met_slidex = -w
  222.         $game_temp.jms_met_slidey = 0
  223.         for i in 0...w / speed
  224.           @slidemap.ox -= speed
  225.           @spriteset.tilemap.ox -= speed
  226.           $game_temp.jms_met_slidex += speed
  227.           @spriteset.update_characters
  228.           Graphics.update
  229.       end
  230.       when 6
  231.         @spriteset.tilemap.ox += w + ($game_map.width * 32 - w) * 2
  232.         $game_temp.jms_met_slidex = w
  233.         $game_temp.jms_met_slidey = 0
  234.         for i in 0...w / speed
  235.           @slidemap.ox += speed
  236.           @spriteset.tilemap.ox += speed
  237.           $game_temp.jms_met_slidex -= speed
  238.           @spriteset.update_characters
  239.           Graphics.update
  240.       end
  241.       when 8
  242.         @spriteset.tilemap.oy -= h + ($game_map.height * 32 - h) * 2
  243.         $game_temp.jms_met_slidex = 0
  244.         $game_temp.jms_met_slidey = -h
  245.         for i in 0...h / speed
  246.           @slidemap.oy -= speed
  247.           @spriteset.tilemap.oy -= speed
  248.           $game_temp.jms_met_slidey += speed
  249.           @spriteset.update_characters
  250.           Graphics.update
  251.       end
  252.     end
  253.   end
  254.  
  255.   #--------------------------------------------------------------------------
  256.   # * [New Method] jms_met_pretransfer
  257.   # *   Everything that happens directly before transfering the player.
  258.   #--------------------------------------------------------------------------
  259.   def jms_met_pretransfer
  260.   end
  261.  
  262.   #--------------------------------------------------------------------------
  263.   # * [New Method] jms_met_preslide
  264.   # *   Everything that happens directly before the Slide Effect.
  265.   #--------------------------------------------------------------------------
  266.   def jms_met_preslide
  267.   end
  268. end #Scene_Map
  269. #End of Method-Chain: Slide Effect
  270.  
  271. #Compatibility fix: window refresh
  272. if JMSC::SEF::SES_Time_Clock || JMSC::SEF::XS_Variable_HUD || JMSC::SEF::XS_Alignment_HUD
  273.   class Scene_Map < Scene_Base
  274.     alias jms_met_windowcomp_scenemap_slideprocessing jms_met_slideprocessing
  275.     def jms_met_slideprocessing
  276.       dispose_all_windows
  277.       create_all_windows
  278.       jms_met_windowcomp_scenemap_slideprocessing
  279.     end
  280.   end
  281. end #window refresh
  282.  
  283. #Compatibility fix: SES Time Clock
  284. if JMSC::SEF::SES_Time_Clock
  285.   class Game_Map
  286.     alias jms_met_sestccomp_gamemap_noclock no_clock?
  287.     def no_clock?(map = @map)
  288.       return true if $game_temp.jms_met_sliding
  289.       jms_met_sestccomp_gamemap_noclock(map = @map)
  290.     end
  291.   end
  292.   class Scene_Map < Scene_Base
  293.     alias jms_met_sestccomp_scenemap_jmspretransfer jms_met_pretransfer
  294.     def jms_met_pretransfer
  295.       create_clock_windows
  296.       jms_met_sestccomp_scenemap_jmspretransfer
  297.     end
  298.   end
  299. end #SES Time Clock
  300.  
  301. #Compatibility fix: XAS HUD
  302. if JMSC::SEF::XAS_HUD
  303.   class Spriteset_Map
  304.     alias jms_met_xashudcomp_spritemap_hud_visible? hud_visible?
  305.     def hud_visible?
  306.       return false if $game_temp.jms_met_sliding
  307.       jms_met_xashudcomp_spritemap_hud_visible?
  308.     end
  309.   end
  310.   class Scene_Map
  311.     alias jms_met_xashudcomp_scenemap_slideprocessing jms_met_slideprocessing
  312.     def jms_met_slideprocessing
  313.       @spriteset.update_xas_spriteset_map
  314.       jms_met_xashudcomp_scenemap_slideprocessing
  315.     end
  316.   end
  317. end #XAS HUD
  318.  
  319. #Compatibility fix: XS Variable HUD
  320. if JMSC::SEF::XS_Variable_HUD
  321.   class Scene_Map < Scene_Base
  322.     alias jms_met_xsvarcomp_scenemap_preslide jms_met_preslide
  323.     def jms_met_preslide
  324.       jms_met_xsvarcomp_scenemap_preslide
  325.       create_var_hud_window
  326.     end
  327.   end
  328. end #XS Variable HUD
  329.  
  330. #Compatibility fix: XS Alignment HUD
  331. if JMSC::SEF::XS_Alignment_HUD
  332.   class Scene_Map < Scene_Base
  333.     alias jms_met_xsaligcomp_scenemap_preslide jms_met_preslide
  334.     def jms_met_preslide
  335.       jms_met_xsaligcomp_scenemap_preslide
  336.       create_alignment_hud
  337.     end
  338.   end
  339. end #XS Alignment HUD
  340.  
  341. #Compatibility fix: MA Hover Alert
  342. if JMSC::SEF::MA_HoverAlert
  343.   class Sprite_HoverAlert < Sprite_Base
  344.     def update
  345.       super
  346.       refresh if @hover_alert != @character.hover_alert # if hover alert changed
  347.       if bitmap
  348.         if @hover_alert.proximity > 0
  349.           x = @character.distance_x_from($game_player.x).abs
  350.           y = @character.distance_y_from($game_player.y).abs
  351.           self.visible = Math.hypot(x, y) <= @hover_alert.proximity
  352.         end
  353.         if self.visible && !$game_temp.jms_met_sliding
  354.           maha_update_se              # Update Sound Effect
  355.           maha_update_frame_animation # Update animation
  356.           maha_update_effect          # Update the effect being played
  357.           # Adust position
  358.           self.x = @char_x + @effect_x
  359.           self.y = @char_y + @effect_y
  360.         end
  361.         if @hover_alert && @hover_alert.time > 0
  362.           if @time == @hover_alert.time
  363.             @character.show_hover_alert("", 0) # End Hover Alert
  364.             refresh
  365.           end
  366.           @time += 1
  367.         end
  368.       end
  369.     end
  370.   end
  371. end #MA Hover Alert
  372.  
  373. #Compatibility fix: Pearl v2: Skillbar
  374. if JMSC::SEF::Pearl_Skillbar
  375.   class Scene_Map < Scene_Base
  376.     alias jms_met_pearlsbcomp_scenemap_slideprocessing jms_met_slideprocessing
  377.     def jms_met_slideprocessing
  378.       @jms_met_pearl_skillbar = false
  379.       @jms_met_pearl_skillbar = true if $game_system_skillbar_enable != true
  380.       $game_system.skillbar_enable = true if $game_system_skillbar_enable != true
  381.       jms_met_pearlsbcomp_scenemap_slideprocessing
  382.     end
  383.     alias jms_met_pearlsbcomp_scenemap_preslide jms_met_preslide
  384.     def jms_met_preslide
  385.       $game_system.skillbar_enable = nil if @jms_met_pearl_skillbar
  386.       jms_met_pearlsbcomp_scenemap_preslide
  387.     end
  388.   end
  389. end #Pearl Skillbars
  390.  
  391. #Compatibility fix: Pearl v2: Life Bars
  392. if JMSC::SEF::Pearl_Life_Bars
  393.   class Scene_Map < Scene_Base
  394.     alias jms_met_pearllbcomp_scenemap_slideprocessing jms_met_slideprocessing
  395.     def jms_met_slideprocessing
  396.       @jms_met_pearl_bar = false
  397.       @jms_met_pearl_bar = true if $game_system.pearlbars != true
  398.       $game_system.pearlbars = true if $game_system.pearlbars != true
  399.       jms_met_pearllbcomp_scenemap_slideprocessing
  400.     end
  401.     alias jms_met_pearllbcomp_scenemap_preslide jms_met_preslide
  402.     def jms_met_preslide
  403.       $game_system.pearlbars = nil if @jms_met_pearl_bar
  404.       jms_met_pearllbcomp_scenemap_preslide
  405.     end
  406.   end
  407. end #Pearl Lifebars
  408.  
  409. # END OF SCRIPT
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top