Gabriel Posted October 19, 2006 Share Posted October 19, 2006 MinimappaDescrizioneUno script che permette di avere una rappresentazione in miniatura dello schermo,con tanto di pg rappresentato come un puntino colorato(ovviamente il punto si muove se il pg si sposta).Autoremarkusmks (translation by Mr. DJ)4. Istruzioni per l'usoInnanzitutto,dobbiamo creare delle minimappe.Come facciamo? Usando alt+stamp,ovviamente.Scegliamo la grandezza della minimappa usando i vari zoom che rpgmaker ci mette a disposizione e disabilitiamo l'opzione Dim Other Layer( se attivata fa diventare trasparenti gli altri strati).Adesso prendiamo il nostro screen...Fatto? Bene.Adesso chiamate la minimappa come volete,ma ricordatevi che deve essere in .png,anche se sarebbe meglio catalogarla(map 01,map 02 ecc...).A quel punto dovete creare una nuova cartella in pictures,e chiamarla Minimaps,e inserire le mappe al suo interno.Adesso che abbiamo le mappe,bisogna assegnarle alle corrispettive del gioco.Per farlo,create un evento in inizio automatico,e scrivete in call script: #============================================================================== #MiniMapScript #------------------------------------------------------------------------------ # Translation by: Mr. DJ # Request by: KHORN # Made by: 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 # ---------------------------OPTIONEN------------------------- # Modus 1 = Name of the map as: "mapname.png" # Vb: "Dungeon.png" # Modus 2 = Id as the name as "mapID.png" # Vb: "1.png" # Modus 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 #============================================================================== # â–¦nbsp; 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 Con la mia lama fenderò le tenebre e con il mio scudo proteggerò i deboli Link to comment Share on other sites More sharing options...
Lord Bel Posted October 20, 2006 Share Posted October 20, 2006 Carino, anche se io ho risolto in altra maniera :O Devo dire che questa era più semplice, ma con molto meno effetto XD Made by: markusmksRicordati per la prossima volta di scriverlo sia nel sottotitolo del topic sia all'inizio del tuo post. ~ R²S ~ - '°•o Realizing Random Scrips o•°' Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now