Gmaker Ocasional
Número de Mensagens : 41 Idade : 30 Localização : Patos-PB Pontos : Créditos : Advertências : Data de inscrição : 24/04/2008
| Assunto: Nome do Mapa Sex Abr 25, 2008 10:18 pm | |
| Esse script serve para mostrar o nome do mapa quando vc é teletransportado para ele.
O nome do mapa é exibido num pop-up sempre que se teletransportar.
Pode-se excluir os mapas no módulo "Map_Name_Popup". Ainda há a possibilidade das áreas. - Código:
-
#============================================================================== # ** Map Name Popup #------------------------------------------------------------------------------ # © Dargor, 2008 # 06/03/08 # Version 1.0 #------------------------------------------------------------------------------ # VERSION HISTORY: # - 1.0 (06/03/08), Initial release # - 1.1 (19/03/08), Added support for areas #------------------------------------------------------------------------------ # INSTRUCTIONS: # - Paste this above main # - Edit the Exclude_Maps array in the Map_Name_Popup module # - Edit the Exclude_Areass array in the Map_Name_Popup module #==============================================================================
#============================================================================== # ** Map Name Popup Configuration #==============================================================================
module Map_Name_Popup # These maps will not popup the name window Exclude_Maps = [2,3] # These areas will not popup the name window Exclude_Areas = [1,4] end
#============================================================================== # ** RPG::Area #------------------------------------------------------------------------------ # Data class for areas. #==============================================================================
class RPG::Area #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :show_name #-------------------------------------------------------------------------- # * Alias Listing #-------------------------------------------------------------------------- alias dargor_vx_area_initialize initialize #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize dargor_vx_area_initialize @show_name = false end end
#============================================================================== # ** Game_Player #------------------------------------------------------------------------------ # This class handles maps. It includes event starting determinants and map # scrolling functions. The instance of this class is referenced by $game_map. #==============================================================================
class Game_Player < Game_Character #-------------------------------------------------------------------------- # * Area ID #-------------------------------------------------------------------------- def area_id for area in $data_areas.values return area.id if in_area?(area) end end end
#============================================================================== # ** Game_Map #------------------------------------------------------------------------------ # This class handles maps. It includes scrolling and passage determination # functions. The instance of this class is referenced by $game_map. #==============================================================================
class Game_Map #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :show_name #-------------------------------------------------------------------------- # Alias Listing #-------------------------------------------------------------------------- alias dargor_map_name_window_setup setup #-------------------------------------------------------------------------- # * Setup # map_id : map ID #-------------------------------------------------------------------------- def setup(map_id) dargor_map_name_window_setup(map_id) @show_name = true end #-------------------------------------------------------------------------- # * Get Map ID #-------------------------------------------------------------------------- def name map_infos = load_data("Data/MapInfos.rvdata") name = map_infos[@map_id].name name.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name } return name end end
#============================================================================== # ** Spriteset_Map #------------------------------------------------------------------------------ # This class brings together map screen sprites, tilemaps, etc. It's used # within the Scene_Map class. #==============================================================================
class Spriteset_Map #-------------------------------------------------------------------------- # Alias Listing #-------------------------------------------------------------------------- alias dargor_spriteset_name_window_initialize initialize alias dargor_spriteset_name_window_update update alias dargor_spriteset_name_window_dispose dispose #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize create_windows dargor_spriteset_name_window_initialize update end #-------------------------------------------------------------------------- # * Create Windows #-------------------------------------------------------------------------- def create_windows @map_name_window = Window_MapName.new @area_name_window = Window_MapName.new if $game_map.show_name @map_name_window.show_name($game_map.name, 128) end end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update dargor_spriteset_name_window_update @map_name_window.update @area_name_window.update for area in $data_areas.values if $game_player.in_area?(area) and area.show_name return if Map_Name_Popup::Exclude_Areas.include?(area.id) @area_name_window.show_name(area.name, 128, true) area.show_name = false else area.show_name = true unless $game_player.in_area?(area) end end end #-------------------------------------------------------------------------- # * Dispose #-------------------------------------------------------------------------- def dispose dargor_spriteset_name_window_dispose @map_name_window.dispose @area_name_window.dispose end end
#============================================================================== # ** Window_MapName #------------------------------------------------------------------------------ # This window shows the map name when the player is transfered. #==============================================================================
class Window_MapName < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(name="", count=128) super(0, 0, 544, 64) self.visible = false self.openness = 0 @name = name @count = count @in_area = false end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh #return unless $game_map.display_name self.visible = true self.contents.clear self.contents.font.color = normal_color align = @in_area ? 0 : 1 self.contents.draw_text(0,0,504,32,@name,align) gw = contents.text_size(@name).width gc1 = Color.new(255,255,255) gc2 = Color.new(0,0,0,0) self.contents.gradient_fill_rect(0, WLH, gw, 2, gc1, gc2) if @in_area $game_map.show_name = false end #-------------------------------------------------------------------------- # * Show Name #-------------------------------------------------------------------------- def show_name(name=@name, count=@count, in_area=false) return if Map_Name_Popup::Exclude_Maps.include?($game_map.map_id) @name = name @count = count @in_area = in_area if @in_area self.openness = 255 self.opacity = 0 self.contents_opacity = 0 self.y = 352 else self.openness = 0 self.opacity = 255 self.contents_opacity = 255 self.y = 0 end refresh end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super unless $scene.is_a?(Scene_Map) self.visible = false return end if self.visible if @count == 0 if @in_area self.contents_opacity -= 24 self.visible = false if self.contents_opacity == 0 return else self.openness -= 24 self.visible = false if self.openness == 0 return end end if @in_area self.contents_opacity += 24 else self.openness += 24 end @count -= 1 end end end
Espero ter ajudado. (nun fui eu q fiz) | |
|
levi Administrador
Número de Mensagens : 57 Idade : 30 Localização : Patos-PB Pontos : Créditos : Advertências : Data de inscrição : 11/12/2007
| Assunto: Re: Nome do Mapa Seg Abr 28, 2008 1:20 pm | |
| Ótimo script! Mais um crédito adicionado! ^^ | |
|