# tag maps with <minimap> to make your party take on a different look while
# on that map! you'll need to provide "_Mini" versions of your character
# sprites, for example if you have a character in spritesheet "Actor1",
# then this script will look to "Actor1_Mini" for the mini version.
#
# see line 58 for some extra options.
#
# by Ben(telk) http://benmakesgames.com
# huge thanks to Quasi for helping out!

class Game_Actor
#--------------------------------------------------------------------------
# * Initialize Graphics
#--------------------------------------------------------------------------
def init_graphics
@character_name = actor.character_name
@character_index = actor.character_index
@face_name = actor.face_name
@face_index = actor.face_index
# above is the normal init_graphics

# this is the addition for the script:
@true_character_name = @character_name
@true_character_index = @character_index
@mini = false
end

#--------------------------------------------------------------------------
# * Change Graphics
#--------------------------------------------------------------------------
def set_graphic(character_name, character_index, face_name, face_index)

# okay: if the character ISN'T mini, we change their graphic...
if !@mini
@character_name = character_name
@character_index = character_index
end

# ... regardless, we always change their "true" graphic.
@true_character_name = character_name
@true_character_index = character_index

# normal code
@face_name = face_name
@face_index = face_index
end

# custom method: if we call mini!(true), then we change the
# character graphics to be our custom mini graphic. if we call
# mini!(false), then we set the character graphics to their
# "true" graphics.
def mini!(mini)
if mini

# each character has their own mini version:
@character_name = @true_character_name + "_Mini"

# comment out the above line, and uncomment the next two, to make party
# members all use the SAME mini sprite (rename "$minimap player"
# to match the name of the sprite sheet you will actually use!)

#@character_name = "$minimap player"
#@character_index = 0

else
@character_name = @true_character_name
@character_index = @true_character_index
end

$game_player.refresh

@mini = mini
end

end

class Scene_Map
#--------------------------------------------------------------------------
# * Player Transfer Processing
#--------------------------------------------------------------------------
def perform_transfer
pre_transfer
$game_player.perform_transfer

# inserted this line, to handle entering/leaving minimaps
do_minimap_transformation

post_transfer
end

# minimap handler
# we call mini! on each party member, passing true when the map
# is a mini map, and false when it's not
def do_minimap_transformation
$game_party.members.each { |x|
x.mini!($game_map.minimap?)
}
end

end

class Game_Map
#--------------------------------------------------------------------------
# * Setup
#--------------------------------------------------------------------------
def setup(map_id)
@map_id = map_id
@map = load_data(sprintf("Data/Map%03d.rvdata2", @map_id))
@tileset_id = @map.tileset_id
@display_x = 0
@display_y = 0
referesh_vehicles
setup_events
setup_scroll
setup_parallax
setup_battleback
@need_refresh = false
# normal code above

# addition for this script:
if @map.note.match(/<minimap>/i).nil?
@minimap = false
else
@minimap = true
end
end

# added method to check minimap status; used by Scene_Map
def minimap?
@minimap
end

end