Project1
标题:
应求发布,VX地图名自动显示不会有
[打印本页]
作者:
550947096
时间:
2012-2-7 10:17
标题:
应求发布,VX地图名自动显示不会有
哪个高手,图文教一下。。。不然真的不会用啊。。。 dsu_plus_rewardpost_czw
作者:
linyifei
时间:
2012-2-7 11:29
#==============================================================================
# 地图名及区域名显示 by Beside
#------------------------------------------------------------------------------
# 功能: 动态显示玩家所在区域及地图名。
#==============================================================================
MWINDOW_X = 20 # 窗口X坐标
MWINDOW_Y = 20 # 窗口Y坐标
WEIGH = 200 # 窗口宽度
START_TIME = 30 # 窗口出现时间
COUN_TIME = 50 # 窗口持续时间
FADE_TIME = 30 # 窗口淡去时间
TEXT1_SIZE = 20 # 地图名的字体大小
TEXT2_SIZE = 18 # 区域名的字体大小
TEXT3_SIZE = 18 # 附加名的字体大小
TEXT1_COLOR = Color.new(255,255,255) # 地图名的默认颜色
TEXT2_COLOR = 0 # 区域名的默认颜色代码(0-31)
TEXT3_COLOR = 0 # 附加名的默认颜色代码(0-31)
SKIN = "window" # 窗口皮肤的文件名
HEIGHT = TEXT1_SIZE + TEXT2_SIZE + TEXT3_SIZE + 32
#==============================================================================
# ■ Window_Map
#------------------------------------------------------------------------------
# 显示当前进度中的所在场景名称的窗口。
#==============================================================================
class Window_Map < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
@id = 0
@a_id = 0
super(MWINDOW_X, MWINDOW_Y, WEIGH, HEIGHT)
self.opacity = 0
self.contents_opacity = 0
self.windowskin = Cache.system(SKIN)
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
@map_id = $game_map.map_id
locationname = load_data("Data/MapInfos.rvdata")[@map_id].name
if $game_player.area_id.is_a?(Numeric)
if $game_player.area_id != @a_id or @map_id != @id
self.contents.clear
if @map_id != @id
@id = @map_id
@time_count = START_TIME + COUN_TIME + FADE_TIME
self.contents.font.color = TEXT1_COLOR
self.contents.font.size = TEXT1_SIZE
self.contents.draw_text(0, 0, WEIGH-32, TEXT1_SIZE, locationname, 1)
end
@time_count = START_TIME + COUN_TIME + FADE_TIME
@a_id = $game_player.area_id
area_name = $data_areas[@a_id].name_p1
other_name = $data_areas[@a_id].name_p2
self.contents.font.size = TEXT2_SIZE
self.contents.font.color = text_color($data_areas[@a_id].color_1)
self.contents.draw_text(0, TEXT1_SIZE, WEIGH-32, TEXT2_SIZE, area_name, 1)
self.contents.font.size = TEXT3_SIZE
self.contents.font.color = text_color($data_areas[@a_id].color_2)
self.contents.draw_text(0, TEXT1_SIZE+TEXT2_SIZE, WEIGH-32, TEXT3_SIZE, other_name, 1)
end
elsif @map_id != @id
@id = @map_id
@time_count = START_TIME + COUN_TIME + FADE_TIME
self.contents.clear
self.contents.font.color = TEXT1_COLOR
self.contents.font.size = TEXT1_SIZE
self.contents.draw_text(0, (HEIGHT-TEXT1_SIZE)/2-16, WEIGH-32, TEXT1_SIZE, locationname, 1)
elsif @a_id != 0
@a_id = 0
@time_count = START_TIME + COUN_TIME + FADE_TIME
self.contents.clear
self.contents.font.color = TEXT1_COLOR
self.contents.font.size = TEXT1_SIZE
self.contents.draw_text(0, (HEIGHT-TEXT1_SIZE)/2-16, WEIGH-32, TEXT1_SIZE, locationname, 1)
end
if @time_count > COUN_TIME + FADE_TIME
self.opacity += 255 / START_TIME
self.contents_opacity += 255 / START_TIME
@time_count -= 1
elsif @time_count > FADE_TIME
self.opacity = 255
self.contents_opacity = 255
@time_count -= 1
elsif @time_count > 0
self.opacity -= 255 / FADE_TIME
self.contents_opacity -= 255 / FADE_TIME
@time_count -= 1
else
@time_count = 0
self.opacity = 0
self.contents_opacity = 0
end
end
end
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
# 处理地图画面的类。
#==============================================================================
class Scene_Map < Scene_Base
alias _start start
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
@map_window = Window_Map.new
_start
end
alias _terminate terminate
def terminate
@map_window.dispose
_terminate
end
alias _update update
def update
@map_window.refresh
_update
end
end
module RPG
class Area
def name_p1
name = @name.split(/#/)[0]
return name != nil ? name : ""
end
def name_p2
name = @name.split(/#/)[1]
return name != nil ? name : ""
end
def color_1
color = @name.split(/#/)[2]
return color != nil ? color.to_i : TEXT2_COLOR
end
def color_2
color = @name.split(/#/)[3]
return color != nil ? color.to_i : TEXT3_COLOR
end
end
end
class Game_Character
def area_id
for area in $data_areas.values
if in_area?(area)
return area.id
end
end
end
end
复制代码
貌似把此代码放在main前就可以了
作者:
550947096
时间:
2012-2-7 13:22
把此代码放在主前就可以了什么意思?
作者:
linyifei
时间:
2012-2-7 15:38
550947096 发表于 2012-2-7 13:22
把此代码放在主前就可以了什么意思?
这是一段脚本,打开脚本编辑器,插入在main前
作者:
740245843
时间:
2012-2-24 17:00
谢谢了!!
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1