赞 | 7 |
VIP | 7 |
好人卡 | 58 |
积分 | 1 |
经验 | 111901 |
最后登录 | 2021-11-5 |
在线时间 | 385 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 65
- 在线时间
- 385 小时
- 注册时间
- 2007-7-27
- 帖子
- 4106
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
显示地名的脚本很多……囧……<--撞车的话这个人肯定先撞死……
其实是不太满意现有脚本的效果,所以自己写了一个。
和现有的脚本不同的地方是:
1.左下角位移和渐隐显示地图名和区域名
2.右上角位移加模糊显示地区名
(囧……没看出来有啥不同……)
地区名和地图名
区域名显示
使用方法:
地图名如下格式:地图名@地区名@地区英文名
区域名如下格式:区域名
只需要在切换地区的地图设置地区名即可,详细请看范例。
占用1号2号开关,占第八用号角色名存储地区名,具体可以在脚本中修改。
9月21日更新
匈魔剑提出的切换地图时的显示问题:
现在已经改为切换地图时将上一张地图显示的窗口清除。
精灵使者提出的下列问题也已经解决:
1.现在切换地图时,将优先显示当前的区域名
2.可以直接显示,在事件中通过脚本
[quote]
$scene.map_window.d_display
$scene.zone_window.d_display
分别调出地名窗口和地区窗口
3.当切换区域时,区域同名将视为一个区域。以此解决不规则区域的问题
4.大地图可以分为不同的地图,方法是将区域名设为和地图名一样的「区域名@地区名@地区英文名」
同时,已和另一个地图增强脚本整合……【囧……那个还在写说明囧囧囧】
[/quote]
脚本已经分为两块
请将此两段脚本全部插入
通用段:【用语存储常量与公用方法】
- #▼▼▼通用变量、方法、模块、类▼▼▼
- #==============================================================================
- # ■ (模块)T_m
- #------------------------------------------------------------------------------
- # 用来存储常用常量
- #=============================================================================
- module T_m
- #-----------------------------------------------------------------------------
- # ● 地名窗口常量
- #-----------------------------------------------------------------------------
- #▼地名窗口
- WIDTH = 150 # 窗口宽度最小值
- IN_TIME = 20 # 窗口出现时间
- SHOW_TIME = 60 # 窗口显示时间
- FADE_TIME = 30 # 窗口淡去时间
- TEXT1_SIZE = 19 # 地图名,区域名的字体大小
- TEXT2_SIZE = 13 # 地区名的字体大小
- TEXT1_COLOR = Color.new(255,255,255) # 地图名,区域名的默认颜色
- TEXT2_COLOR = Color.new(255,60,60) # 地区名的默认颜色
- SKIN = "window" # 窗口皮肤的文件名
- VX_H = 416 # VX窗口高度
- VX_W = 544 # VX窗口宽度
- ZONE_NUM =8 # 地区名占用角色名的编号
- Map_W_S=1 # 控制是否显示的开关
- #▼地区名窗口
- Z_IN_TIME = 30 # 窗口出现时间
- Z_SHOW_TIME = 70 # 窗口显示时间
- Z_FADE_TIME = 30 # 窗口淡去时间
- ZONE_W_S=2 # 控制是否显示开关
- #▼计算
- HEIGHT = TEXT1_SIZE + TEXT2_SIZE + 34 # 窗口高度
- MWINDOW_Y = VX_H - HEIGHT - 16 # 窗口Y坐标
- #----------------------------------------------------------------------------
- # ● 路牌门牌NPC常量
- #----------------------------------------------------------------------------
- #▼路口窗口
- RT_WIDTH=240 #窗口宽度的最小值
- RT_Y=30 #窗口Y值
- RT_INTIME=20 #窗口出现时间
- RT_ONTIME=60 #窗口持续时间
- RT_FADETIME=20 #窗口消失时间
- RT_S=3 #控制开关
- RT_TEXTSIZE=20 #字体大小
- RT_TEXTCOLOR=Color.new(255,255,255) #字体颜色
- #▼NPC窗口
- NPC_ICON_TALK="talk" #「谈话」图标名
- NPC_ICON_TRADE="trade" #「交易」图标名
- NPC_ICON_CHECK="check" #「调查」图标名
- NPC_NAME_SIZE=16 #「NPC」人名字号
- NPC_S=4 #「NPC控制开关」编号
- #▼门牌窗口
- DOOR_NAME_SIZE=22 #门牌「名称」字号
- DOOR_TYPE_SIZE =16 #门牌「类型」字号
- DOOR_S=5 #「门牌」控制开关编号
- #----------------------------------------------------------------------------
- # ●其他
- #----------------------------------------------------------------------------
- def self.preview_dis
- return @preview_dis
- end
- def self.preview_dis=(a)
- return @preview_dis=a
- end
- @preview_dis=false
- end
- #----------------------------------------------------------------------------
- # ● 方法:读取属性
- #----------------------------------------------------------------------------
- def readattr(str,section,ignore_caps = false)
- str="" if str.class!=String
- result=''
- section.upcase! if ignore_caps
- s = section.to_sym
- temp = str.split(/=/)
- temp.each{|i|i.strip!}
- temp[0].upcase! if ignore_caps
- temp[0]=" " if temp[0]==nil
- if temp[0].to_sym==s
- unless temp[1]==nil
- result=temp[1]
- end
- end
- return result
- end
- #==============================================================================
- # ■ Game_Map
- #------------------------------------------------------------------------------
- # 对Game_Map类的追加定义。
- #=============================================================================
- class Game_Map
- #--------------------------------------------------------------------------
- # ● 获取所在场景名称
- #--------------------------------------------------------------------------
- def name
- load_data("Data/MapInfos.rvdata")
- end
- end
- #==============================================================================
- # ■ Game_Character
- #------------------------------------------------------------------------------
- # 判断当前人物所在区域id(by beside)。
- #=============================================================================
- class Game_Character
- def area_id
- for area in $data_areas.values
- if in_area?(area)
- return area.id
- end
- end
- end
- end
-
- #==============================================================================
- # ◎ GPRA_Bitmap
- #------------------------------------------------------------------------------
- # ◎ Bitmap功能加强
- #------------------------------------------------------------------------------
- # 制作者:绿梨子红苹果
- # 个人主页:vbgm.9126.com
- # E-Mail:[email protected]
- # QQ:42378361
- #==============================================================================
- class Bitmap
- # 影子字
- def draw_text_s(x, y, width, height, str, align=0)
- # 保存当前颜色
- r=self.font.color.red
- g=self.font.color.green
- b=self.font.color.blue
- # 颜色更改成黑色
- self.font.color.set(0, 0, 0)
- # 绘制影子
- self.draw_text(x+2, y+2, width, height, str, align)
- # 恢复原始字色
- self.font.color.set(r,g,b)
- # 绘制原来的字
- self.draw_text(x, y, width, height, str, align)
- end
- # 描边字
- def draw_text_f(x, y, width, height, str, align=0)
- # 保存当前颜色
- r=self.font.color.red
- g=self.font.color.green
- b=self.font.color.blue
- # 颜色更改成黑色
- self.font.color.set(0, 0, 0)
- # 绘制边框
- self.draw_text(x-1, y-1, width, height, str, align)
- self.draw_text(x-1, y+1, width, height, str, align)
- self.draw_text(x+1, y-1, width, height, str, align)
- self.draw_text(x+1, y+1, width, height, str, align)
- self.draw_text(x, y-1, width, height, str, align)
- self.draw_text(x, y+1, width, height, str, align)
- self.draw_text(x-1, y, width, height, str, align)
- self.draw_text(x+1, y, width, height, str, align)
- # 恢复原始字色
- self.font.color.set(r,g,b)
- # 绘制原来的字
- self.draw_text(x, y, width, height, str, align)
- end
- end
复制代码
地名显示段:
- #▼▼▼区域,地图,地区名显示▼▼▼ by trentswd
- #==============================================================================
- # ■ Map_Window
- #------------------------------------------------------------------------------
- # 游戏中显示地名的窗口。
- #=============================================================================
- class Map_Window<Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize
- super(-(5+T_m::WIDTH),T_m::MWINDOW_Y,T_m::WIDTH,T_m::HEIGHT)
- self.windowskin = Cache.system(T_m::SKIN)
- create_contents
- self.opacity = 255
- self.contents_opacity = 255
- self.contents.font.name=["华文细黑","STXihei","黑体"]
- @id=$game_map.map_id
- @time=0
- @a_id=$game_player.area_id
- @zone_change=false
- @a_name=""
- @a_name=area_name if @a_id.is_a?(Numeric)
- @preview_not_dis=true
- end
- #--------------------------------------------------------------------------
- # ● 地区标记为改变
- #--------------------------------------------------------------------------
- def zone_change
- @zone_change=true
- end
- #--------------------------------------------------------------------------
- # ● 得到地名
- #--------------------------------------------------------------------------
- def name(id=$game_map.map_id)
- name=$game_map.name[id].name.split(/@/)[0]
- return name
- end
- #--------------------------------------------------------------------------
- # ● 得到区域名
- #--------------------------------------------------------------------------
- def area_name(id=$game_player.area_id)
- name=$data_areas[id].name.split(/@/)[0]
- return name
- end
- #--------------------------------------------------------------------------
- # ● 得到地区名
- #--------------------------------------------------------------------------
- def zone(id=$game_map.map_id)
- name=$game_map.name[id].name.split(/@/)[1]
- return name
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- if @a_id!=$game_player.area_id
- @a_id=$game_player.area_id
- if @a_id.is_a?(Numeric) && $game_switches[T_m::Map_W_S] == true && (area_name.split(/,/)[0]!="2"&&area_name.split(/,/)[0]!="6"&&area_name.split(/,/)[0]!="4"&&area_name.split(/,/)[0]!="8")&&self.area_name!=@a_name
- @a_name=self.area_name
- @preview_not_dis=false
- T_m::preview_dis=false
- self.width=[T_m::WIDTH,T_m::TEXT1_SIZE*self.name.size/3+50].max
- if @time==0
- self.x=-5-self.width
- end
- create_contents
- self.contents.font.size=T_m::TEXT1_SIZE
- self.contents.font.color=T_m::TEXT1_COLOR
- self.contents.draw_text(0,0,self.width-32,T_m::TEXT1_SIZE,self.area_name)
- self.contents.font.size=T_m::TEXT2_SIZE
- self.contents.font.color=T_m::TEXT2_COLOR
- self.contents.draw_text(0,T_m::TEXT1_SIZE+2,self.width-32,T_m::TEXT2_SIZE,$game_actors[T_m::ZONE_NUM].name)
- #~ if @time==0
- @time=T_m::IN_TIME+T_m::SHOW_TIME+T_m::FADE_TIME
- #~ elsif @time>T_m::SHOW_TIME+T_m::FADE_TIME
- #~ @time=@time
- #~ elsif @time>T_m::FADE_TIME
- #~ @time=T_m::SHOW_TIME+T_m::FADE_TIME
- #~ else
- #~ @time=T_m::IN_TIME+(-self.width-5-self.x)/(self.width/T_m::IN_TIME)+T_m::SHOW_TIME+T_m::FADE_TIME
- #~ end
- elsif $game_switches[T_m::Map_W_S] == true && $game_player.area_id.is_a?(Numeric)==false
- @a_name=self.name
- if T_m::preview_dis
- T_m::preview_dis=false
- else
- self.width=[T_m::WIDTH,T_m::TEXT1_SIZE*self.name.size/3+50].max
- if @time==0
- self.x=-5-self.width
- end
- create_contents
- self.contents.font.size=T_m::TEXT1_SIZE
- self.contents.font.color=T_m::TEXT1_COLOR
- self.contents.draw_text(0,0,self.width-32,T_m::TEXT1_SIZE,self.name)
- self.contents.font.size=T_m::TEXT2_SIZE
- self.contents.font.color=T_m::TEXT2_COLOR
- self.contents.draw_text(0,T_m::TEXT1_SIZE+2,self.width-32,T_m::TEXT2_SIZE,$game_actors[T_m::ZONE_NUM].name)
- #~ if @time==0
- @time=T_m::IN_TIME+T_m::SHOW_TIME+T_m::FADE_TIME
- #~ elsif @time>T_m::SHOW_TIME+T_m::FADE_TIME
- #~ @time=@time
- #~ elsif @time>T_m::FADE_TIME
- #~ @time=T_m::SHOW_TIME+T_m::FADE_TIME
- #~ else
- #~ @time=T_m::IN_TIME+(-self.width-5-self.x)/(self.width/T_m::IN_TIME)+T_m::SHOW_TIME+T_m::FADE_TIME
- #~ end
- end
- end
- end
- if @id!=$game_map.map_id
- self.contents.clear
- @id=$game_map.map_id
- if $game_switches[T_m::Map_W_S] == true
- if @zone_change == true
- if self.zone==nil || self.zone==""
- else
- $game_actors[T_m::ZONE_NUM].name=self.zone
- end
- end
- self.width=[T_m::WIDTH,T_m::TEXT1_SIZE*self.name.size/3+50].max
- if @time==0
- self.x=-5-self.width
- end
- create_contents
- self.contents.font.size=T_m::TEXT1_SIZE
- self.contents.font.color=T_m::TEXT1_COLOR
- if $game_player.area_id.is_a?(Numeric)
- mapname=self.area_name if (self.area_name!= nil && self.area_name!= "")
- else
- mapname=self.name
- end
- self.contents.draw_text(0,0,self.width-32,T_m::TEXT1_SIZE,mapname)
- self.contents.font.size=T_m::TEXT2_SIZE
- self.contents.font.color=T_m::TEXT2_COLOR
- self.contents.draw_text(0,T_m::TEXT1_SIZE+2,self.width-32,T_m::TEXT2_SIZE,$game_actors[T_m::ZONE_NUM].name)
- #~ if @time==0
- @time=T_m::IN_TIME+T_m::SHOW_TIME+T_m::FADE_TIME
- #~ elsif @time>T_m::SHOW_TIME+T_m::FADE_TIME
- #~ @time=@time
- #~ elsif @time>T_m::FADE_TIME
- #~ @time=T_m::SHOW_TIME+T_m::FADE_TIME
- #~ else
- #~ @time=T_m::IN_TIME+(-self.width-5-self.x)/(self.width/T_m::IN_TIME)+T_m::SHOW_TIME+T_m::FADE_TIME
- #~ end
- end
- end
- if @direct==1
- self.contents.clear
- self.width=[T_m::WIDTH,T_m::TEXT1_SIZE*self.name.size/3+50].max
- if @time==0
- self.x=-5-self.width
- end
- create_contents
- self.contents.font.size=T_m::TEXT1_SIZE
- self.contents.font.color=T_m::TEXT1_COLOR
- dname=@a_name
- self.contents.draw_text(0,0,self.width-32,T_m::TEXT1_SIZE,dname)
- self.contents.font.size=T_m::TEXT2_SIZE
- self.contents.font.color=T_m::TEXT2_COLOR
- self.contents.draw_text(0,T_m::TEXT1_SIZE+2,self.width-32,T_m::TEXT2_SIZE,$game_actors[T_m::ZONE_NUM].name)
- @time=T_m::IN_TIME+T_m::SHOW_TIME+T_m::FADE_TIME
- @direct=0
- end
- if @time>T_m::SHOW_TIME+T_m::FADE_TIME
- self.opacity = 255*(T_m::IN_TIME+T_m::SHOW_TIME+T_m::FADE_TIME-@time)/(T_m::IN_TIME-1)
- self.contents_opacity = 255*(T_m::IN_TIME+T_m::SHOW_TIME+T_m::FADE_TIME-@time)/(T_m::IN_TIME-1)
- self.x = -self.width-5+self.width*(T_m::IN_TIME+T_m::SHOW_TIME+T_m::FADE_TIME-@time)/(T_m::IN_TIME-1)
- @time-=1
- elsif @time>T_m::FADE_TIME
- @time-=1
- elsif @time>0
- self.opacity = 255*(@time-1)/(T_m::FADE_TIME-1)
- self.contents_opacity = 255*(@time-1)/(T_m::FADE_TIME-1)
- self.x = -self.width-5+self.width*(@time-1)/(T_m::FADE_TIME-1)
- @time-=1
- else
- self.opacity = 0
- self.contents_opacity = 0
- self.x = -self.width-5
- end
- end
- #--------------------------------------------------------------------------
- # ● 直接显示
- #--------------------------------------------------------------------------
- def d_display
- @direct=1
- end
- end
- #==============================================================================
- # ■ Scene_Map
- #------------------------------------------------------------------------------
- # 对Scene_Map的追加定义。
- #==============================================================================
- class Scene_Map < Scene_Base
- def map_window
- return @map_window
- end
- def zone_window
- return @zone_window
- end
- #--------------------------------------------------------------------------
- # ● 开始处理时建立对象
- #--------------------------------------------------------------------------
- alias _start start
- def start
- @map_window = Map_Window.new
- @zone_window = Zone_Window.new
- _start
- end
- #--------------------------------------------------------------------------
- # ● 释放时释放对象
- #--------------------------------------------------------------------------
- alias _terminate terminate
- def terminate
- @map_window.dispose
- @zone_window.dispose
- _terminate
- end
- #--------------------------------------------------------------------------
- # ● 刷新时刷新对象
- #--------------------------------------------------------------------------
- alias _update update
- def update
- @zone_window.refresh
- @map_window.refresh
- _update
- end
- #--------------------------------------------------------------------------
- # ● 标记为地区已改变(这个参数传递的很囧我承认)
- #--------------------------------------------------------------------------
- def zone_change
- @map_window.zone_change
- end
- end
- #==============================================================================
- # ■ Zone_Window
- #------------------------------------------------------------------------------
- # 显示地区名的类
- #=============================================================================
- class Zone_Window<Window_Base
- #--------------------------------------------------------------------------
- # ● 新建对象初始化
- #--------------------------------------------------------------------------
- def initialize
- super(0,0,50,50)
- create_contents
- self.opacity = 0
- self.contents_opacity = 0
- @time=0
- self.contents.font.shadow = false
- end
- #--------------------------------------------------------------------------
- # ● 直接显示
- #--------------------------------------------------------------------------
- def d_display
- @direct=1
- end
- #--------------------------------------------------------------------------
- # ● 得到地区名
- #--------------------------------------------------------------------------
- def zone(id=$game_map.map_id)
- name=$data_areas[$game_player.area_id].name.split(/@/)[1] if $game_player.area_id.is_a?(Numeric)
- if name==nil || name==""
- name=$game_map.name[id].name.split(/@/)[1]
- end
- #~ p name
- return name
- end
- #--------------------------------------------------------------------------
- # ● 得到地区英文名
- #--------------------------------------------------------------------------
- def zonee(id=$game_map.map_id)
- name=$game_map.name[id].name.split(/@/)[2]
- if $game_player.area_id.is_a?(Numeric)
- if $data_areas[$game_player.area_id].name.split(/@/)[1]!=nil &&
- $data_areas[$game_player.area_id].name.split(/@/)[1]!=""
- name=$data_areas[$game_player.area_id].name.split(/@/)[2]
- end
- end
- name="" if name==nil
- return name
- end
- #--------------------------------------------------------------------------
- # ● 描绘中文名
- #--------------------------------------------------------------------------
- def drawtext(x)
- self.contents.font.name=["华文中宋","STZhongsong","宋体","黑体"]
- self.contents.font.size=36
- self.contents.font.shadow=false
- self.contents.font.color=Color.new(255,255,255)
- self.contents.draw_text_f(x,0,self.contents.width,36,@text)
- end
- #--------------------------------------------------------------------------
- # ● 描绘英文名
- #--------------------------------------------------------------------------
- def drawtexten(x)
- self.contents.font.name=["Copperplate Gothic Light"]
- self.contents.font.size=12
- self.contents.font.shadow=false
- self.contents.font.color=Color.new(255,255,255)
- self.contents.draw_text_f(x,49,self.contents.width,12,@texten)
- end
- #--------------------------------------------------------------------------
- # ● 描绘横线
- #--------------------------------------------------------------------------
- def drawline
- self.contents.fill_rect(self.contents.width-5-@textw-1, 40, @textw+2, 5, Color.new(0,0,0,255))
- self.contents.fill_rect(self.contents.width-5-@textw, 41, @textw, 3, Color.new(255,255,255,255))
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- if (self.zone != $game_actors[T_m::ZONE_NUM].name && self.zone != "" && self.zone != nil)||@direct==1
- $game_actors[T_m::ZONE_NUM].name=self.zone
- $scene.zone_change
- if ($game_switches[T_m::ZONE_W_S] == true)|| @direct==1
- @text=self.zone
- @texten=self.zonee
- @[email protected]*36/3
- @[email protected]*6
- @textw=[@textl,@textenl].max+24
- @l=@textw/12
- self.x=T_m::VX_W-@textw-@textl-5-16
- self.y=0
- self.width=@textw+@textl+5+32
- self.height=32+12+12+36
- @time=T_m::Z_IN_TIME+T_m::Z_SHOW_TIME+T_m::Z_FADE_TIME
- @direct=0
- create_contents
- end
- end
- if @time>T_m::Z_SHOW_TIME+T_m::Z_FADE_TIME
- self.contents_opacity = 255*(T_m::Z_IN_TIME+T_m::Z_SHOW_TIME+T_m::Z_FADE_TIME-@time)/(T_m::Z_IN_TIME-1)
- drawline
- if @time%2==1
- self.contents.clear
- drawline
- drawtext((self.contents.width-5-(@textw-@textl)/2-@textl)*(T_m::Z_IN_TIME+T_m::Z_SHOW_TIME+T_m::Z_FADE_TIME-@time)/(T_m::Z_IN_TIME-1))
- drawtexten(self.contents.width-(5+(@textw-@textenl)/2+@textenl)*(T_m::Z_IN_TIME+T_m::Z_SHOW_TIME+T_m::Z_FADE_TIME-@time)/(T_m::Z_IN_TIME-1))
- end
- @time-=1
- elsif @time>T_m::Z_FADE_TIME
- @time-=1
- elsif @time>0
- self.contents_opacity = 255*(@time-1)/(T_m::Z_FADE_TIME-1)
- if @time%2==1
- self.contents.clear
- drawline
- drawtext(self.contents.width-(5+(@textw-@textl)/2+@textl)*(@time-1)/(T_m::Z_FADE_TIME-1))
- drawtexten((self.contents.width-5-(@textw-@textenl)/2-@textenl)*(@time-1)/(T_m::Z_FADE_TIME-1))
- self.contents.blur
- end
- @time-=1
- else
- self.opacity=0
- self.contents_opacity=0
- end
- end
- end
复制代码
范例工程
历史版本
8.29更新
少写一个@问题……囧
感谢小幽提出……
同时感谢他的脚本速查手册……
范例工程:
感谢Beside的同类脚本,中期给了我许多参考。(获得area_id的方法就是照搬的……)
感谢绿梨子红苹果的描边字脚本
感谢胃画的地图……军训辛苦了
|
|