Fix Pictures to Map Version: 1.1a Author: modern algebra Date: July 28, 2011
Version History
<Version 1.1a> 07.28.2011 - Made a minor change to view settings <Version 1.1> 08.15.2010 - Fixed a bug that occured when the map was refreshed and pictures with special z values would not reset properly. Also got rid of the "layer" switch feature, since it occured to me that it was only useful in very narrow situations. Instead simply setting the variable to anything not 0 and less than 300 will appear in the lowest layer, while a variable set to 0 would be in the normal layer and use default z position, and a variable set greater than 300 would be set directly to that z in the normal layer <Version 1.0> 06.17.2010 - Original Release 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. It also has a couple other features, such as allowing you to set the Z value to show below characters, or below the tiles to add another parallax (kind of).
For a better description of what this script does, see the request topic:
http://rmrk.net/index.php/topic,39049.0.html Features
Allows you to fix a picture to map coordinates, rather than screen coordinates Allows you to set the Z value of a picture, meaning you can show pictures below characters, below tiles, or below parallaxes if you wish Screenshots
Not really screenshot material. The picture just doesn't stay in the same screen position but is instead fixed to the tilemap.
Instructions
See the header for detailed instructions. Remember that the values you set in the script are the IDs of the switches and variable you use to control the script in-game. To control whether or not to fix a picture to map, you use the in-game switch you specified.
Script
Note: Copying from SMF2 Codeboxes does not work if using Internet Explorer. It copies everything onto one line. Either get a different browser or get it from Pastebin.
#============================================================================== # Fix Pictures to Map # Version: 1.1a # Author: modern algebra (rmrk.net) # Date: July 28, 2011 #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # 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. It also has a couple other features, such as # allowing you to set the Z value to show below characters, or below the # tiles to add another parallax (kind of). #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Instructions: # # Paste this script into its own slot above Main and below Materials in the # Script Editor (F11). # # This switch is run by two switches and one variable that you specify. # They are: # FPM_SWITCH - This switch toggles the fix pictures feature. When this # switch is ON and a picture is shown, then that picture will be fixed # to the map coordinates you specify, not to the screen. This means # that if the screen scrolls, the picture will not scroll with it. It # is useful if you want to use a picture as an additional map layer, # or as a parallax. Note that this still sets it to pixels, so if you # want a picture to show up at the map coordinates 1, 2, you would set # it to 32, 64. To specify which switch should be used to control this # feature, go to line 46 and change the value to the ID of the switch # you want to use to control this feature. # FPM_Z_VARIABLE - This allows you to set the priority of the picture. # When showing a picture, the value of this ariable will determine the # z value of the picture. When the variable with this ID is set to 0, # the pictures are shown at their normal z value. Setting this # variable to 1 will place it below characters but above non-star # tiles. Setting this variable to 2 will draw the picture above all # tiles and characters except for "Above Characters" Events. Setting # it to 3 will put it below all tiles and characters but above the # parallax. Setting it to 4 will put it below everything, including # the parallax. Setting it to any other value directly sets the z of # that sprite to that value. To specify which variable controls this # feature, go to line 47 and set FPM_Z_VARIABLE to the ID of the # variable you want to use. #============================================================================== FPM_SWITCH = 1 # See line 22 FPM_Z_VARIABLE = 1 # See line 32 #============================================================================== # ** Game_Picture #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Summary of Changes: # attr_reader - map_locked # aliased method - initialize, show #============================================================================== class Game_Picture #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Public Instance Variables #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ attr_reader :map_locked attr_reader :fpm_z attr_reader :fpm_vp #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Object Initialization #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias malg_fixpicmp_initz_6yh3 initialize def initialize (*args) @map_locked = false @fpm_vp = false malg_fixpicmp_initz_6yh3 (*args) # Run Original Method @fpm_z = 100 + self.number end #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Show Picture #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias ma_fxpm_showpic_2dx4 show def show (*args) ma_fxpm_showpic_2dx4 (*args) # Run Original Method @map_locked = $game_switches[FPM_SWITCH] @fpm_vp = ($game_variables[FPM_Z_VARIABLE] != 0 && $game_variables[FPM_Z_VARIABLE] <= 300) @fpm_z = case $game_variables[FPM_Z_VARIABLE] when 0 then 100 + self.number when 1 then 0 when 2 then 199 when 3 then -50 when 4 then -150 else @fpm_z = $game_variables[FPM_Z_VARIABLE] end end end #============================================================================== # ** Sprite_Picture #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Summary of Changes: # new attr_accessor - fpm_vp1, fpm_vp2 # aliased method - update #============================================================================== class Sprite_Picture #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Public Instance Variables #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ attr_accessor :fpm_vp1 attr_accessor :fpm_vp2 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Frame Update #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias ma_fpm_updt_oxoy_5tb3 update def update (*args) pic_name = @picture_name ma_fpm_updt_oxoy_5tb3 (*args) # Run Original Method if pic_name != @picture_name self.viewport = @picture.fpm_vp ? @fpm_vp1 : @fpm_vp2 @picture_name = pic_name if self.viewport.nil? self.ox, self.oy = 0, 0 # Reset OX and OY for new picture end # Update X position if the picture is fixed to map coordinates if @picture.map_locked self.ox, self.oy = $game_map.display_x / 8, $game_map.display_y / 8 end self.z = @picture.fpm_z end end #============================================================================== # ** Spriteset_Map #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Summary of Changes: # aliased method - create_pictures #============================================================================== class Spriteset_Map #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Create Pictures #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias malg_fxpix_crtpi_5oq1 create_pictures def create_pictures (*args) malg_fxpix_crtpi_5oq1 (*args) # Run Original Method @picture_sprites.each { |sprite| sprite.fpm_vp1, sprite.fpm_vp2 = @viewport1, @viewport2 } end end
Addons
Spoiler for OriginalWij Fixed Pictures Conversion Patch :
This is a conversion patch in case a person, for whatever reason, wants to start using my Fix Pictures to Map script where they had previously been using OriginalWij's Fixed Pictures script and don't want to go through their whole game to fix it up to work with my script's settings
#============================================================================== # OriginalWij Fixed Pictures Conversion Patch for Fix Pictures to Map 1.1a # Version: 1.0 # Author: modern algebra (rmrk.net) # Date: July 28, 2011 #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Description: # # This is a conversion patch in case a person, for whatever reason, wants to # start using my Fix Pictures to Map script where they had previously been # using OriginalWij's Fixed Pictures script and don't want to go through # their whole game to fix it up to work with my script's settings #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Instructions: # # Remove OriginalWij's Fixed Pictures script altogether. Paste this script # into its own slot in the Script Editor, above Main but it must be below # my Fix Pictures to Map script. #============================================================================== #============================================================================== # ** Game Picture #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Summary of Changes: # aliased method - show #============================================================================== class Game_Picture #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # * Show Picture #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ alias mlg_fixpics_owconv_show_7tg1 show def show (*args, &block) mlg_fixpics_owconv_show_7tg1 (*args, &block) if self.name.include? ("[FIXED]") # OriginalWij Conversion @map_locked, @fpm_vp, @fpm_z = true, false, 100 + self.number end end end
Credit
Thanks
joy, for requesting this script Support
Please post in this topic at RMRK for bug reports or questions regarding this script. Do not PM me.
Known Compatibility Issues
No known compatibility issues.
Demo
Demo is
attached (need to be logged in).
All the demo does is show a couple pictures fixed to the map. I probably should have done a contrast and shown some pictures not fixed to the map, but the basic idea is that if you want to show a pic not fixed to the map, you turn the switch off right before showing; if you want to fix a picture to the map, you turn that switch ON.