MiniMap Script
Version: 1.7
IntroductionA simple minimap script, this one shows the whole map instead of just a part, but I wouldn't recommend it with large maps(you'll see why later)
Features No graphics needed for player or NPC's, the indicators are drawn by the script.
3 different ways to have the minimap made
Control what color the dots are for every individual event
Screenshots(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi92.photobucket.com%2Falbums%2Fl14%2Fitalianstal1ion%2Fminimap1.jpg&hash=3e63e398fda44cd16f8dc29a244bd137c78f10cf)
Demohttp://savefile.com/files/452326 (http://savefile.com/files/452326)
*I realize savefile isn't very efficient, but this script isn't all too hard to do*
Script[spoiler="script"]
#==============================================================================
# MiniMapScript
#------------------------------------------------------------------------------
# Translation credit: Mr. DJ
# Stolen by : KHORN, markusmks
#==============================================================================
class MiniMapScript < Window_Base
attr_accessor :modus
#--------------------------------------------------------------------------
# ? Initialize
#--------------------------------------------------------------------------
def initialize(mapname=nil)
super(0, 0, 200, 67)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.color = normal_color
self.contents.font.name = "Arial"
self.contents.font.size = 20
self.windowskin = nil
# ---------------------------OPTION-------------------------
# Mode 1 = Name of the map as: "mapname.png"
# Vb: "Dungeon.png"
# Mode 2 = Id as the name as "mapID.png"
# Vb: "1.png"
# Mode 3 = $name_minim[MapID] = "Screen" / screenone ".png"
# in Modus 3 you save all the images in /pictures/MiniMaps and asign them to the map with call script
#============================================================
@modus = 3
# ------------------------------------------------------------
@mapname = mapname
if @modus == 1
real_map = $game_map.name
elsif @modus == 2
real_map = $game_map.map_id.to_s
elsif @modus == 3
real_map = $name_minim[$game_map.map_id]
end
@real_map = real_map
if FileTest.exist?("Graphics/Pictures/MiniMaps/"+real_map+".png")
@mapname = real_map
end
if @mapname != nil
#--<Colors>-- Will be the colors of the player and NPC, but do not change these! see below
player_color = Color.new(0,0,0)
npc_color = Color.new(255,0,0)
#----MAP------------------------#
@player_color=player_color
@npc_color=npc_color
@gra_dir = "Graphics/Pictures/MiniMaps/"
@mmap = @gra_dir+@mapname+".png"
map = Bitmap.new(@mmap)
@map_sprite = Sprite.new
@map_sprite.bitmap = map
@map_sprite.x = 0
@map_sprite.y = 0
@map_sprite.opacity = 180
@map_sprite.zoom_x = 0.98
@map_sprite.zoom_y = 0.98
#------PLAYER------------#
@player_sprite = Sprite.new
@player_sprite.bitmap = Bitmap.new(3,3)
@player_sprite.bitmap.fill_rect(0,0,3,3,@player_color) #you can change these
@event_sprite = []
for i in $game_map.events.keys.sort
if ($game_map.events[i].is_a?(Game_Event) and $game_map.events[i].list!=nil and $game_map.events[i].list[0].code == 108 and $game_map.events[i].list[0].parameters == ["mm_point"])
@event_sprite[i] = Sprite.new
@event_sprite[i].bitmap = Bitmap.new(3,3)
if $game_map.events[i].list[1].parameters[0] != nil
colors = $game_map.events[i].list[1].parameters[0].split
red = colors[0].to_i
green = colors[1].to_i
blue = colors[2].to_i
@npc_color = Color.new(red,green,blue)
else
@npc_color = Color.new(255,0,0)
end
@event_sprite[i].bitmap.fill_rect(0,0,3,3,@npc_color)
end
end
refresh
end
end
#--------------------------------------------------------------------------
# ? Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if @event_sprite == []
renew
end
if FileTest.exist?("Graphics/Pictures/MiniMaps/"+@real_map+".png")
@mapname = @real_map
else
@mapname = nil
end
if @mapname != nil
for i in $game_map.events.keys.sort
if ($game_map.events[i].is_a?(Game_Event) and $game_map.events[i].list!=nil and $game_map.events[i].list[0].code == 108 and $game_map.events[i].list[0].parameters == ["mm_point"])
if @event_sprite == []
renew
return
end
@event_sprite[i].x = $game_map.events[i].real_x/16
@event_sprite[i].y = $game_map.events[i].real_y/16
@event_sprite[i].opacity = 255
@event_sprite[i].zoom_x = 1
@event_sprite[i].zoom_y = 1
end
i += 1
end
#----PLAYER MOVE---------#
@player_sprite.x = $game_player.real_x/16
@player_sprite.y = $game_player.real_y/16
@player_sprite.opacity = 255
@player_sprite.zoom_x = 1
@player_sprite.zoom_y = 1
#----------------------------#
end
end
#--------------------------------------------------------------------------
# ? Renew Graphics
#--------------------------------------------------------------------------
def renew
dispose
if @modus == 1
real_map = $game_map.name
elsif @modus == 2
real_map = $game_map.map_id.to_s
elsif @modus == 3
real_map = $name_minim[$game_map.map_id]
end
@real_map = real_map
if FileTest.exist?("Graphics/Pictures/MiniMaps/"+@real_map+".png")
@mapname = real_map
end
@gra_dir = "Graphics/Pictures/MiniMaps/"
@mmap = @gra_dir+@mapname+".png"
map = Bitmap.new(@mmap)
@map_sprite = Sprite.new
@map_sprite.bitmap = map
@map_sprite.x = 0
@map_sprite.y = 0
@map_sprite.opacity = 180
@map_sprite.zoom_x = 0.98
@map_sprite.zoom_y = 0.98
@player_sprite = Sprite.new
@player_sprite.bitmap = Bitmap.new(3,3) #you can change these
@player_sprite.bitmap.fill_rect(0,0,3,3,@player_color=Color.new(0,0,0)) #you can change these
@event_sprite = []
for i in $game_map.events.keys.sort
if ($game_map.events[i].is_a?(Game_Event) and $game_map.events[i].list!=nil and $game_map.events[i].list[0].code == 108 and $game_map.events[i].list[0].parameters == ["mm_point"])
@event_sprite[i] = Sprite.new
@event_sprite[i].bitmap = Bitmap.new(3,3)
if $game_map.events[i].list[1].parameters[0] != nil
colors = $game_map.events[i].list[1].parameters[0].split
red = colors[0].to_i
green = colors[1].to_i
blue = colors[2].to_i
@npc_color = Color.new(red,green,blue)
else
@npc_color = Color.new(255,0,0)
end
@event_sprite[i].bitmap.fill_rect(0,0,3,3,@npc_color) #you can change these
end
end
end
#--------------------------------------------------------------------------
# ? Update
#--------------------------------------------------------------------------
def update
if @modus == 3 and $name_minim[$game_map.map_id] != ""
renew
end
refresh
end
#--------------------------------------------------------------------------
# ? Dispose all
#--------------------------------------------------------------------------
def dispose
if @event_sprite != nil
for sprite in @event_sprite
if sprite != nil
sprite.dispose
end
end
end
if @player_sprite != nil
@player_sprite.dispose
end
if @map_sprite != nil
@map_sprite.dispose
end
end
end
#==============================================================================
# ? Game_MiniMap
#------------------------------------------------------------------------------
# © i dont know
#==============================================================================
class Game_MiniMap
#--------------------------------------------------------------------------
# ? Initialize
#--------------------------------------------------------------------------
def initialize
@data = []
end
#--------------------------------------------------------------------------
# ? Map ID
# variable_id : Map ID
#--------------------------------------------------------------------------
def [](variable_id)
if variable_id <= 5000 and @data[variable_id] != nil
return @data[variable_id]
else
return ""
end
end
#--------------------------------------------------------------------------
# ? MiniMap Screen declared here
# variable_id : Map ID
# value : Screen Name
#--------------------------------------------------------------------------
def []=(variable_id, value)
if variable_id <= 5000
@data[variable_id] = value
end
end
end
# ==================== Read this =======================================
#
# As i cannot alias, please read this!!
# To make sure the data of the minimaps is saved,
# Copy the text between the edits, to the corresponding place in:
# Scene_Title, Scene_Load, Scene_Save
# After you did that...
# ...Delete all the codes below
# so they wont work here ^^... Mr. DJ
#
# ==================================================================
class Scene_Title
def command_new_game
$game_system.se_play($data_system.decision_se)
Audio.bgm_stop
Graphics.frame_count = 0
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
# EDIT -------------------------------
$name_minim = Game_MiniMap.new
# ------------------------------------
$game_party.setup_starting_members
$game_map.setup($data_system.start_map_id)
$game_player.moveto($data_system.start_x, $data_system.start_y)
$game_player.refresh
$game_map.autoplay
$game_map.update
$scene = Scene_Map.new
end
end
class Scene_Save
def write_save_data(file)
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)
$game_system.save_count += 1
$game_system.magic_number = $data_system.magic_number
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
# EDIT ------------------------
Marshal.dump($name_minim, file)
# -----------------------------
end
end
class Scene_Load
def read_save_data(file)
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
# EDIT ---------------------------------
$name_minim = Marshal.load(file)
# --------------------------------------
if $game_system.magic_number != $data_system.magic_number
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
$game_party.refresh
end
end[/spoiler]
And replace Scene_Map with this:
[spoiler=Script]
#==============================================================================
# ? Show Map .name
#------------------------------------------------------------------------------
# ?shows map name
#==============================================================================
class Game_Map
def name
$map_infos[@map_id]
end
end
class Scene_Title
$map_infos = load_data("Data/MapInfos.rxdata")
for key in $map_infos.keys
$map_infos[key] = $map_infos[key].name
end
end
#==============================================================================
# ? Scene_Map
#------------------------------------------------------------------------------
# ?einige edits für minimap, von markusmks
# 1) line 1-18
# 2) line 43
# 3) line 65
# 4) line 85-89
# 5) line 304-305
#
# Diese Codes in schon editierte Scene_Maps einfügen, oder wenn man nichts
# editiert hat, einfach Scene_Map ersetzen
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# ? ?????
#--------------------------------------------------------------------------
def main
@spriteset = Spriteset_Map.new
@message_window = Window_Message.new
@mini_map = MiniMapScript.new
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@spriteset.dispose
@message_window.dispose
@mini_map.dispose
if $scene.is_a?(Scene_Title)
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
loop do
$game_map.update
$game_system.map_interpreter.update
$game_player.update
if @mini_map != nil
@mini_map.update
else
@mini_map = MiniMapScript.new
end
$game_system.update
$game_screen.update
unless $game_temp.player_transferring
break
end
transfer_player
if $game_temp.transition_processing
break
end
end
@spriteset.update
@message_window.update
if $game_temp.gameover
$scene = Scene_Gameover.new
return
end
if $game_temp.to_title
$scene = Scene_Title.new
return
end
if $game_temp.transition_processing
$game_temp.transition_processing = false
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
if $game_temp.message_window_showing
return
end
if $game_player.encounter_count == 0 and $game_map.encounter_list != []
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
n = rand($game_map.encounter_list.size)
troop_id = $game_map.encounter_list[n]
if $data_troops[troop_id] != nil
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end
end
if Input.trigger?(Input::B)
unless $game_system.map_interpreter.running? or
$game_system.menu_disabled
$game_temp.menu_calling = true
$game_temp.menu_beep = true
end
end
if $DEBUG and Input.press?(Input::F9)
$game_temp.debug_calling = true
end
unless $game_player.moving?
if $game_temp.battle_calling
call_battle
elsif $game_temp.shop_calling
call_shop
elsif $game_temp.name_calling
call_name
elsif $game_temp.menu_calling
call_menu
elsif $game_temp.save_calling
call_save
elsif $game_temp.debug_calling
call_debug
end
end
end
#--------------------------------------------------------------------------
# ? ????????
#--------------------------------------------------------------------------
def call_battle
$game_temp.battle_calling = false
$game_temp.menu_calling = false
$game_temp.menu_beep = false
$game_player.make_encounter_count
$game_temp.map_bgm = $game_system.playing_bgm
$game_system.bgm_stop
$game_system.se_play($data_system.battle_start_se)
$game_system.bgm_play($game_system.battle_bgm)
$game_player.straighten
$scene = Scene_Battle.new
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def call_shop
$game_temp.shop_calling = false
$game_player.straighten
$scene = Scene_Shop.new
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def call_name
$game_temp.name_calling = false
$game_player.straighten
$scene = Scene_Name.new
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def call_menu
$game_temp.menu_calling = false
if $game_temp.menu_beep
$game_system.se_play($data_system.decision_se)
$game_temp.menu_beep = false
end
$game_player.straighten
$scene = Scene_Menu.new
end
#--------------------------------------------------------------------------
# ? ????????
#--------------------------------------------------------------------------
def call_save
$game_player.straighten
$scene = Scene_Save.new
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def call_debug
$game_temp.debug_calling = false
$game_system.se_play($data_system.decision_se)
$game_player.straighten
$scene = Scene_Debug.new
end
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
def transfer_player
$game_temp.player_transferring = false
if $game_map.map_id != $game_temp.player_new_map_id
$game_map.setup($game_temp.player_new_map_id)
end
$game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
case $game_temp.player_new_direction
when 2
$game_player.turn_down
when 4
$game_player.turn_left
when 6
$game_player.turn_right
when 8
$game_player.turn_up
end
$game_player.straighten
$game_map.update
@spriteset.dispose
@spriteset = Spriteset_Map.new
@mini_map.dispose
@mini_map = MiniMapScript.new
if $game_temp.transition_processing
$game_temp.transition_processing = false
Graphics.transition(20)
end
$game_map.autoplay
Graphics.frame_reset
Input.update
end
end
[/spoiler]
ORAdd this in Scene_Map:
Under @message_window = Window_Message.new add
@mini_map = MiniMapScript.new
Under
$game_map.update
$game_system.map_interpreter.update
$game_player.update
Add
if @mini_map != nil
@mini_map.update
else
@mini_map = MiniMapScript.new
end
Finally under @spriteset = Spriteset_Map.new (make sure its near the end) add
@mini_map.dispose
@mini_map = MiniMapScript.new
InstructionsFor the mode pre-chosen on the script(mode 3), you must make a folder INSIDE your pictures folder, and name it Minimaps. Inside place pictures of about 160x120 (they can be bigger or smaller, but it will take more/less room on the screen. This is why its not very good for really large maps).
After you have done that, you must call the maps to their pictures by events. Once the event has happened, you can erase it or whatever.
Lets say you wanted your first map to have the picture you set in the Minimaps folder to have the picture of Map_01, well call it by event like this:
$name_minim[1] = "map_01"
The [1] is the map number and the "map_01" is the picture you set it to.
Now for events. For default color(red) just put a comment in the event saying just mm_point. BUT if you want to customize the color for the event, make a comment for the event saying:
mm_point
30 30 200
Where 30 30 and 200 are the colors (set in RGB of course)
Now for Mode 1 (that last was Mode 3, what the script is by default)
Pretty simple, if your map name is Dungeon, place a picture called Dungeon in the minimaps folder.
And Mode 2; You name the PNGs what the mapID is. So for map01 in your game, the png would be called 1.
If anyone has any trouble following these instructions on modes or anything just ask.
FAQNothing yet.
CompatibilityTested with SDK, and will not work with it. It's a small fix, but because the minimap is drawn in Scene_Map, and SDK rewrites it, then the minimap is not drawn. So either put the Scene_Map edit below SDK or just add the minimap lines in the SDK's Scene_Map part. Untested, but should work.
Credits and ThanksMade by Markusmks. I barely did anything but post it here:p
Hi, sorry to bother you but i dont get how to work it? what kind of picture do you use what events? Im a noob so I would need a more in detailed instructions.
put it above main in the script databse. press F11 in the software.
Yeh, i know that but it doesnt do anything and my character cant move. Im confused about this.
Just press the PrtSc (Print Screen) button on your keyboard(when u have the map u want to take a pic of), open up paint and go to edit - paste. Then cut and move the picture to wherever you need.
Lol, first I thought the minimap is being created like the map, but then I read that you need images. It's a nice script, though. :)
I got an error it sayed " Script 'Window_Menu*' line 137: TypeError occured. Cannot convert nil into String." what does that mean? ???
uhh I know this really is erelevent. (sp ) but your chest...it should have a lock facing tab clicked. Other wise when actived at the back it will open and say "Locked saftly " Other wise this is rather good . though I am curious. Is it possible to have a larger map say and have it scroll? all the demo maps are about 20x15 size so what would happened if you had a map that was 50 x 20? well Obvessly you would walk on untill you hit the other side. But since the map is a screen shot. is it possible to have it scroll with you? and have it the same size so all the maps are universal?
when this has reached Version 2.5 or highr please let me know >.> I am rather interested to use this for my game XD
No, the minimap wont scroll. It's just a picture that will show event dots and your dot. It doesnt matter what the map size is. There are other minimaps that have scroll..