RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Fix Pictures to Map

0 Members and 2 Guests are viewing this topic.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
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.
Code: [Select]
#==============================================================================
#    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
Code: [Select]
#==============================================================================
#    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


  • modern algebra

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.
« Last Edit: July 29, 2011, 01:31:24 AM by modern algebra »

*
Rep: +0/-0Level 75
Rawr.
There seems to be a problem with this script! I think. 

I have the script set up so the picture will appear underneath the "above character" priority. Works great! Until I enter into the menu (default menu).  When I exit the menu, it's as if the set up was undone.  While the picture is still there, it's above the "above character" priority.  I'm not sure what's causing this.  I'm still trying to figure out what to change to fix it, but I was curious if you had any ideas.

It's a really spiffy script for someone who maps with parallaxes and I'd hate for it to become unusable by me if I can't figure this out.

***
Rep:
Level 76
~Crazy Lazy Workaholic~
I think SLP has the same thing going on... I didn't incorporate the script, but I playtested an area using it and I started in the area and there is an "above character" picture, only it's below character until I open the menu, then it's properly above.

~My Projects~

~ VocaloidVX ~ Second Life Project ~
~ RPG Maker Collective ~
To support this forum, it's the first place that will gets posted some updates of mine, check it out ^_~

*
Rep: +0/-0Level 75
Rawr.
Oh, my friend and I figured out the bug that I am encountering.  We don't know how to fix it, but we're pretty sure this is why it's happening: When the map is recreated, the pictures are created before the viewports are.  So the pics viewport is nil and it defaults to being over everything.  The problem arises when you return to the Scene_Map from another scene (such as the menu).

Terra: did you set up the pictures correctly? I know there is a mode where it will appear below the characters... but it's being reset by going into the menu and out (like what I mention above), so whatever it was doing was undone and then placed above everything like pictures by default are.

ALSO! I found another problem that relates probably to the Scene_Map.  If you transfer to a new map, the same bug occurs! Therefore, the picture resets and goes above the "above character" priority events.
« Last Edit: August 05, 2010, 08:20:24 PM by Ronove »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Thanks for the bug reports guys. I will post the updated script shortly. You are right that the problem is with viewports, but not quite right as to where it goes wrong. Viewports are created before pictures - the problem resides with how I communicate what the viewports are to the sprites and the fact that I communicate them too late. Anyway, it's an easy fix and you will see it shortly.

*
Rep: +0/-0Level 76
RMRK Junior
Hmm...first, sorry for my english...

What I wanted to ask is to please you could show more of an image, I need to display a 5 at the same time, on the same map in order to display the HUD, I hope it is possible to request that I make and most of all I hope not necroposting XD.

In short, I wish you could show more than 1 image.

P.D.: that script is awesome.!

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
You can show up to 20 images by default, though.


All you need to do is identify it by a different number. See the attached screenshot. What I've circled in red is the number. It can be anything from 1 - 20. If you wish to operate on the picture at all (Move, Rotate, etc...) you just need to identify the picture by the number you use when you show it.

If you need more than 20, you can use my Extra Pictures script as well.

**
Rep: +0/-0Level 68
RMRK Junior
iam sorry MA
can you make the demo for me ?  :(
i don't know how to use this script

iam sorry iam bad in english :(

***
Rep:
Level 84
---> LOL <---
I have a question:

Ok so the first switch FPM_switch -I set to 26, i placed an image(#2 - does it matter what picture? I have a script that sets "over head" - what character walk under with the title [FIXED]image.png as fixed for parallaxing) at 0,0 and turned on the switch, set the PM_Z_VARIABLE = 1 so the character can walk on it (from my understanding) -how ever when loading the game, the picture still moves....

*
Rep:
Level 82
GIAW 14: 1st Place (Easy Mode)2013 Most Promising Project2013 Best RPG Maker User (Programming)2013 Project of the YearParticipant - GIAW 11Bronze - GIAW 10
Are you using OriginalWij's Fix Picture script? Depending on which comes first in the script list, Wij's might be over-writing the changes made by MA's script as they both alias the 'update' method in 'Sprite_Picture'. If at all possible, just use MA's script ... it has more options and does exactly the same thing as Wij's, just in a different way (without the [FIXED] in the graphic).

UPDATED 05-29-14


IS YOUR PROJECT OPTIMIZED?
UPDATED 07/04/15 - v2.5

RPG MAKER TOOLBOX
UPDATED 07/04/15 - v1.5

***
Rep:
Level 84
---> LOL <---
I would but I am running into this problem I thought this script could help me fix.

I have a "above map" that uses [FIXED] - so yes to your are you using question, but its for an upstairs:



and I wanted to make that whole area up their - where the book cases are - walk able while keeping it "above the players" I thought this script could fix that issue, kind of layer two of them, one above, and then one where the players could walk on it....

apparently not...

*
Rep:
Level 82
GIAW 14: 1st Place (Easy Mode)2013 Most Promising Project2013 Best RPG Maker User (Programming)2013 Project of the YearParticipant - GIAW 11Bronze - GIAW 10
I think it might work ... you could have MA's script handle that all. Maybe have an event on the stairs set the upper area as 'below players' when the player walks up them and then when they walk down them, have it set the area as 'above player'.

UPDATED 05-29-14


IS YOUR PROJECT OPTIMIZED?
UPDATED 07/04/15 - v2.5

RPG MAKER TOOLBOX
UPDATED 07/04/15 - v1.5

*
Rep:
Level 73
Artista
2012 Best RPG Maker User (Graphical)2012 Best Artist2011 Best RPG Maker User (Graphical)Winner - 2011 Summer Project of the Season
You could also just event it.

A touch event at the top of the stairs and at the bottom of the stairs can flip between two pictures - one with the upper floor, the other without.  :)
My current project:

***
Rep:
Level 84
---> LOL <---
I like that Idea Lunarea!!!

How ever I want both the scripts - as that's too many maps to go through and change - so How can we make the both compatible?

or can I do this with the current script I have? I feel like we should move this conversation....
« Last Edit: July 27, 2011, 03:53:21 AM by Adrien. »

*
Rep:
Level 82
GIAW 14: 1st Place (Easy Mode)2013 Most Promising Project2013 Best RPG Maker User (Programming)2013 Project of the YearParticipant - GIAW 11Bronze - GIAW 10
Mm, maybe put MA's script lower than Wij's ... that might work, but I don't know for sure.

UPDATED 05-29-14


IS YOUR PROJECT OPTIMIZED?
UPDATED 07/04/15 - v2.5

RPG MAKER TOOLBOX
UPDATED 07/04/15 - v1.5

***
Rep:
Level 84
---> LOL <---
it didn't >_< if MA"s was done through determing which picture based on the number assigned to that picture, and then made compatible I would deff use it. alas I may have to put a man infront of those stairs and be like no you cannot pass

*
Rep:
Level 82
GIAW 14: 1st Place (Easy Mode)2013 Most Promising Project2013 Best RPG Maker User (Programming)2013 Project of the YearParticipant - GIAW 11Bronze - GIAW 10
Have you tried taking the [FIXED] text out of the file name? That should allow for MA's script to take over in that instance ... I think.

UPDATED 05-29-14


IS YOUR PROJECT OPTIMIZED?
UPDATED 07/04/15 - v2.5

RPG MAKER TOOLBOX
UPDATED 07/04/15 - v1.5

***
Rep:
Level 84
---> LOL <---
again it would be very compliated and I have multiple pictures in some instances - even pictures that move. Its ok I will just block off the second story

*
Rep:
Level 82
GIAW 14: 1st Place (Easy Mode)2013 Most Promising Project2013 Best RPG Maker User (Programming)2013 Project of the YearParticipant - GIAW 11Bronze - GIAW 10
No, I don't mean remove the [FIXED] text from all of your files ... just the one that you're using in that instance.

UPDATED 05-29-14


IS YOUR PROJECT OPTIMIZED?
UPDATED 07/04/15 - v2.5

RPG MAKER TOOLBOX
UPDATED 07/04/15 - v1.5

***
Rep:
Level 84
---> LOL <---
ya i tried that - scripts are incompatible

**
Rep: +0/-0Level 68
RMRK Junior
do you want to make me a demo ? :lol:
tq before

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Umm, sure. When I find the time. Which may not be for a long time.

As for the OriginalWij incompatibility, link me to that script and I will write a conversion patch for it so that your previous work won't be lost by the switch.
« Last Edit: July 28, 2011, 05:18:38 PM by modern algebra »

**
Rep:
Level 84

 This script is pretty amazing. and it does wonders for overlay mapping. Still, I'm running into a bit of a problem.

I apologize if it's been asked before, but is there any way to have the pictures affected by screen-tint events? Whenever screen-tints come into play, the pictures remain the same colour they were before. Any help on this guys?

 Thanks!

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Well, as long as the Z variable is set to anything <=300 and not 0 (since that is default) then it will inherit the screen's tone. Since anything above 200 should be above every default thing (as far as I know, setting the Z variable to anything between 201 and 299 should do what you want.

*
Rep:
Level 73
Artista
2012 Best RPG Maker User (Graphical)2012 Best Artist2011 Best RPG Maker User (Graphical)Winner - 2011 Summer Project of the Season
I, personally, just use another semi-transparent picture for tint. You can preview the color quickly in a screenshot or parallax map. Not only is it easier to get the specific color quickly, but you can vary opacity to add more realism. Things like lighter sections near lamps and deeper shadows in dark areas on night-time maps are pretty neat.
My current project: