Ir para conteúdo
Faça parte da equipe! (2024) ×
Conheça nossa Beta Zone! Novas áreas a caminho! ×
  • Quem está por aqui   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.

RPG Maker Vx Ace - Script Parallax Completo


'Lenneth
 Compartilhar

Posts Recomendados

[CENTER][FONT=Courier New]Bom trago um Script completo para fazer Parallax Mapping Overlay Mapping: [QUOTE] #============================================================================== # # ▼ Yami Script Ace - Overlay Mapping # -- Last Updated: 2011.12.29 # -- Level: Easy # -- Requires: n/a # -- Credit: Hanzo Kimura for Original Script # #============================================================================== $imported = {} if $imported.nil? $imported["YSA-OverlayMapping"] = true #============================================================================== # ▼ Updates # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # 2011.12.29 - Bugfix for transfer. # 2011.12.10 - Started and Finished Script. # #============================================================================== # ▼ Introduction # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # This script based on Hanzo Kimura's idea. This will automatically load map's # overlay by map ID, and a map can have more than one image per layer, so you # don't have to create two or more map just for day/night or when an event occur. # #============================================================================== # ▼ Instructions # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # Create a folder in Graphics and name it Overlay. # Put all of your overlay into Graphics/Overlay. # Your overlay file will have the name: "Filename Prefix" + Map-ID + "-" + Number # which "Filename Prefix" is the one you will config below # Map-ID is your map's ID # Number is 1, 2, 3, ... using for Overlay Variables. # # Example: Graphics/Overlay/ground2-1.png # Which means this will be ground layer, for map 2, variable = 1 # # Light/Shadow must be .jpg # Parallax/Ground must be .png # #============================================================================== module YSA module OVERLAY #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # - Overlay Switches - #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # These are switches which are enable overlay layers. Turn them on to show # them in your maps. #-------------------------------------------------------------------------- # Default: ON #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- LIGHT_SWITCH = 1 # Turn on/off light layer SHADOW_SWITCH = 2 # Turn on/off shadow layer PARALLAX_SWITCH = 3 # Turn on/off parallax layer GROUND_SWITCH = 4 # Turn on/off ground layer #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # - Overlay Variables - #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # A map can have more than one image per layer, that means you can have a # different light/shadow for day and night, or have a different ground when # an event occured. #-------------------------------------------------------------------------- # Default: 1 #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- LIGHT_VARIABLE = 2 # Switch to another light SHADOW_VARIABLE = 2 # Switch to another shadow PARALLAX_VARIABLE = 1 # Switch to another parallax GROUND_VARIABLE = 1 # Switch to another ground #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # - Filename Prefix - #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # This will make this script automatic, it will check if there are layers in # overlay folder #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- LIGHT = "light" # Light layer's filename prefix SHADOW = "shadow" # Shadow layer's filename prefix PARALLAX = "par" # Parallax layer's filename prefix GROUND = "ground" # Ground layer's filename prefix #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # - Overlay Opacity - #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # This will make this script automatic, it will check if there are layers in # overlay folder #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- GROUND_OPACITY = 255 PARALLAX_OPACITY = 255 LIGHT_OPACITY = 128 SHADOW_OPACITY = 96 end #OVERLAY end # YSA #============================================================================== # ▼ Editting anything past this point may potentially result in causing # computer damage, incontinence, explosion of user's head, coma, death, and/or # halitosis so edit at your own risk. #============================================================================== #============================================================================== # ■ Cache #============================================================================== module Cache #-------------------------------------------------------------------------- # new method: overlay #-------------------------------------------------------------------------- def self.overlay(filename) load_bitmap("Graphics/Overlay/", filename) end end # Cache #============================================================================== # ■ DataManager #============================================================================== module DataManager #-------------------------------------------------------------------------- # alias method: setup_new_game #-------------------------------------------------------------------------- class <<self; alias ovm_setup_new_game setup_new_game; end def self.setup_new_game ovm_setup_new_game setup_overlay_mapping end #-------------------------------------------------------------------------- # new method: setup_overlay_mapping #-------------------------------------------------------------------------- def self.setup_overlay_mapping # Control switches $game_switches[YSA::OVERLAY::LIGHT_SWITCH] = true $game_switches[YSA::OVERLAY::SHADOW_SWITCH] = true $game_switches[YSA::OVERLAY::GROUND_SWITCH] = true $game_switches[YSA::OVERLAY::PARALLAX_SWITCH] = true # Control variables $game_variables[YSA::OVERLAY::LIGHT_VARIABLE] = 1 $game_variables[YSA::OVERLAY::SHADOW_VARIABLE] = 1 $game_variables[YSA::OVERLAY::GROUND_VARIABLE] = 1 $game_variables[YSA::OVERLAY::PARALLAX_VARIABLE] = 1 end end # DataManager #============================================================================== # ■ Spriteset_Map #============================================================================== class Spriteset_Map #-------------------------------------------------------------------------- # alias method: initialize #-------------------------------------------------------------------------- alias overlay_initialize initialize def initialize overlay_initialize create_overlay_map update end #-------------------------------------------------------------------------- # new method: check_file #-------------------------------------------------------------------------- def check_file(type) filename = "Graphics/Overlay/" filename += YSA::OVERLAY::GROUND if type == "ground" filename += YSA::OVERLAY::LIGHT if type == "light" filename += YSA::OVERLAY::SHADOW if type == "shadow" filename += YSA::OVERLAY::PARALLAX if type == "par" filename += $game_map.map_id.to_s filename += "-" + $game_variables[YSA::OVERLAY::GROUND_VARIABLE].to_s if type == "ground" filename += "-" + $game_variables[YSA::OVERLAY::LIGHT_VARIABLE].to_s if type == "light" filename += "-" + $game_variables[YSA::OVERLAY::SHADOW_VARIABLE].to_s if type == "shadow" filename += "-" + $game_variables[YSA::OVERLAY::PARALLAX_VARIABLE].to_s if type == "par" filename += ".jpg" if type == "light" || type == "shadow" filename += ".png" if type == "par" || type == "ground" return FileTest.exist?(filename) end #-------------------------------------------------------------------------- # new method: create_overlay_map #-------------------------------------------------------------------------- def create_overlay_map w = Graphics.width h = Graphics.height @current_light = 0 @current_shadow = 0 @current_par = 0 @current_ground = 0 # Ground Layer @Ground = Sprite.new(@viewport1) @ground.z = 1 @ground.opacity = YSA::OVERLAY::GROUND_OPACITY # Light Layer @light_viewport = Viewport.new(0, 0, w, h) @light_viewport.z = 10 @Light = Sprite.new(@light_viewport) @light.opacity = YSA::OVERLAY::LIGHT_OPACITY @light.blend_type = 1 # Shadow Layer @shadow_viewport = Viewport.new(0, 0, w, h) @shadow_viewport.z = 9 @Shadow = Sprite.new(@shadow_viewport) @shadow.opacity = YSA::OVERLAY::SHADOW_OPACITY @shadow.blend_type = 2 # Parallax Layer @par_viewport = Viewport.new(0, 0, w, h) @par_viewport.z = 8 @par = Sprite.new(@par_viewport) @par.opacity = YSA::OVERLAY::PARALLAX_OPACITY end #-------------------------------------------------------------------------- # alias method: dispose_parallax #-------------------------------------------------------------------------- alias overlay_dispose_parallax dispose_parallax def dispose_parallax overlay_dispose_parallax dispose_overlay_map end #-------------------------------------------------------------------------- # new method: dispose_overlay_map #-------------------------------------------------------------------------- def dispose_overlay_map @ground.dispose @shadow_viewport.dispose @light_viewport.dispose @light.dispose @shadow.dispose @par_viewport.dispose @par.dispose end #-------------------------------------------------------------------------- # alias method: update_parallax #-------------------------------------------------------------------------- alias overlay_update_parallax update_parallax def update_parallax overlay_update_parallax # Parallax if @Ground != nil if check_file("ground") @ground.visible = $game_switches[YSA::OVERLAY::GROUND_SWITCH] if @ground.visible != $game_switches[YSA::OVERLAY::GROUND_SWITCH] @ground.ox = $game_map.display_x * 32 if @ground.ox != $game_map.display_x * 32 @ground.oy = $game_map.display_y * 32 if @ground.oy != $game_map.display_y * 32 @ground.tone = $game_map.screen.tone if @current_ground != $game_variables[YSA::OVERLAY::GROUND_VARIABLE] filename = YSA::OVERLAY::GROUND filename += $game_map.map_id.to_s filename += "-" + $game_variables[YSA::OVERLAY::GROUND_VARIABLE].to_s @ground.bitmap = Cache.overlay(filename) @current_ground = $game_variables[YSA::OVERLAY::GROUND_VARIABLE] end else @ground.visible = false end end # Light if @Light != nil && @light_viewport != nil if check_file("light") @light.visible = $game_switches[YSA::OVERLAY::LIGHT_SWITCH] if @light.visible != $game_switches[YSA::OVERLAY::LIGHT_SWITCH] @light.ox = $game_map.display_x * 32 if @light.ox != $game_map.display_x * 32 @light.oy = $game_map.display_y * 32 if @light.oy != $game_map.display_y * 32 @light.tone = $game_map.screen.tone @light_viewport.ox = $game_map.screen.shake @light_viewport.color = $game_map.screen.flash_color if @current_light != $game_variables[YSA::OVERLAY::LIGHT_VARIABLE] filename = YSA::OVERLAY::LIGHT filename += $game_map.map_id.to_s filename += "-" + $game_variables[YSA::OVERLAY::LIGHT_VARIABLE].to_s @light.bitmap = Cache.overlay(filename) @current_light = $game_variables[YSA::OVERLAY::LIGHT_VARIABLE] end else @light.visible = false end end # Shadow if @Shadow != nil && @shadow_viewport != nil if check_file("shadow") @shadow.visible = $game_switches[YSA::OVERLAY::SHADOW_SWITCH] if @shadow.visible != $game_switches[YSA::OVERLAY::SHADOW_SWITCH] @shadow.ox = $game_map.display_x * 32 if @shadow.ox != $game_map.display_x * 32 @shadow.oy = $game_map.display_y * 32 if @shadow.oy != $game_map.display_y * 32 @shadow.tone = $game_map.screen.tone @shadow_viewport.ox = $game_map.screen.shake @shadow_viewport.color = $game_map.screen.flash_color if @current_shadow != $game_variables[YSA::OVERLAY::SHADOW_VARIABLE] filename = YSA::OVERLAY::SHADOW filename += $game_map.map_id.to_s filename += "-" + $game_variables[YSA::OVERLAY::SHADOW_VARIABLE].to_s @shadow.bitmap = Cache.overlay(filename) @current_shadow = $game_variables[YSA::OVERLAY::SHADOW_VARIABLE] end else @shadow.visible = false end end # Parallax if @par != nil && @par_viewport != nil if check_file("par") @par.visible = $game_switches[YSA::OVERLAY::PARALLAX_SWITCH] if @par.visible != $game_switches[YSA::OVERLAY::PARALLAX_SWITCH] @par.ox = $game_map.display_x * 32 if @par.ox != $game_map.display_x * 32 @par.oy = $game_map.display_y * 32 if @par.oy != $game_map.display_y * 32 @par.tone = $game_map.screen.tone @par_viewport.ox = $game_map.screen.shake @par_viewport.color = $game_map.screen.flash_color if @current_par != $game_variables[YSA::OVERLAY::PARALLAX_VARIABLE] filename = YSA::OVERLAY::PARALLAX filename += $game_map.map_id.to_s filename += "-" + $game_variables[YSA::OVERLAY::PARALLAX_VARIABLE].to_s @par.bitmap = Cache.overlay(filename) @current_par = $game_variables[YSA::OVERLAY::PARALLAX_VARIABLE] end else @par.visible = false end end end end # Spriteset_Map #============================================================================== # ■ Scene_Map #============================================================================== class Scene_Map < Scene_Base #-------------------------------------------------------------------------- # alias method: post_transfer #-------------------------------------------------------------------------- alias overlay_post_transfer post_transfer def post_transfer @spriteset.dispose_overlay_map @spriteset.create_overlay_map @spriteset.update overlay_post_transfer end end # Scene_Map #============================================================================== # # ▼ End of File # #============================================================================== [/QUOTE] Credits: Hanzo Kimura for Original Script Animated Parallax [QUOTE] #============================================================================== # Animated Parallax [VXA] # Version: 1.0 # Author: modern algebra (rmrk.net) # Date: December 20, 2011 #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Description: # # This script allows you to set an animated parallax background by having # multiple frames and switching between them at a user-defined speed. By # default, this script only supports .png, .jpg, and .bmp file formats for # the animated parallax panels (as they are the only ones I know RMVX Ace # supports). #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Instructions: # # The script operates by having multiple parallax backgrounds and switching # between them at a speed set by you, unique for each map # # Thus, if you want to use an animated parallax, you need to do a few things: # (a) Make or find the parallax backgrounds you want to use and import # them into your game. Then, label them all the same with the one # distinction that at the end of each should have a _1, _2, etc... # Example Naming: # BlueSky_1, BlueSky_2, BlueSky_3, etc... # (b) Set the parallax background to any given map that you want the # animated parallaxes for. Be sure to set it to the first one you want # in succession, so BlueSky_1, not BlueSky_2 or _3. If you do set it to # BlueSky_2, then it will only animate between images _2 and _3. # (c) Scroll down to the EDITABLE REGION at line 83 and follow the # instructions for setting the animation speed #`````````````````````````````````````````````````````````````````````````````` # If you need to change the speed at which parallax panels cycle (for # instance, if you have also changed the parallax that is displaying), you # can do so by using the following code in a Script call: # # change_parallax_animation_speed(x) # x: the number of frames before cycling to the next panel. There are 60 # frames in one second. # # Note: there cannot be a space between speed and (. # change_parallax_animation_speed(x) <- Correct # change_parallax_animation_speed (x) <- Incorrect # # You can also change it to an array of times, such that you can make it so # some frames remain up for longer than others. To do so, just place all of # the speeds for each panel in order, separated by commas. Ie. # # change_parallax_animation_speed(x1, x2, ..., xn) # # The same rule as at line 41 applies. # # EXAMPLES: # # change_parallax_animation_speed(30) # Each parallax panel will be up for half a second before switching. # # change_parallax_animation_speed(15, 30, 60, 45) # The first parallax panel will be up for one quarter of a second before # switching to the second panel; the second panel will be up for half a # second before switching to the third panel; the third panel will be up # for one second before switching to the fourth panel; the fourth panel # will be up for three quarters of a second before switching back to the # first panel. Repeat. #============================================================================== $imported = {} unless $imported $imported[:MA_AnimatedParallax] = true #============================================================================== # ** Game Map #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Summary of Changes: # new constants - MAAP_PARALLAX_ANIMATION_FRAMES; MAAP_PRELOAD_PARALLAXES # MAAP_SUPPORTED_EXTENSIONS # aliased methods - setup_parallax; change_parallax; update_parallax # new methods - setup_parallax_frames; maap_check_extensions #============================================================================== class Game_Map MAAP_PARALLAX_ANIMATION_FRAMES = { # <- Don't touch #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ # EDITABLE REGION #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| # MAAP_PARALLAX_ANIMATION_FRAMES - this constant allows you to set the # speed at which the parallax switches to the next graphic in the animation # series by individual maps. So if you want it to be every 20 frames in one # map but every 35 in another map, this is where you do it. All you need to # do is type in the following code: # # map_id => frames, # # where map_id is the ID of the Map you want to set it for and frames is # either (a) an integer for how many frames you want to show each panel # before switching to the next; or (b) an array of integers where each entry # of the array is the number of frames to keep the corresponding frame up # before switching to the next. This allows you to vary the time each of the # frames is left on before switching. There are 60 frames in a second. # # EXAMPLES: # 1 => 35, Map 1 will cycle through parallax panels every 35 frames # 2 => 40, Map 2 will cycle through parallax panels every 40 frames # 8 => [20, 5, 15], Map 8 will keep the first panel of the animated # parallax on for 20 frames before switching to the second # panel which will be on for 5 frames before switching to # the third panel which is on 15 frames before switching # back to the first panel. Repeat. # # Note that the comma is necessary! For any maps where you use animated # parallaxes but do not include the map ID in this hash, then it will default # to the value set below at: MAAP_PARALLAX_ANIMATION_FRAMES.default. 1 => 20, 8 => 40, } # <- Don't touch # Changing the below value allows you to change the default speed of frame # animation. Ie. the speed of frame animation in a map in which you have not # directly set the speed via the above hash configuration. MAAP_PARALLAX_ANIMATION_FRAMES.default = 30 # Depending on the size of the parallaxes and how many panels you use in a # map, there can be some lag when you load new panels. The following option # allows you to decide whether all the parallax frames are loaded at once # when the map is first entered or individually the first time each panel # shows up. Generally, if your panels are very large (1MB+) then you should # set it to true; if smaller files, then you should set it to false. MAAP_PRELOAD_PARALLAXES = true #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| # END EDITABLE REGION #/////////////////////////////////////////////////////////////////////////// MAAP_SUPPORTED_EXTENSIONS = ["png", "jpg", "bmp"] #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Setup Parallax #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias ma_anmp_setuplax_6id3 setup_parallax def setup_parallax(*args, &block) ma_anmp_setuplax_6id3(*args, &block) # Run Original Method setup_parallax_frames end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Change Parallax #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias moda_ap_chngprlx_8uz2 change_parallax def change_parallax(*args, &block) moda_ap_chngprlx_8uz2(*args, &block) # Run Original Method setup_parallax_frames end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Update Parallax #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias maba_ap_updprx_9hv3 update_parallax def update_parallax(*args, &block) maba_ap_updprx_9hv3(*args, &block) # Run Original Method # Use the timer if the parallax has more than one frame if @maap_parallax_frames && @maap_parallax_frames.size > 1 @maap_parallax_frame_timer += 1 # Check if timer exceeded if @maap_parallax_frame_timer >= @maap_frame_speed @maap_parallax_frame_timer = 0 # Reset Timer # Set parallax to next frame @maap_parallax_index = (@maap_parallax_index + 1) % @maap_parallax_frames.size @parallax_name = @maap_parallax_frames[@maap_parallax_index] set_parallax_frame_speed(@maap_parallax_speed, @maap_parallax_index) end end end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Set Parallax Animation Speed #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def set_parallax_frame_speed(parallax_speed = MAAP_PARALLAX_ANIMATION_FRAMES[@map_id], frame = 0) @maap_parallax_speed = parallax_speed if @maap_parallax_speed.is_a?(Array) @maap_frame_speed = [@maap_parallax_speed[frame], @maap_parallax_speed.compact[0]].compact[0] else @maap_frame_speed = @maap_parallax_speed end # Get the default setting, in case the time limit is incorrectly set unless @maap_frame_speed.is_a?(Integer) p "Error: Animated Parallax 1.0\nFrame Speed incorrectly set for #{@map_id}, frame #{frame + 1} - #{@parallax_name}" @maap_frame_speed = MAAP_PARALLAX_ANIMATION_FRAMES.default @maap_frame_speed = default.compact[0] if @maap_frame_speed.is_a?(Array) @maap_frame_speed = 30 if !@maap_frame_speed end end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Setup Parallax Frames #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def setup_parallax_frames # Retain the names of old map's parallax, for disposal last_map_bmps = @maap_parallax_frames.nil? ? [] : @maap_parallax_frames # Initialize Data @maap_parallax_index = 0 @maap_parallax_frames = [@parallax_name] @maap_parallax_frame_timer = 0 set_parallax_frame_speed # Collect all frames of the parallax animation if @parallax_name[/_(\d+)$/] != nil frame_id = $1.to_i + 1 base_name = @parallax_name.sub(/_\d+$/, "") while maap_check_extensions("Graphics/Parallaxes/#{base_name}_#{frame_id}") @maap_parallax_frames.push("#{base_name}_#{frame_id}") frame_id += 1 end end # Dispose the cached bitmaps from the previous map (last_map_bmps - @maap_parallax_frames).each { |bmp| (Cache.parallax(bmp)).dispose } # Preload all the parallax bitmaps so no lag is experienced on first load if MAAP_PRELOAD_PARALLAXES (@maap_parallax_frames - last_map_bmps).each { |bmp| Cache.parallax(bmp) } end Graphics.frame_reset end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Check Extensions #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def maap_check_extensions (filepath) MAAP_SUPPORTED_EXTENSIONS.any? { |ext| FileTest.exist?("#{filepath}.#{ext}") } end end #============================================================================== # ** Game_Interpreter #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Summary of Changes: # new method - change_parallax_animation_speed #============================================================================== class Game_Interpreter #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Change Parallax Animation Speed #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def change_parallax_animation_speed(*args) if args.size <= 1 $game_map.set_parallax_frame_speed(*args) else $game_map.set_parallax_frame_speed(args) end end end #============================================================================== # ** Spriteset Map #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Summary of Changes: # aliased method - update_parallax #============================================================================== class Spriteset_Map #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Update Parallax #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias ma_animpara_updlax_7ig8 update_parallax def update_parallax(*args, &block) # Don't ever dispose the cached parallax pictures. @parallax.bitmap = nil if @parallax_name != $game_map.parallax_name ma_animpara_updlax_7ig8(*args, &block) # Run Original Method end end [/QUOTE] Author: modern algebra (rmrk.net) [/FONT] Fix Picture: [QUOTE][/QUOTE][/CENTER][QUOTE] #============================================================================== # Fix Picture to Map # Version: 1.0.2 [VXA] # Author: modern algebra (rmrk.net) # Date: 8 September, 2012 #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Description: # # This allows you to set the position of a picture by the X and Y position # of the map, rather than the screen, so that the picture won't move with you # when the screen scrolls. Additionally, the script lets you set the Z value # to show below characters, or even below the tiles or below the parallax. # # This script has no effect in battle and pictures there behave normally. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Instructions: # # Paste this script into its own slot in the Script Editor, above Main but # below Materials. # # To specify that a picture should be fixed to a map and not follow the # screen, all you need to do is turn an in-game switch on before showing the # picture. To specify which switch, all you need to do is change the value of # SWITCH_ID at line 60. Alternatively, you can include the code [Fixed] # somewhere in the name of the picture. # # For the fixed pictures, you also have the option of assigning it to grid # coordinates instead of pixel coordinates. This means that if you wanted it # to show up at (3, 5) in the map, you could set it to that directly instead # of (96, 160). You can turn on this feature using another switch, again one # which you choose by changing the value of COORDINATES_SWITCH_ID at line 63. # # To specify the layer of the tilemap (what shows above it and what shows # below it), all you need to do is change the value of a variable. Which # variable is also specifed by you by changing Z_VARIABLE_ID at line 69. # The value to which that in-game variable is set at the time a picture is # shown determines where the picture will show up. If the variable is set to # 0 then it will be in its normal place; if set to -1, it will show below # the tilemap but above the parallax; if set to -2, it will show below the # parallax; if set to 1, it will show above all non-star tiles but star tiles # and characters with normal priority; if set to 2, it will show above # characters with normal priority but below characters with "Above # Characters" priority. If set to any other value, the z value of the picture # will be set to that directly. #============================================================================== $imported = {} unless $imported $imported[:MA_FixPictureToMap] = true #============================================================================== # *** MA_FixPicture #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # This module holds some relevant configuration Data #============================================================================== module MA_FixPicture #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ # Editable Region #|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| # SWITCH_ID - set this to the ID of the in-game switch that you want to # use to control whether pictures should be fixed. SWITCH_ID = 2 # COORDINATES_SWITCH_ID - Set this to the ID of the in-game switch that you # want to use to control how coordinates are set. If this switch is ON, then # for fixed pictures, you can just use the grid x and y coordinates (ie: you # would set (1, 4) instead of (32, 128). If you always want this feature to # be on when the FPM Switch is on, you can set it to have the same ID. COORDINATES_SWITCH_ID = 2 # Z_VARIABLE_ID - set this to the ID of the in-game variable that you # want to use to control the z-value priority of the picture. Z_VARIABLE_ID = 3 #|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| # End Editable Region #//////////////////////////////////////////////////////////////////////////// class << self #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Public Instance Variables #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ attr_accessor :spriteset_vp1 attr_accessor :spriteset_vp2 end end #============================================================================== # ** Game Picture #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Summary of Changes: # new public instance variables - mafpm_vp_id; mafpm_fixed; mafpm_z # aliased method - initialize; show; move #============================================================================== class Game_Picture #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Public Instance Variables #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ attr_accessor :mafpm_vp_id attr_accessor :mafpm_fixed attr_accessor :mafpm_z #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Object Initialization #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias mafpm_iniz_2fg6 initialize def initialize(*args, &block) @mafpm_fixed = false @mafpm_vp_id = 2 mafpm_iniz_2fg6(*args, &block) # Call Original Method @mafpm_z = self.number end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Show Picture #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias mafpm_showpic_3jb7 show def show(name, *args, &block) # Only fix pictures if in Scene_Map if SceneManager.scene_is?(Scene_Map) @mafpm_fixed = (MA_FixPicture::SWITCH_ID == true || $game_switches[MA_FixPicture::SWITCH_ID] || !name[/\[FIXED\]/i].nil?) z_var = $game_variables[MA_FixPicture::Z_VARIABLE_ID] # If 0 or less than 300, then it should belong to the viewport1 @mafpm_vp_id = (z_var != 0 && z_var < 300) ? 1 : 2 # Set Z shortcuts @mafpm_z = case z_var when -1 then -50 # Below tilemap but above parallax when -2 then -150 # Below parallax when 0 then self.number # Normal position when 1 then 50 # Above tilemap but below normal characters when 2 then 150 # Above normal characters but below Above Characters else @mafpm_z = z_var < 300 ? z_var : z_var - 300 # Directly set to value end end mafpm_showpic_3jb7(name, *args, &block) # Call Original Method if @mafpm_fixed && (MA_FixPicture::COORDINATES_SWITCH_ID == true || $game_switches[MA_FixPicture::COORDINATES_SWITCH_ID]) @x *= 32 @y *= 32 end end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Move Picture #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias mafpm_movepctr_2js1 move def move(*args, &block) mafpm_movepctr_2js1(*args, &block) if @mafpm_fixed && (MA_FixPicture::COORDINATES_SWITCH_ID == true || $game_switches[MA_FixPicture::COORDINATES_SWITCH_ID]) @target_x *= 32 @target_y *= 32 end end end #============================================================================== # ** Sprite Picture #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Summary of Changes: # aliased methods - update #============================================================================== class Sprite_Picture #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Frame Update #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias mafpm_updt_5fw1 update def update(*args, &block) mafpm_updt_5fw1(*args, &block) # Call original method # If picture is fixed to map if @picture.mafpm_fixed # Scroll the picture appropriately self.x = @picture.x - ($game_map.display_x * 32) self.y = @picture.y - ($game_map.display_y * 32) end self.z = @picture.mafpm_z # Update Z to the correct Z # If the viewport has changed if @mafpm_vp_id != @picture.mafpm_vp_id && MA_FixPicture.send(:"spriteset_vp#{@picture.mafpm_vp_id}") @mafpm_vp_id = @picture.mafpm_vp_id # Change viewport self.viewport = MA_FixPicture.send(:"spriteset_vp#{@mafpm_vp_id}") end end end #============================================================================== # ** Spriteset Map #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Summary of Changes: # aliased methods - create_viewports; dispose_viewports #============================================================================== class Spriteset_Map #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Create Viewports #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias mafpm_creatviewpor_3dk8 create_viewports def create_viewports(*args, &block) mafpm_creatviewpor_3dk8(*args, &block) # Call original method # Set the viewports to be globally accessible MA_FixPicture.spriteset_vp1 = @viewport1 MA_FixPicture.spriteset_vp2 = @viewport2 end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Dispose Viewports #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias mafpm_disposevps_2nr5 dispose_viewports def dispose_viewports(*args, &block) # Nullify the variables in MA_FixPicture MA_FixPicture.spriteset_vp1 = nil MA_FixPicture.spriteset_vp2 = nil mafpm_disposevps_2nr5(*args, &block) # Call original method end end [/QUOTE] [CENTER]Author: modern algebra (rmrk.net) [/CENTER]
  • Curtir 1
Standard Trading - Shops - 🌟🔥 EXOSTA 🔥🌟 THE #1 TRADING & SERVICE CENTER  💎 The Magic Find Academy, my new Discord Server 💎 - Forum - Path of Exile
Link para o comentário
Compartilhar em outros sites

Este tópico está impedido de receber novos posts.
 Compartilhar

×
×
  • Criar Novo...

Informação Importante

Nós fazemos uso de cookies no seu dispositivo para ajudar a tornar este site melhor. Você pode ajustar suas configurações de cookies , caso contrário, vamos supor que você está bem para continuar.