[RGSS3] - Conflict between scripts

Hello everybody.


I have two precious custom scripts, in my project: Seer UK & OriginalWij's Fixed Pictures and Woratana's Pictures Below Characters. The former allows me to use pictures as parallaxes displayed over the default tiles, while the latter, given a range of pictures by ID, will put those pictures under characters and above tiles. The problem is that, when the map is too big to fit in the screen all at one time, the pictures whose ID is in the range choosen for Woratana's Pictures Below Characters won't be displayed until the origin of the pictures (the coordinates you select on dysplay image command) will be visible in game. 


So far, I tried to put Woratana's script below Seer UK and OriginalWij's one, but the game freezes on opening returning an error in Woratana's script, so here is my question: could you help me find a way to make theese two scripts work finely together? Thank you in advance 🙂
 


P.S.: the scripts are in the spoilers.

Spoiler
#===============================================================
# ● [VXAce] ◦ Pictures under Characters ◦ □
# * Show pictures under characters on map but above map tiles *
#--------------------------------------------------------------
# ◦ by Woratana [[email hidden]]
# ◦ Thaiware RPG Maker Community
# ◦ Released on: 22/02/2009
# ◦ Version: 1.0
#
# This works but not compatible with the other scripts
# Credits: Woratana, bug fixes by SuppaYami and Kread-Ex.
#--------------------------------------------------------------
# ◦ Update:
#--------------------------------------------------------------
# □ Version 1.0 (22/02/2009)
# - Unlimited numbers of picture under characters
#
#--------------------------------------------------------------
# ◦ Compatibility:
#--------------------------------------------------------------
# □ This script will rewrite 0 method(s):
#
#
# □ This script will alias 2 method(s):
#     Spriteset_Map.create_pictures
#     Sprite_Picture.update
#
# □ This script should work with most scripts
#
#--------------------------------------------------------------
# ◦ Installation:
#--------------------------------------------------------------
# 1) This script should be placed JUST AFTER ▼ Materials.
#
# □ Like this:
# ▼ Materials
# *Pictures under Characters
# ...
# ...
# ▼ Main Process
# Main
#
# 2) Setup this script in Setup Part below.
#
#--------------------------------------------------------------
# ◦ How to use:
#--------------------------------------------------------------
# □ Place this script and setup in the setup part.
#
#=================================================================


class Spriteset_Map


  #=================================================================
  # ++ Setup Part
  #-----------------------------------------------------------------
  FIRST_PICBELOW_ID = 1 # First ID of picture that will show below characters
  LAST_PICBELOW_ID = 1 # Last ID of picture that will show below characters


  #   For example, if you set FIRST to 10 and LAST to 15, picture ID 10-15
  # will show below characters on map.
  #=================================================================


  alias wora_picbelow_sprsetmap_crepic create_pictures


  #--------------------------------------------------------------------------
  # * Create Picture Sprite
  #--------------------------------------------------------------------------
  def update_pictures
    $game_map.screen.pictures.each do |pic|
      case pic.number
      when FIRST_PICBELOW_ID..LAST_PICBELOW_ID
        #puts 'below'
        @picture_sprites[pic.number] ||= Sprite_Picture.new(@viewport1, pic)
      else
        @picture_sprites[pic.number] ||= Sprite_Picture.new(@viewport2, pic)
      end
      @picture_sprites[pic.number].update
      ## Mithran's pic fix code ~Kread
      if pic.name == ""
        $game_map.screen.pictures.remove(pic.number)
        @picture_sprites[pic.number].dispose
        @picture_sprites[pic.number] = nil
      end
    end
  end
end


class Sprite_Picture < Sprite
  alias wora_picbelow_sprpic_upd update


  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update(*args)
    wora_picbelow_sprpic_upd(*args)
    ## Override's Mithran Picture Fix ~Kread
    if @picture.number.between?(Spriteset_Map::FIRST_PICBELOW_ID,
    Spriteset_Map::LAST_PICBELOW_ID)
      self.viewport = MA_FixPicture.send🙂"spriteset_vp#{1}")
      self.z = 50
    end
end
end
 
Spoiler
#==============================================================================
# Fixed Pictures
#==============================================================================
# Author : Seer UK & OriginalWij
# Version : 1.2
#
# Credit: Seer UK
#         OriginalWij (Original RGSS2 Script)
#==============================================================================


#==============================================================================
# To use:
#   put the tag [FIXED] in the affected picture's filename
#==============================================================================


#==============================================================================
# What this does:
#   fixes tagged pictures to the map (scrolls with the map)
#==============================================================================


#==============================================================================
# Sprite_Picture
#==============================================================================


class Sprite_Picture < Sprite
  #----------------------------------------------------------------------------
  # Update                                                              [ MOD ]
  #----------------------------------------------------------------------------
  def update
    update_bitmap
    update_origin
    if @picture.name.include?("[FIXED]")
      self.x = 0 - $game_map.display_x * 32
      self.y = 0 - $game_map.display_y * 32
    else
      update_position
    end
    update_zoom
    update_other
  end
end
... returning an error in Woratana's script ...



That's not really helpful. Saying "an error" is like saying nothing at all.


You should always post the exact error message you get (with the line number) and you should also post the exact line the error points at in the script (due to configuration parts, the specified line can differ for each user). That is how you report bugs/errors/crashes/etc.


Without knowing the error you got, I can tell you that the 2nd script you posted should be removed entirely (the unnecessary overwrite it uses makes it incompatible with many scripts, not to mention that the overwrite even misses a line). Try to use this one instead:

Spoiler
class Sprite_Picture < Sprite

alias fix_pos8825 update_position
def update_position
if @picture.name.include?("[FIXED]")
self.x = 0 - $game_map.display_x * 32
self.y = 0 - $game_map.display_y * 32
self.z = @picture.number
else
fix_pos8825
end
end

end

This won't overwrite anything, but does the same as the one you used before.


Seeing the first script posted, I am sure that that one is NOT a standalone script, because there is no MA_FixPicture class/method in the default engine. So, you might need to install the required script before you can use that one. That method name is most probably from Modern Algebra, and I remember that he wrote a fixed picture script too, so maybe that is the required script.


And indeed Modern Algebra wrote a script like that: http://rmrk.net/index.php?topic=44837.0


I am surprised that Woratana didn't even mention Modern Algebra in his script... Maybe the version you posted is a modified version...


In any case, you should use Modern Algebra's Fixed Pictures script with that Woratana script you posted. That combo should work, in theory.


Ohh, and read the discussion in that topic I linked. There are some bugfixes discussed there as well.
@Sixth 
Sorry for the lack of information. I tried the linked script and now everything works. Thank you so much 😀

Original thread: https://forums.rpgmakerweb.com/threads/rgss3-conflict-between-scripts.63872/