luistop12Miér Dic 05, 2012 7:32 pm
SUPER MODERADOR
este script te permite mostrar el nombre de el lugar en el que estas en el mapa
¿lo puedo esconder?
sip, simplemente pone llamar evento
hide_location_name [para esconder]
show_location_name [para mostrar]
CREDITOS:POKETHOUSE
¿lo puedo esconder?
sip, simplemente pone llamar evento
hide_location_name [para esconder]
show_location_name [para mostrar]
- Código:
#===============================================================================
#
# Shanghai Simple Script - Location Name
# Last Date Updated: 2010.05.21
# Level: Easy
#
# This places a small window in the upper left corner of the map screen to show
# the name of the current location. The location name window will also hide if
# the player's screen position is directly under the location name window.
# This will also update to the area's name if the player is inside of an area.
#===============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials but above ▼ Main. Remember to save.
#
# These commands go into the script call event.
# hide_location_name
# show_location_name
# They do exactly as they suggest.
#===============================================================================
$imported = {} if $imported == nil
$imported["LocationName"] = true
module SSS
# This adjusts the backsprite used for the location background text.
LOCATION_COLOR1 = Color.new(0, 0, 0, 128)
LOCATION_COLOR2 = Color.new(0, 0, 0, 0)
LOCATION_PREFIX = "◆%s"
end
#==============================================================================
# ** Game_System
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :hide_location_name
end
#===============================================================================
# ** Game_Map
#===============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Location Name
#--------------------------------------------------------------------------
def location_name
data = load_data("Data/MapInfos.rvdata")
text = data[@map_id].name.gsub(/\[.*\]/) { "" }
for area in $data_areas.values
next unless $game_player.in_area?(area)
text = area.name.gsub(/\[.*\]/) { "" }
break
end
return text
end
end
#==============================================================================
# ** Game_Interpreter
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# * Hide Location Name
#--------------------------------------------------------------------------
def hide_location_name
$game_system.hide_location_name = true
end
#--------------------------------------------------------------------------
# * Show Location Name
#--------------------------------------------------------------------------
def show_location_name
$game_system.hide_location_name = false
end
end
#==============================================================================
# ** Window_LocationName
#==============================================================================
class Window_LocationName < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, Graphics.width/2, 56)
self.back_opacity = 0
self.opacity = 0
create_location_color_sprite
@location_name = $game_map.location_name
refresh
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
@background_color_sprite.bitmap.dispose
@background_color_sprite.dispose
super
end
#--------------------------------------------------------------------------
# * Create Location Color Sprite
#--------------------------------------------------------------------------
def create_location_color_sprite
bitmap = Bitmap.new(Graphics.width/2, 24)
g1 = SSS::LOCATION_COLOR1
g2 = SSS::LOCATION_COLOR2
bitmap.gradient_fill_rect(0, 0, Graphics.width/4, 24, g1, g1)
bitmap.gradient_fill_rect(Graphics.width/4, 0, Graphics.width/4, 24, g1, g2)
@background_color_sprite = Sprite.new(self.viewport)
@background_color_sprite.bitmap = bitmap
@background_color_sprite.y = 16
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
@background_color_sprite.update
rate = hide_sprite? ? -16 : 16
@background_color_sprite.opacity += rate
refresh if @location_name != $game_map.location_name
end
#--------------------------------------------------------------------------
# * Hide Sprite?
#--------------------------------------------------------------------------
def hide_sprite?
return true if $game_system.hide_location_name
if $game_player.screen_x < Graphics.width/3 and $game_player.screen_y <= 60
return true
end
return false
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@location_name = $game_map.location_name
t = sprintf(SSS::LOCATION_PREFIX, @location_name)
@background_color_sprite.bitmap.dispose
create_location_color_sprite
@background_color_sprite.bitmap.draw_text(16, 0, contents.width, WLH, t)
end
end
#==============================================================================
# ** Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
alias start_sss_location_name start unless $@
def start
start_sss_location_name
@location_window = Window_LocationName.new
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
alias terminate_sss_location_name terminate unless $@
def terminate
@location_window.dispose
terminate_sss_location_name
end
#--------------------------------------------------------------------------
# * Basic Update Processing
#--------------------------------------------------------------------------
alias update_basic_sss_location_name update_basic unless $@
def update_basic
update_basic_sss_location_name
@location_window.update
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias update_sss_location_name update unless $@
def update
update_sss_location_name
@location_window.update
end
end
#===============================================================================
#
# END OF FILE
#
#===============================================================================
CREDITOS:POKETHOUSE