Minimap opacity when walking behind

Hi everybody! So I'm finally picking my project back up after several years. I've been pretty much handling everything ok but I've gotten to a point where I need some assistance. I'm using Azraven Minimap script (DL in 2015 so I'm not sure where I got it) which works as intended, however I want to modify the script so it fades when walking behind it like Falcao Pearl ABS skillbar (also being used in my game). Below is my translated and slightly modified version of the script and I can send the demo I got it from if necessary. (Cross posted on rpgmakercentral.com)

Spoiler
Ruby:
#==============================================================================#
#                          **Azraven Minimap**                                 #
#------------------------------------------------------------------------------#
#  ** Author: Azraven                                                          #
#  ** Version: 1.5b                                                            #
#  ** Date: 12/24/2012                                                         #
#------------------------------------------------------------------------------#
#  - Description:                                                              #
#     This script adds a mini circular map to the game.                        #
#  - Usage:                                                                    #
#     Paste this script in the "Additional Scripts" section.                   #
#------------------------------------------------------------------------------#
#  - Historic                                                                  #
#     12/24/2012 - Start and end of version 1.0b                               #
#     04/03/2013 - Version 1.5b Bug fixes and addition of new functions.       #
#                * Fixed a bug where it did not correctly check for            #
#                  of certain tiles.                                           #
#                * Fixed a bug where grass (bush) tiles were                   #
#                  presented as blocking.                                      #
#                * Fixed a bug where blocking tiles placed                     #
#                  over grass tiles were represented as passable.              #
#                * Improved code.                                              #
#                + Added the function to show vehicles.                        #
#                + Added the function to show followers.                       #
#                + Added the function to use Region IDs for                    #
#                  hide passable areas.                                        #
#     06/14/2014 * Bug related to "Delete Temporary Event" command             #
#                  adjusted.                                                   #
#                * Clean up the code.                                          #
#                                                                              #
#==============================================================================#
# I used Google translate to translate this from Portuguese into English so I  #
# could understand how to use this script in may game.    ~brujah236           #
#==============================================================================#
module Azraven
  module MiniMap
    #--------------------------------------------------------------------------#
    # SETTINGS                                                                 #
    #--------------------------------------------------------------------------#
    #Minimap tile size, recommended not to use values smaller than 3.
    TileSize = 8
    #--------------------------------------------------------------------------#
    #Adjusting the centering of the mini map, depending on the tile size.
    MapOffset = -4
    #--------------------------------------------------------------------------#
    #Defines the player's color on the map.
    PlayerColor = Color.new(255,0,0)
    #--------------------------------------------------------------------------#
    #Show followers.
    ShowFollowers = true
    #--------------------------------------------------------------------------#
    #Defines the color of followers on the map.
    FollowerColor = Color.new(0,128,255)
    #--------------------------------------------------------------------------#
    #Define whether to show vehicles on the map.
    ShowVehicles = true
    #--------------------------------------------------------------------------#
    #Defines the color of the boat.
    BoatColor = Color.new(255,0,255)
    #--------------------------------------------------------------------------#
    #Defines the ship's color.
    ShipColor = Color.new(255,0,255)
    #--------------------------------------------------------------------------#
    #Defines the color of the aircraft.
    AirshipColor = Color.new(255,0,255)
    #--------------------------------------------------------------------------#
    #Defines the color of objects shown on the map.
    #Objects are NPCs, doors, teleports, chests and whatever else the user can
    #to imagine.
    #To add a new object use the following syntax inside the {}:
    # "tag" => Color.new(R,G,B,A)
    #Where tag is the comment that will be added to that event.
    #Separate each object by "," without the quotes.
    ObjectColor = {"npc" => Color.new(0,255,0),
                  "teleport" => Color.new(150,50,50),
                  "chest" => Color.new(100,100,100),
                  "enemy" => Color.new(255,48,48)}
    #--------------------------------------------------------------------------#
    #Defines the outline color of objects and player.
    BorderColor = Color.new(0,0,0)
    #--------------------------------------------------------------------------#
    #Opacity of objects shown on the map.
    ObjectLayerOpacity = 255
    #--------------------------------------------------------------------------#
    # Position of the map on the screen.
    #1 = Top left corner.
    #2 = Top right corner.
    #3 = Bottom left corner.
    #4 = Top right corner.
  
    #additional options added by me
    #5 = Left middle.
    #6 = Right middle.
  
    MiniMapCorner = 5
    #--------------------------------------------------------------------------#
    #Defines whether a particular region will show as locked on the minimap.
    #Useful not to reveal "secret passages".
    UseHideRegion = true
    #--------------------------------------------------------------------------#
    #Id of the region if UseHideRegion is true.
    HideRegionId = 60
    #--------------------------------------------------------------------------#
    #Color of the impassable area of the map.
    MapColor = Color.new(200,150,150)
    #--------------------------------------------------------------------------#
    #Outline color of the impassable area of the map.
    MapBorderColor = Color.new(50,50,50)
    #--------------------------------------------------------------------------#
    #Name of the minimap border image file in the Graphics/System folder.
    BorderName = "Border"
    #--------------------------------------------------------------------------#
    #Defines whether to use a background texture.
    UseBGTexture = true
    #--------------------------------------------------------------------------#
    #Name of the image file of the texture used when
    #minimap background in the Graphics/System folder.
    #Note: The image must be inverted.
    BackTextureName = "OldPaper"
    #--------------------------------------------------------------------------#
    #Background fill color if no texture is used.
    BGColor = Color.new( 100, 100, 100)
    #--------------------------------------------------------------------------#
    #Option to fill the external area of the map with a color.
    ClearOutsideArea = true
    #--------------------------------------------------------------------------#
    #Color used to fill the outer area of the map.
    ClearOutsideColor = Color.new(0,0,0)
    #--------------------------------------------------------------------------#
    #Option to demarcate the limits of the map.
    OutlineMapArea = true
    #--------------------------------------------------------------------------#
    #Color of the demarcation of the limits of the map.
    OutlineMapColor = Color.new(0,0,0)
    #--------------------------------------------------------------------------#
    #Id of the switch that enables/disables the minimap.
    EnableSwitchId = 195
    #--------------------------------------------------------------------------#
    # END OF CONFIGURATION. #
    #--------------------------------------------------------------------------#
    MiniMapCoords = {1 => [0,0,112,112],
                     2 => [Graphics.width - 112,0,112,112],
                     3 => [0,Graphics.height - 112,112,112],
                     4 => [Graphics.width - 112,Graphics.height - 112,112,112],
                     #additional options added by me
                     5 => [0,(Graphics.height/2) - 56,112,112],
                     6 => [Graphics.width - 112,(Graphics.height/2) - 56,112,112]}
     Tile_X = 0
     Tile_Y = 6
  end
end
#==============================================================================#
#  ** Color Class                                                              #
#==============================================================================#
class Color
  #----------------------------------------------------------------------------#
  # * Inverts the color value
  #----------------------------------------------------------------------------#
  def invert
    r = 255 - self.red
    g = 255 - self.green
    b = 255 - self.blue
    a = self.alpha
    self.set(r, g, b, a)
  end
end


#==============================================================================#
#  ** Mini Map Class                                                           #
#==============================================================================#
class MiniMap
 
  include Azraven::MiniMap
 
  def initialize(viewport)
    @viewport = viewport
    @playercolor = PlayerColor.dup.invert
    @followercolor = FollowerColor.dup.invert
    @boatcolor = BoatColor.dup.invert
    @shipcolor = ShipColor.dup.invert
    @airshipcolor = AirshipColor.dup.invert
    @objectcolor = ObjectColor.dup
    @objectcolor.each_pair do |key, value|
      @objectcolor[key] = value.dup.invert
    end
    @bordercolor = BorderColor.dup.invert
    @mapcolor = MapColor.dup.invert
    @mapbordercolor = MapBorderColor.dup.invert
    @clearoutsidecolor = ClearOutsideColor.dup.invert
    @outlinemapcolor = OutlineMapColor.dup.invert
    @on_map = SceneManager.scene_is?(Scene_Map) ###
    refresh
  end
 
  def refresh
    @map_id = $game_map.map_id
    @backmask = Sprite.new(@viewport)
    @backmask.bitmap = Cache::system("Back_96")
    @backmask.x = @backmask.y = 8
    @backtile = Sprite.new(@viewport)
    @backtile.blend_type = 2
    @backtile.z = 1
    @backtile.x = @backtile.y = -100
    @map = Sprite.new(@viewport)
    @map.z = 2
    @map.blend_type = 2
    @object_layer = Sprite.new(@viewport)
    @object_layer.z = 3
    @object_layer.blend_type = 2
    @object_layer.bitmap = Bitmap.new($game_map.width*TileSize + 112,$game_map.height*TileSize + 112)
    @object_layer.opacity = ObjectLayerOpacity
    @border = Sprite.new(@viewport)
    @border.bitmap = Cache::system(BorderName)
    @border.z = 4
    @border.opacity = 255
    @mask = Cache::system("Mask")
    draw_back
    draw_map
  end
 
  def visible?
    $game_switches[EnableSwitchId]
  end
 
  def draw_map
  
    front = make_map_bitmap(@mapcolor)
    border = make_map_bitmap(@mapbordercolor)
  
    result = Bitmap.new($game_map.width*TileSize + 112,
                        $game_map.height*TileSize+ 112)
                      
    result.blt(-1, 0, border, border.rect)
    result.blt(1, 0, border, border.rect)
    result.blt(0, -1, border, border.rect)
    result.blt(0, 1, border, border.rect)
    result.blt(0, 0, front, front.rect)
  
    @mapbitmap = result
  end
 
  def draw_back
    bitmap = Bitmap.new($game_map.width*TileSize+112,
                       $game_map.height*TileSize+112)
    if UseBGTexture
      bit = Cache::system(BackTextureName)
      bitmap.stretch_blt(bitmap.rect, bit, bit.rect)
    else
      bitmap.fill_rect(bitmap.rect, BGColor)
    end
    if ClearOutsideArea
      bitmap.fill_rect(0,0,bitmap.width, 56, @clearoutsidecolor)
      bitmap.fill_rect(0,0,56, bitmap.height, @clearoutsidecolor)
      bitmap.fill_rect(0,bitmap.height-56,bitmap.width, 56, @clearoutsidecolor)
      bitmap.fill_rect(bitmap.width-56,0,56, bitmap.height, @clearoutsidecolor)
    elsif OutlineMapArea
      bitmap.fill_rect(56,55,bitmap.width-112,1,@outlinemapcolor)
      bitmap.fill_rect(55,56,1,bitmap.height-112,@outlinemapcolor)
      bitmap.fill_rect(bitmap.width-56,55,1,bitmap.height-112,@outlinemapcolor)
      bitmap.fill_rect(56,bitmap.height-56,bitmap.width-112,1,@outlinemapcolor)
    end
    @backtilebitmap = bitmap
  end
 
  def draw_object_layer
    for event in $game_map.events.values
      unless event.list.nil?
        for item in event.list
          if item.code == 108 or item.code == 408
            if @objectcolor.has_key?(item.parameters[0])
              draw_object(event.real_x*TileSize+56,
              event.real_y*TileSize+56,
              @objectcolor[item.parameters[0]])
            end
          end
        end
      end
    end
    if ShowFollowers
      unless $game_player.vehicle
        $game_player.followers.each do |follower|
          draw_object(follower.real_x*TileSize+56,
                      follower.real_y*TileSize+56,
                      @followercolor) if follower.visible?
        end
      end
    end
    if ShowVehicles
      unless $game_map.airship.transparent
        draw_object($game_map.airship.real_x*TileSize+56,
                $game_map.airship.real_y*TileSize+56,
                @airshipcolor)
      end
      unless $game_map.ship.transparent
        draw_object($game_map.ship.real_x*TileSize+56,
                $game_map.ship.real_y*TileSize+56,
                @shipcolor)
      end
      unless $game_map.boat.transparent
        draw_object($game_map.boat.real_x*TileSize+56,
                $game_map.boat.real_y*TileSize+56,
                @boatcolor)
      end     
    end
    draw_object($game_player.real_x*TileSize+56,
                $game_player.real_y*TileSize+56,
                @playercolor)
  end
 
  def draw_object(x, y, color)
    @object_layer.bitmap.fill_rect(x, y, TileSize, TileSize, @bordercolor)
    @object_layer.bitmap.fill_rect(x+1, y+1, TileSize-2, TileSize-2, color)
    @object_layer.bitmap.clear_rect(x,y,1,1)
    @object_layer.bitmap.clear_rect(x,y+TileSize-1,1,1)
    @object_layer.bitmap.clear_rect(x+TileSize-1,y,1,1)
    @object_layer.bitmap.clear_rect(x+TileSize-1,y+TileSize-1,1,1)
  end
        
  def make_map_bitmap(color)
    bitmap = Bitmap.new($game_map.width*TileSize + 112,
                       $game_map.height*TileSize + 112)
    for x in 0..$game_map.width - 1
      for y in 0..$game_map.height - 1
        if $game_map.airship_land_ok?(x, y) || $game_map.bush?(x, y)
          if UseHideRegion
            bitmap.fill_rect(x*TileSize+56,
                             y*TileSize+56,
                             TileSize, TileSize,
                             color) if $game_map.region_id(x, y) == HideRegionId
          else
             next               
          end
          if $game_map.bush?(x, y)
            unless $game_map.passable?(x, y, 4)
               bitmap.fill_rect(x*TileSize+56, y*TileSize+56, TileSize, TileSize, color)
            end
          end
          next
        end
        bitmap.fill_rect(x*TileSize+56, y*TileSize+56, TileSize, TileSize, color)
      end
    end
    bitmap
  end
 
  def update_object_layer
   @object_layer.bitmap.clear
   draw_object_layer
  end
 
  def dispose
    @backmask.dispose
    @backtile.dispose
    @map.dispose
    @object_layer.dispose
    @border.dispose
  end
 
  def update
    if @map_id != $game_map.map_id
      dispose
      @map_id = $game_map.map_id
      refresh
    end
    @backmask.visible = visible?
    @backtile.visible = visible?
    @map.visible = visible?
    @object_layer.visible = visible?
    @border.visible = visible?
    if visible?
      @map.bitmap = @mapbitmap.dup
      @backtile.bitmap = @backtilebitmap.dup
      sx = $game_player.real_x * (TileSize * -1) + MapOffset
      sy = $game_player.real_y * (TileSize * -1) + MapOffset
      update_object_layer
      @map.x = @backtile.x = @object_layer.x = sx
      @map.y = @backtile.y = @object_layer.y = sy
      @backtile.bitmap.blt(sx*-1, sy*-1,@mask,@mask.rect)
      @map.bitmap.blt(sx*-1, sy*-1,@mask,@mask.rect)
      @object_layer.bitmap.blt(sx*-1, sy*-1,@mask,@mask.rect)
#~     update_minimap_fade ###
    end
  end
 
=begin
  # fade effect when player is behind the minimap
  def update_minimap_fade
    if behind_minimap?
      if self.opacity >= 60
        self.opacity -= 10
        @backmask.opacity = @backtile.opacity = @map.opacity = @object_layer.opacity = @border.opacity = self.opacity
      end
    elsif self.opacity != 255
      self.opacity += 10
      @backmask.opacity = @backtile.opacity = @map.opacity = @object_layer.opacity = @border.opacity = self.opacity
    end
  end
 
  def behind_minimap?
    return false unless @on_map
    px = ($game_player.screen_x / 32).to_i
    py = ($game_player.screen_y / 32).to_i
    9.times.each {|x| return true if px == Tile_X + x and py == Tile_Y}
    return false
  end
=end

end
#==============================================================================#
#  ** Classe Spriteset_Map                                                     #
#==============================================================================#
class Spriteset_Map
 
  alias azraven_mini_map_init initialize
  alias azraven_mini_map_updt update
  alias azraven_mini_map_disp dispose
 
  include Azraven::MiniMap
 
  def initialize
    create_minimap
    azraven_mini_map_init
  end
 
  def create_minimap
    viewport = Viewport.new(Graphics.width - 112,0,112,112)
    viewport.rect.set(MiniMapCoords[MiniMapCorner][0],
                      MiniMapCoords[MiniMapCorner][1],
                      MiniMapCoords[MiniMapCorner][2],
                      MiniMapCoords[MiniMapCorner][3])
    viewport.z = 1 #500
    @minimapa = MiniMap.new(viewport)
  end
 
  def dispose
    azraven_mini_map_disp
    @minimapa.dispose
  end
 
  def update
    azraven_mini_map_updt
    @minimapa.update
  end
end
#==============================================================================#
#  ** Fim do Script                                                            #
#==============================================================================#
Moved to: Script Support

I also fixed your spoiler tag. It is SPOILER, not ISPOILER
I need some assistance
Thanks for the addon feature
Spoiler: AZraven Minimap
Ruby:
#==============================================================================#
#                          **Azraven Minimap**                                 #
#------------------------------------------------------------------------------#
#  ** Author: Azraven                                                          #
#  ** Version: 1.5b                                                            #
#  ** Date: 12/24/2012                                                         #
#------------------------------------------------------------------------------#
#  - Description:                                                              #
#     This script adds a mini circular map to the game.                        #
#  - Usage:                                                                    #
#     Paste this script in the "Additional Scripts" section.                   #
#------------------------------------------------------------------------------#
#  - Historic                                                                  #
#     12/24/2012 - Start and end of version 1.0b                               #
#     04/03/2013 - Version 1.5b Bug fixes and addition of new functions.       #
#                * Fixed a bug where it did not correctly check for            #
#                  of certain tiles.                                           #
#                * Fixed a bug where grass (bush) tiles were                   #
#                  presented as blocking.                                      #
#                * Fixed a bug where blocking tiles placed                     #
#                  over grass tiles were represented as passable.              #
#                * Improved code.                                              #
#                + Added the function to show vehicles.                        #
#                + Added the function to show followers.                       #
#                + Added the function to use Region IDs for                    #
#                  hide passable areas.                                        #
#     06/14/2014 * Bug related to "Delete Temporary Event" command             #
#                  adjusted.                                                   #
#                * Clean up the code.                                          #
#                                                                              #
#==============================================================================#
# I used Google translate to translate this from Portuguese into English so I  #
# could understand how to use this script in may game.    ~brujah236           #
#==============================================================================#
module Azraven
  module MiniMap
    #--------------------------------------------------------------------------#
    # SETTINGS                                                                 #
    #--------------------------------------------------------------------------#
    #Minimap tile size, recommended not to use values smaller than 3.
    TileSize = 8
    #--------------------------------------------------------------------------#
    #Adjusting the centering of the mini map, depending on the tile size.
    MapOffset = -4
    #--------------------------------------------------------------------------#
    #Defines the player's color on the map.
    PlayerColor = Color.new(255,0,0)
    #--------------------------------------------------------------------------#
    #Show followers.
    ShowFollowers = true
    #--------------------------------------------------------------------------#
    #Defines the color of followers on the map.
    FollowerColor = Color.new(0,128,255)
    #--------------------------------------------------------------------------#
    #Define whether to show vehicles on the map.
    ShowVehicles = true
    #--------------------------------------------------------------------------#
    #Defines the color of the boat.
    BoatColor = Color.new(255,0,255)
    #--------------------------------------------------------------------------#
    #Defines the ship's color.
    ShipColor = Color.new(255,0,255)
    #--------------------------------------------------------------------------#
    #Defines the color of the aircraft.
    AirshipColor = Color.new(255,0,255)
    #--------------------------------------------------------------------------#
    #Defines the color of objects shown on the map.
    #Objects are NPCs, doors, teleports, chests and whatever else the user can
    #to imagine.
    #To add a new object use the following syntax inside the {}:
    # "tag" => Color.new(R,G,B,A)
    #Where tag is the comment that will be added to that event.
    #Separate each object by "," without the quotes.
    ObjectColor = {"npc" => Color.new(0,255,0),
                  "teleport" => Color.new(150,50,50),
                  "chest" => Color.new(100,100,100),
                  "enemy" => Color.new(255,48,48)}
    #--------------------------------------------------------------------------#
    #Defines the outline color of objects and player.
    BorderColor = Color.new(0,0,0)
    #--------------------------------------------------------------------------#
    #Opacity of objects shown on the map.
    ObjectLayerOpacity = 255
    #--------------------------------------------------------------------------#
    # Position of the map on the screen.
    #1 = Top left corner.
    #2 = Top right corner.
    #3 = Bottom left corner.
    #4 = Top right corner.
 
    #additional options added by me
    #5 = Left middle.
    #6 = Right middle.
 
    MiniMapCorner = 5
    #--------------------------------------------------------------------------#
    #Defines whether a particular region will show as locked on the minimap.
    #Useful not to reveal "secret passages".
    UseHideRegion = true
    #--------------------------------------------------------------------------#
    #Id of the region if UseHideRegion is true.
    HideRegionId = 60
    #--------------------------------------------------------------------------#
    #Color of the impassable area of the map.
    MapColor = Color.new(200,150,150)
    #--------------------------------------------------------------------------#
    #Outline color of the impassable area of the map.
    MapBorderColor = Color.new(50,50,50)
    #--------------------------------------------------------------------------#
    #Name of the minimap border image file in the Graphics/System folder.
    BorderName = "Border"
    #--------------------------------------------------------------------------#
    #Defines whether to use a background texture.
    UseBGTexture = true
    #--------------------------------------------------------------------------#
    #Name of the image file of the texture used when
    #minimap background in the Graphics/System folder.
    #Note: The image must be inverted.
    BackTextureName = "OldPaper"
    #--------------------------------------------------------------------------#
    #Background fill color if no texture is used.
    BGColor = Color.new( 100, 100, 100)
    #--------------------------------------------------------------------------#
    #Option to fill the external area of the map with a color.
    ClearOutsideArea = true
    #--------------------------------------------------------------------------#
    #Color used to fill the outer area of the map.
    ClearOutsideColor = Color.new(0,0,0)
    #--------------------------------------------------------------------------#
    #Option to demarcate the limits of the map.
    OutlineMapArea = true
    #--------------------------------------------------------------------------#
    #Color of the demarcation of the limits of the map.
    OutlineMapColor = Color.new(0,0,0)
    #--------------------------------------------------------------------------#
    #Id of the switch that enables/disables the minimap.
    EnableSwitchId = 1
    #--------------------------------------------------------------------------#
    # END OF CONFIGURATION. #
    #--------------------------------------------------------------------------#
    MiniMapCoords = {1 => [0,0,112,112],
                     2 => [Graphics.width - 112,0,112,112],
                     3 => [0,Graphics.height - 112,112,112],
                     4 => [Graphics.width - 112,Graphics.height - 112,112,112],
                     #additional options added by me
                     5 => [0,(Graphics.height/2) - 56,112,112],
                     6 => [Graphics.width - 112,(Graphics.height/2) - 56,112,112]}
     Tile_X = 0
     Tile_Y = 6
  end
end
#==============================================================================#
#  ** Color Class                                                              #
#==============================================================================#
class Color
  #----------------------------------------------------------------------------#
  # * Inverts the color value
  #----------------------------------------------------------------------------#
  def invert
    r = 255 - self.red
    g = 255 - self.green
    b = 255 - self.blue
    a = self.alpha
    self.set(r, g, b, a)
  end
end


#==============================================================================#
#  ** Mini Map Class                                                           #
#==============================================================================#
class MiniMap
 
  include Azraven::MiniMap
 
  def initialize(viewport)
    @viewport = viewport
    @playercolor = PlayerColor.dup.invert
    @followercolor = FollowerColor.dup.invert
    @boatcolor = BoatColor.dup.invert
    @shipcolor = ShipColor.dup.invert
    @airshipcolor = AirshipColor.dup.invert
    @objectcolor = ObjectColor.dup
    @objectcolor.each_pair do |key, value|
      @objectcolor[key] = value.dup.invert
    end
    @bordercolor = BorderColor.dup.invert
    @mapcolor = MapColor.dup.invert
    @mapbordercolor = MapBorderColor.dup.invert
    @clearoutsidecolor = ClearOutsideColor.dup.invert
    @outlinemapcolor = OutlineMapColor.dup.invert
    @on_map = SceneManager.scene_is?(Scene_Map) ###
    refresh
  end
 
  def refresh
    @map_id = $game_map.map_id
    @backmask = Sprite.new(@viewport)
    @backmask.bitmap = Cache::system("Back_96")
    @backmask.x = @backmask.y = 8
    @backtile = Sprite.new(@viewport)
    @backtile.blend_type = 2
    @backtile.z = 1
    @backtile.x = @backtile.y = -100
    @map = Sprite.new(@viewport)
    @map.z = 2
    @map.blend_type = 2
    @object_layer = Sprite.new(@viewport)
    @object_layer.z = 3
    @object_layer.blend_type = 2
    @object_layer.bitmap = Bitmap.new($game_map.width*TileSize + 112,$game_map.height*TileSize + 112)
    @object_layer.opacity = ObjectLayerOpacity
    @border = Sprite.new(@viewport)
    @border.bitmap = Cache::system(BorderName)
    @border.z = 4
    @border.opacity = 255
    @mask = Cache::system("Mask")
    draw_back
    draw_map
  end
 
  def visible?
    $game_switches[EnableSwitchId]
  end
 
  def draw_map
 
    front = make_map_bitmap(@mapcolor)
    border = make_map_bitmap(@mapbordercolor)
 
    result = Bitmap.new($game_map.width*TileSize + 112,
                        $game_map.height*TileSize+ 112)
                      
    result.blt(-1, 0, border, border.rect)
    result.blt(1, 0, border, border.rect)
    result.blt(0, -1, border, border.rect)
    result.blt(0, 1, border, border.rect)
    result.blt(0, 0, front, front.rect)
 
    @mapbitmap = result
  end
 
  def draw_back
    bitmap = Bitmap.new($game_map.width*TileSize+112,
                       $game_map.height*TileSize+112)
    if UseBGTexture
      bit = Cache::system(BackTextureName)
      bitmap.stretch_blt(bitmap.rect, bit, bit.rect)
    else
      bitmap.fill_rect(bitmap.rect, BGColor)
    end
    if ClearOutsideArea
      bitmap.fill_rect(0,0,bitmap.width, 56, @clearoutsidecolor)
      bitmap.fill_rect(0,0,56, bitmap.height, @clearoutsidecolor)
      bitmap.fill_rect(0,bitmap.height-56,bitmap.width, 56, @clearoutsidecolor)
      bitmap.fill_rect(bitmap.width-56,0,56, bitmap.height, @clearoutsidecolor)
    elsif OutlineMapArea
      bitmap.fill_rect(56,55,bitmap.width-112,1,@outlinemapcolor)
      bitmap.fill_rect(55,56,1,bitmap.height-112,@outlinemapcolor)
      bitmap.fill_rect(bitmap.width-56,55,1,bitmap.height-112,@outlinemapcolor)
      bitmap.fill_rect(56,bitmap.height-56,bitmap.width-112,1,@outlinemapcolor)
    end
    @backtilebitmap = bitmap
  end
 
  def draw_object_layer
    for event in $game_map.events.values
      unless event.list.nil?
        for item in event.list
          if item.code == 108 or item.code == 408
            if @objectcolor.has_key?(item.parameters[0])
              draw_object(event.real_x*TileSize+56,
              event.real_y*TileSize+56,
              @objectcolor[item.parameters[0]])
            end
          end
        end
      end
    end
    if ShowFollowers
      unless $game_player.vehicle
        $game_player.followers.each do |follower|
          draw_object(follower.real_x*TileSize+56,
                      follower.real_y*TileSize+56,
                      @followercolor) if follower.visible?
        end
      end
    end
    if ShowVehicles
      unless $game_map.airship.transparent
        draw_object($game_map.airship.real_x*TileSize+56,
                $game_map.airship.real_y*TileSize+56,
                @airshipcolor)
      end
      unless $game_map.ship.transparent
        draw_object($game_map.ship.real_x*TileSize+56,
                $game_map.ship.real_y*TileSize+56,
                @shipcolor)
      end
      unless $game_map.boat.transparent
        draw_object($game_map.boat.real_x*TileSize+56,
                $game_map.boat.real_y*TileSize+56,
                @boatcolor)
      end     
    end
    draw_object($game_player.real_x*TileSize+56,
                $game_player.real_y*TileSize+56,
                @playercolor)
  end
 
  def draw_object(x, y, color)
    @object_layer.bitmap.fill_rect(x, y, TileSize, TileSize, @bordercolor)
    @object_layer.bitmap.fill_rect(x+1, y+1, TileSize-2, TileSize-2, color)
    @object_layer.bitmap.clear_rect(x,y,1,1)
    @object_layer.bitmap.clear_rect(x,y+TileSize-1,1,1)
    @object_layer.bitmap.clear_rect(x+TileSize-1,y,1,1)
    @object_layer.bitmap.clear_rect(x+TileSize-1,y+TileSize-1,1,1)
  end
        
  def make_map_bitmap(color)
    bitmap = Bitmap.new($game_map.width*TileSize + 112,
                       $game_map.height*TileSize + 112)
    for x in 0..$game_map.width - 1
      for y in 0..$game_map.height - 1
        if $game_map.airship_land_ok?(x, y) || $game_map.bush?(x, y)
          if UseHideRegion
            bitmap.fill_rect(x*TileSize+56,
                             y*TileSize+56,
                             TileSize, TileSize,
                             color) if $game_map.region_id(x, y) == HideRegionId
          else
             next               
          end
          if $game_map.bush?(x, y)
            unless $game_map.passable?(x, y, 4)
               bitmap.fill_rect(x*TileSize+56, y*TileSize+56, TileSize, TileSize, color)
            end
          end
          next
        end
        bitmap.fill_rect(x*TileSize+56, y*TileSize+56, TileSize, TileSize, color)
      end
    end
    bitmap
  end
 
  def update_object_layer
   @object_layer.bitmap.clear
   draw_object_layer
  end
 
  def dispose
    @backmask.dispose
    @backtile.dispose
    @map.dispose
    @object_layer.dispose
    @border.dispose
  end
 
  def update
    if @map_id != $game_map.map_id
      dispose
      @map_id = $game_map.map_id
      refresh
    end
    @backmask.visible = visible?
    @backtile.visible = visible?
    @map.visible = visible?
    @object_layer.visible = visible?
    @border.visible = visible?
    if visible?
      @map.bitmap = @mapbitmap.dup
      @backtile.bitmap = @backtilebitmap.dup
      sx = $game_player.real_x * (TileSize * -1) + MapOffset
      sy = $game_player.real_y * (TileSize * -1) + MapOffset
      update_object_layer
      @map.x = @backtile.x = @object_layer.x = sx
      @map.y = @backtile.y = @object_layer.y = sy
      @backtile.bitmap.blt(sx*-1, sy*-1,@mask,@mask.rect)
      @map.bitmap.blt(sx*-1, sy*-1,@mask,@mask.rect)
      @object_layer.bitmap.blt(sx*-1, sy*-1,@mask,@mask.rect)
      update_minimap_fade ###
    end
  end
 
  # fade effect when player is behind the minimap
  def update_minimap_fade
    if behind_minimap?
      if @map.opacity >= 60
        @map.opacity -= 10
        @backmask.opacity = @backtile.opacity = @object_layer.opacity = @border.opacity = @map.opacity
      end
    elsif @map.opacity != 255
      @map.opacity += 10
      @backmask.opacity = @backtile.opacity = @object_layer.opacity = @border.opacity = @map.opacity
    end
  end
 
  def behind_minimap?
    return false unless @on_map
    px = ($game_player.screen_x).to_i
    py = ($game_player.screen_y).to_i
    x = MiniMapCoords[MiniMapCorner][0]
    y = MiniMapCoords[MiniMapCorner][1]
    w = MiniMapCoords[MiniMapCorner][2]
    h = MiniMapCoords[MiniMapCorner][3]
    return true if ((px > (x - 10)) && (px < (x + w + 10))) && ((py > (y - 10)) && (py < (y + h + 35)))
    return false
  end

end
#==============================================================================#
#  ** Classe Spriteset_Map                                                     #
#==============================================================================#
class Spriteset_Map
 
  alias azraven_mini_map_init initialize
  alias azraven_mini_map_updt update
  alias azraven_mini_map_disp dispose
 
  include Azraven::MiniMap
 
  def initialize
    create_minimap
    azraven_mini_map_init
  end
 
  def create_minimap
    viewport = Viewport.new(Graphics.width - 112,0,112,112)
    viewport.rect.set(MiniMapCoords[MiniMapCorner][0],
                      MiniMapCoords[MiniMapCorner][1],
                      MiniMapCoords[MiniMapCorner][2],
                      MiniMapCoords[MiniMapCorner][3])
    viewport.z = 500
    @minimapa = MiniMap.new(viewport)
  end
 
  def dispose
    azraven_mini_map_disp
    @minimapa.dispose
  end
 
  def update
    azraven_mini_map_updt
    @minimapa.update
  end
end
#==============================================================================#
#  ** Fim do Script                                                            #
#==============================================================================#
Thanks for the addon feature
Thanks a ton! It works PERFECTLY! You will be credited if I ever release it. (Video below on dev map in my game and I intend on changing the graphics of the minimap)

So I've realized there's a quite a few more features that I'd like to implement with the Minimap to make it more robust.
  1. I'm using Hime's tile swap script and can't seem to figure out how to reload the bitmap to show the updated tiles (see pictures). The Minimap loads once per map however the events change depending on comment tag per page. I've tried MiniMap.refresh and MiniMap.update but both yield a no method error crash.
  2. I'm using TheoAllen fog of war script (spoiler below) that I would like to extend onto the Minimap. I have an idea of how it would work but no clue how to script it (the map looks funky to me without the fog).
  3. Enable map scrolling
  4. Player/follower transparency (red dot on Minimap is player)
Screenshot 2022-10-18 142622.png
Screenshot 2022-10-18 142653.png


Spoiler
Ruby:
#===============================================================================
# TheoAllen - Fog of War
# Requested by : Zero0018
# Last edited : 15.01.2015
#-------------------------------------------------------------------------------
# How to use :
# Put the script below materials but above main
# No external resource is required
#
#------------------------------------------------------------------------------
# ** MAP NOTETAG :
#------------------------------------------------------------------------------
# To show fog in map, simply put <fog> in map note
# To hide fog in map, simply put <no fog> in map note
#
# Set the default of showing fog in configuration
#
#------------------------------------------------------------------------------
# ** SCRIPT CALL :
#------------------------------------------------------------------------------
#
# $game_map.reveal_tiles(x, y)
# $game_map.reveal_tiles(x, y, distance)
# Will reveal tiles in x,y within the distance. If distance is ommited, it will
# be same as the VisiRange in script setting
#
# $game_map.events[event_id].reveal_tiles
# $game_map.events[event_id].reveal_tiles(distance)
# Will reveal tiles from the event location within the distance. If distance is
# ommited, it will be same as the VisiRange in script setting
#
#-------------------------------------------------------------------------------
# Configuration
#===============================================================================
module Theo
 
  VisiRange   = 2
# Visibility range of the character. Larger value, longer distance

  FogOpacity  = 255
# Fog opacity. Set 255 for full opacity.

  DefaultFog  = true
# If set to true, every map will has fog. Unless you put <no fog>
# If set to false, every map will has no fog. Unless you put <fog>

end
#===============================================================================
# End of config
#===============================================================================

#===============================================================================
# ** Bitmap
#===============================================================================

class Bitmap
 
  # Fill entire bitmap with color
  def entire_fill(color = Color.new(0,0,0,150))
    fill_rect(self.rect,color)
  end
 
end

#===============================================================================
# ** Fog of War
#===============================================================================

class Fog_of_War < Plane
  @@bitmap_cache = {}
  #----------------------------------------------------------------------------
  # * Initialize
  #----------------------------------------------------------------------------
  def initialize(vport)
    super(vport)
    @id = -1
  end
 
  #----------------------------------------------------------------------------
  # * Update
  #----------------------------------------------------------------------------
  def update
    if $game_map
      if @id != $game_map.map_id
        @id = $game_map.map_id
        @width = $game_map.width
        @height = $game_map.height
        update_bitmap
      end
      self.ox = $game_map.display_x * 32
      self.oy = $game_map.display_y * 32
      self.visible = !$game_map.no_fog?
    end
  end
 
  #----------------------------------------------------------------------------
  # * Update bitmap
  #----------------------------------------------------------------------------
  def update_bitmap
    bmp = @@bitmap_cache[@id]
    unless bmp && !bmp.disposed?
      bmp = Bitmap.new(@width * 32, @height * 32)
      @@bitmap_cache[@id] = bmp
    end
    self.bitmap = bmp
    return if $game_map.no_fog?
    bitmap.entire_fill(Color.new(0,0,0,Theo::FogOpacity))
    reveal_tiles($game_system.revealed_tiles)
    reveal_tiles($game_player.reveal_tiles)
  end
 
  #----------------------------------------------------------------------------
  # * Reveal Tiles
  #----------------------------------------------------------------------------
  def reveal_tiles(tiles)
    tiles.each do |pos|
      x = pos.x * 32
      y = pos.y * 32
      bitmap.clear_rect(x,y,32,32)
    end unless disposed?
  end
 
end

#===============================================================================
# ** Game_System
#===============================================================================

class Game_System
  #----------------------------------------------------------------------------
  # * Revealed tiles
  #----------------------------------------------------------------------------
  def revealed_tiles
    @revealed_map ||= {}
    @revealed_map[$game_map.map_id] ||= []
    @revealed_map[$game_map.map_id]
  end
 
  #----------------------------------------------------------------------------
  # * Revealed tiles =
  #----------------------------------------------------------------------------
  def revealed_tiles=(t)
    @revealed_map ||= {}
    @revealed_map[$game_map.map_id] = t
  end
 
end

#===============================================================================
# ** Revealed Node
#===============================================================================

class Revealed_Node
  #----------------------------------------------------------------------------
  # * Public attributes
  #----------------------------------------------------------------------------
  attr_accessor :parent  
  attr_accessor :visited
  attr_accessor :x
  attr_accessor :y
  attr_reader :expanded
  attr_reader :nodes
 
  #----------------------------------------------------------------------------
  # * Initialize
  #----------------------------------------------------------------------------
  def initialize(x,y)
    @x ,@y = x, y
    @nodes = {}
    @visited = false
    @expanded = false
  end
 
  #----------------------------------------------------------------------------
  # * Expand node
  #----------------------------------------------------------------------------
  def expand_node(mapnodes, char)
    dir = [2,4,6,8]
    dir.each do |d|
      xpos = $game_map.round_x_with_direction(@x, d)
      ypos = $game_map.round_y_with_direction(@y, d)
      key = [xpos, ypos]
      next_node = mapnodes[key]
      if next_node.nil?
        next_node = Revealed_Node.new(xpos, ypos)
        mapnodes[key] = next_node
      elsif next_node.visited
        next
      end
      next_node.parent = self
      self.nodes[d] = next_node
    end
    @expanded = true
  end
 
  #----------------------------------------------------------------------------
  # * Get Parent Direction
  #----------------------------------------------------------------------------
  def get_parent_dir
    parent.nodes.index(self)
  end

end

#===============================================================================
# ** Game_Map
#===============================================================================

class Game_Map
  #----------------------------------------------------------------------------
  # * No fog?
  #----------------------------------------------------------------------------
  def no_fog?
    return false unless @map
    return true if @map.note[/<no[\s_]+fog>/i]
    return false if @map.note[/<fog>/i]
    return !Theo::DefaultFog
  end
  #----------------------------------------------------------------------------
  # * Reveal tiles
  #----------------------------------------------------------------------------
  def reveal_tiles(x, y, distance = Theo::VisiRange, reveal = true)
    return if no_fog?
    # Initialize
    @revealed_nodes = {}
    @max_distance = distance - 1
    @init_x = x
    @init_y = y
   
    # Make first node to check
    first_node = Revealed_Node.new(x, y)
    first_node.expand_node(@revealed_nodes, self)
    first_node.visited = true
    @revealed_nodes[[x, y]] = first_node
    @reveal_queue = []
    @reveal_queue.push(first_node)
   
    # spread search using BFS
    until @reveal_queue.empty?
      spread_search(@reveal_queue.shift)
    end
   
    node_to_reveal = @revealed_nodes.values - $game_system.revealed_tiles
    sprset = SceneManager.scene.spriteset
    sprset.fogofwar.reveal_tiles(node_to_reveal) if sprset
    $game_system.revealed_tiles += @revealed_nodes.values
  end
 
  #----------------------------------------------------------------------------
  # * Spread search
  #----------------------------------------------------------------------------
  def spread_search(node)
    dir = [2,4,6,8]
    dir.shuffle.each do |d|
      next_node = node.nodes[d]
      next unless next_node
      next if next_node.visited
      next if get_distance(next_node) > @max_distance
      next_node.expand_node(@revealed_nodes, self) unless next_node.expanded
      next_node.visited = true
      @reveal_queue.push(next_node, node)
    end
  end
 
  #----------------------------------------------------------------------------
  # * Get distance
  #----------------------------------------------------------------------------
  def get_distance(node)
    range_x = node.x - @init_x
    range_y = node.y - @init_y
    result =  Math.sqrt((range_x**2) + (range_y**2))
    return result
  end
 
end
#===============================================================================
# ** Game_Character
#===============================================================================
class Game_Character
  #----------------------------------------------------------------------------
  # * Reveal tiles
  #----------------------------------------------------------------------------
  def reveal_tiles(distance = Theo::VisiRange)
    $game_map.reveal_tiles(x, y, distance)
  end
 
end

#===============================================================================
# ** Game_Player
#===============================================================================
class Game_Player
  #----------------------------------------------------------------------------
  # * Increase step
  #----------------------------------------------------------------------------
  alias theo_fogofwar_increase_steps increase_steps
  def increase_steps
    theo_fogofwar_increase_steps
    reveal_tiles
  end
 
end

#===============================================================================
# ** Spriteset_Map
#===============================================================================

class Spriteset_Map
  #----------------------------------------------------------------------------
  # * Attribute Reader
  #----------------------------------------------------------------------------
  attr_reader :fogofwar
 
  #----------------------------------------------------------------------------
  # * Create viewports (alias)
  #----------------------------------------------------------------------------
  alias theo_fogofwar_create_viewports create_viewports
  def create_viewports
    theo_fogofwar_create_viewports
    create_fogofwar
  end
 
  #----------------------------------------------------------------------------
  # * Create fog of war
  #----------------------------------------------------------------------------
  def create_fogofwar
    @fogofwar = Fog_of_War.new(@viewport1)
    @fogofwar.z = 210
  end
 
  #----------------------------------------------------------------------------
  # * Update (alias)
  #----------------------------------------------------------------------------
  alias theo_fogofwar_update update
  def update
    theo_fogofwar_update
    @fogofwar.update
  end
 
  #----------------------------------------------------------------------------
  # * Dispose (alias)
  #----------------------------------------------------------------------------
  alias theo_fogofwar_dispose dispose
  def dispose
    theo_fogofwar_dispose
    @fogofwar.dispose
  end
 
end

#===============================================================================
# ** Scene_Base
#===============================================================================

class Scene_Base
  attr_reader :spriteset
end
I'm using Hime's tile swap script and can't seem to figure out how to reload the bitmap to show the updated tiles (see pictures). The Minimap loads once per map however the events change depending on comment tag per page. I've tried MiniMap.refresh and MiniMap.update but both yield a no method error crash.
Ruby:
class Spriteset_Map
  def redraw_map
    @minimapa.dispose
    create_minimap
  end
end

class Scene_Map < Scene_Base
  alias r2_minimap_scene_update   update
  def update
    r2_minimap_scene_update
    @spriteset.redraw_map if $game_switches[3] == true
    $game_switches[3] = false if $game_switches[3] == true
  end
end
change the switch number to what you want.

I'm using TheoAllen fog of war script (spoiler below) that I would like to extend onto the Minimap. I have an idea of how it would work but no clue how to script it (the map looks funky to me without the fog)
No idea, I use Kamesoft Minimap and the etude87 addon which does what you want. But doesn't look as nice.

Enable map scrolling
Have the map move when you move the screen?
It's designed to stay focused on the player.

Player/follower transparency (red dot on Minimap is player)
I don't understand this one.
Ruby:
class Spriteset_Map
  def redraw_map
    @minimapa.dispose
    create_minimap
  end
end

class Scene_Map < Scene_Base
  alias r2_minimap_scene_update   update
  def update
    r2_minimap_scene_update
    @spriteset.redraw_map if $game_switches[3] == true
    $game_switches[3] = false if $game_switches[3] == true
  end
end
change the switch number to what you want.
Awesome! Would I be able to call this via script call as well? Something like Spriteset_Map.redraw_map?

No idea, I use Kamesoft Minimap and the etude87 addon which does what you want. But doesn't look as nice.
No worries, hopefully I'll find an answer.

Have the map move when you move the screen?
It's designed to stay focused on the player.
Makes sense.

I don't understand this one.
Essentially turn off the Minimap dot when the player is invisible.
Would I be able to call this via script call as well? Something like Spriteset_Map.redraw_map?
No, Script calls work in Game_Interpreter. You can make reference to a Game_Data such as $game_map but the spriteset is created from Scene_Map.
To affect this we would need to make another method and then we would have a way to call it from scene_map to affect the spriteset.
Ruby:
class Scene_Map < Scene_Base
  def redraw_map
    @spriteset.redraw_map
  end
end

# use script call
# SceneManager.scene.redraw_map
But it must be called when you are on the map, not in battle or the menu or whatever.

Essentially turn off the Minimap dot when the player is invisible.
Make a change to the code.
line 306
Ruby:
    draw_object($game_player.real_x*TileSize+56,
                $game_player.real_y*TileSize+56,
                @playercolor) if !$game_player.transparent
No, Script calls work in Game_Interpreter. You can make reference to a Game_Data such as $game_map but the spriteset is created from Scene_Map.
To affect this we would need to make another method and then we would have a way to call it from scene_map to affect the spriteset.
Ruby:
class Scene_Map < Scene_Base
  def redraw_map
    @spriteset.redraw_map
  end
end

# use script call
# SceneManager.scene.redraw_map
But it must be called when you are on the map, not in battle or the menu or whatever.
Thanks! This works beautifully.
Make a change to the code.
line 306
Ruby:
    draw_object($game_player.real_x*TileSize+56,
                $game_player.real_y*TileSize+56,
                @playercolor) if !$game_player.transparent
Wow, that was easy! I should have been able to see that... each of the vehicle options has
Ruby:
 unless $game_map.vehicle_type_here.transparent

Have the map move when you move the screen?
It's designed to stay focused on the player.
Now that I'm able to make the player transparent I don't need to worry about this anymore. Turn off player visibility then move them... simple!

No idea, I use Kamesoft Minimap and the etude87 addon which does what you want. But doesn't look as nice.
I've decided to go a different route with this. I'm going to have the player "find a map" that would remove the fog and display the Minimap.

I figured out how to show passability on non-passable tiles. In one map I have the floor as "Canal" (Dungeon_A1 A15). The Minimap shows it as non-passable, even though you obviously can, unless you add the "bush" flag.

Original thread: https://forums.rpgmakerweb.com/threads/minimap-opacity-when-walking-behind.151819/