Project1
标题:
求VX显示地图名脚本
[打印本页]
作者:
哥是传说
时间:
2012-2-25 08:09
标题:
求VX显示地图名脚本
小弟想做一个游戏,在窗口右上角显示地图名,要一直显示
Ps:本人是脚本盲 dsu_plus_rewardpost_czw
作者:
狂人狂者
时间:
2012-2-25 08:56
#==============================================================================
# 地图名及区域名显示 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
复制代码
不过是在左上角,也不能一直持续...
作者:
iisnow
时间:
2012-2-25 11:34
补充说明:要想实现名称一直显示,
要对沙发的脚本进行一点改变:
1.调整66行,0改为255,
64行的0也可以调整(0~255之间,LZ自己看看效果吧,也可以不改,让它是0)
2.157行到188行全部注释掉;
3.对11行、13行、15行的数值进行修改,使名称的位置到你想要的位置
(例如,MWINDOW_X = 0,MWINDOW_Y = 0, WEIGH = 100)
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1