Project1
标题:
地图名显示脚本报错,请问可以帮我看看吗
[打印本页]
作者:
wangyu950208
时间:
2012-12-14 21:57
标题:
地图名显示脚本报错,请问可以帮我看看吗
本帖最后由 wangyu950208 于 2012-12-21 14:20 编辑
#==============================================================================
# 跳转地图时显示地图名 by 沉影不器(修改by银翼)
#------------------------------------------------------------------------------
# 功能: 在初进地图时,渐显地图名,随后渐隐
# 对于不需要显示地图名的地图,请在地图名里添加字符"@"
#==============================================================================
# ■ Spriteset_Map
#==============================================================================
class Spriteset_Map
#-------------------------------------------------------------------
-------
# ● 参数
#--------------------------------------------------------------------------
# 基本设定
MAX_OPACITY = 212 # 最大不透明度
SHOW_COUNT = 120 # 显示时间(均以帧为单位)
TRANS_COUNT = 60 # 渐变时间
NAME_WIN_WIDTH = 192 # 名称窗体宽度
NAME_WIN_HEIGHT = 56 # 名称窗体高度
# 美化选项
FONT_SIZE = 20 # 名称字体大小
FONT_COLOR = Color.new(255,255,255) # 名称字体颜色
FONT_SHADOW = true # 名称字体是否描绘阴影
SKIN = "Window" # 名称窗体自定义皮肤(空字符时隐藏窗体)
ANIMATION_ID = 32 # 显示名称时的动画 ID(0以下为无动画)
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
alias ini initialize
def initialize
# 获取地图名
name = get_map_name($game_map.map_id)
if $game_temp.old_map_name != name
$game_temp.old_map_name = name
unless name.include? "@"
create_name_window
end
end
ini
end
#--------------------------------------------------------------------------
# ○ 生成名窗体
#--------------------------------------------------------------------------
def create_name_window
# 初始化参数
@show_count = SHOW_COUNT
@trans_count_1 = TRANS_COUNT
@trans_count_2 = TRANS_COUNT
animation_id = get_animation_id($game_map.map_id)
animation_id = ANIMATION_ID if animation_id <= 0
x = (Graphics.width - NAME_WIN_WIDTH)/2
y = (Graphics.height - NAME_WIN_HEIGHT)/2
# 生成窗体
@name_window = Window_Base.new(x, y, NAME_WIN_WIDTH, NAME_WIN_HEIGHT)
@name_window.windowskin = Cache.system(SKIN)
@name_window.contents.font.size = FONT_SIZE
@name_window.contents.font.color = FONT_COLOR
@name_window.contents.font.shadow = FONT_SHADOW
@name_window.viewport = @viewport3
@name_window.opacity = 0
@name_window.contents_opacity = 0
# 地图名
text = $game_temp.old_map_name
@name_window.contents.draw_text(0,0,NAME_WIN_WIDTH-32,FONT_SIZE+4,text,1)
end
#--------------------------------------------------------------------------
# ○ 获取地图名
# map_id : 地图 ID
#--------------------------------------------------------------------------
def get_map_name(map_id)
mapinfo = load_data("Data/MapInfos.rvdata")
result = mapinfo[map_id].name
return result.split(/,/)[0].split(/_/)[0]
end
#--------------------------------------------------------------------------
# ○ 获取动画 ID
# map_id : 地图 ID
#--------------------------------------------------------------------------
def get_animation_id(map_id)
mapinfo = load_data("Data/MapInfos.rvdata")
result = mapinfo[map_id].name
return result.split(/,/)[0].split(/_/)[1].to_i
end
#--------------------------------------------------------------------------
# ○ 更新名窗体
#--------------------------------------------------------------------------
def update_name_window
return if @name_window == nil
# 已关闭时不需更新
return unless @name_window.visible
# 更新动画
# 渐现
if @trans_count_1 >= 0
@trans_count_1 -= 1
@name_window.opacity += MAX_OPACITY/TRANS_COUNT
@name_window.contents_opacity += MAX_OPACITY/TRANS_COUNT
end
# 显示时间计数
if @show_count >=0
@show_count -= 1
end
# 渐隐
if @show_count <= 0
if @trans_count_2 > 0
@trans_count_2 -= 1
@name_window.opacity -= MAX_OPACITY/TRANS_COUNT
@name_window.contents_opacity -= MAX_OPACITY/TRANS_COUNT
end
if @trans_count_2 <= 0
@name_window.visible = false
end
end
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
alias old_dispose dispose
def dispose
old_dispose
return if @name_window == nil
@name_window.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
alias old_update update
def update
old_update
update_name_window
end
end
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_accessor :old_map_name # 背景位图
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
alias ini initialize
def initialize
ini
@old_map_name = ""
end
end
说是149行(倒数第四行)有问题,求指导。
作者:
wangyu950208
时间:
2012-12-14 22:42
刚研究了一下,应该是截图存档的脚本和地图名显示的有冲突,求解决方法
作者:
fxwd
时间:
2012-12-14 23:03
工程在哪里
作者:
wangyu950208
时间:
2012-12-15 19:13
fxwd 发表于 2012-12-14 23:03
工程在哪里
额,怎么发大于一兆的东西呢?
作者:
wangyu950208
时间:
2012-12-15 20:18
fxwd 发表于 2012-12-14 23:03
工程在哪里
范例
麻烦大家帮忙看看
作者:
wangyu950208
时间:
2012-12-15 20:19
http://pan.baidu.com/share/link?shareid=172574&uk=2753978404
作者:
wangyu950208
时间:
2012-12-15 21:00
需要审核。。。
作者:
wangyu950208
时间:
2012-12-16 10:45
%http:%//pan.baidu.com%/share/link?shareid=173030&uk=2753978404%
把%去掉,麻烦各位帮帮忙
作者:
wangyu950208
时间:
2012-12-20 11:45
拜托帮帮忙啊各位大神,没人知道吗
作者:
a364774426
时间:
2012-12-20 14:07
其实,还有别的地名显示脚本可以用,而且是美化程度更好的。
#===============================================================================
# MOG_Location_Name_VX V1.0
#===============================================================================
# By Moghunter 汉化:火鸡三毛老大
#===============================================================================
module MOG
#地图名字体.
MPFONT = "Georgia"
#------------------------------------------------
#消失 ON/OFF(True - False).
MPNMFD = true
#------------------------------------------------
#窗口消失时间.
MPNMTM = 20
#------------------------------------------------
#窗口提示位置.
# 0 = 左上角.
# 1 = 左下角.
# 2 = 右上角.
# 3 = 右下角.
MPNMPS = 0
#------------------------------------------------
# 关闭开启显示提示(ID).
WM_SWITCH_VIS_DISABLE = 50
end
#------------------------------------------------
###############
# Game_System #
###############
class Game_System
attr_accessor :fdtm
attr_accessor :mpnm_x
attr_accessor :mpnm_y
alias mog_vx06_initialize initialize
def initialize
mog_vx06_initialize
@fdtm = 255 + 35 * MOG::MPNMTM
if MOG::MPNMPS == 0
@mpnm_x = -320
@mpnm_y = 0
elsif MOG::MPNMPS == 1
@mpnm_x = -300
@mpnm_y = 320
elsif MOG::MPNMPS == 2
@mpnm_x = 640
@mpnm_y = 0
else
@mpnm_x = 640
@mpnm_y = 320
end
end
def mpnm_x
return @mpnm_x
end
def mpnm_y
return @mpnm_y
end
def fdtm
if @fdtm <= 0
@fdtm = 0
end
return @fdtm
end
end
############
# Game_Map #
############
class Game_Map
attr_reader :map_id
def mpname
$mpname = load_data("Data/MapInfos.rvdata")
$mpname[@map_id].name
end
end
###############
# Window Base #
###############
class Window_Base < Window
def nd_mapic
mapic = Cache.system("")
end
def draw_mpname(x,y)
mapic = Cache.system("Mpname") rescue nd_mapic
cw = mapic.width
ch = mapic.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch + 65, mapic, src_rect)
self.contents.font.name = MOG::MPFONT
self.contents.font.size = 22
self.contents.font.bold = true
self.contents.font.shadow = true
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x +35, y + 30, 110, 32, $game_map.mpname.to_s,1)
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(x +35, y + 30, 110, 32, $game_map.mpname.to_s,1)
end
end
##########
# Mpname #
##########
class Mpname < Window_Base
def initialize(x , y)
super($game_system.mpnm_x , $game_system.mpnm_y, 250, WLH + 70)
self.opacity = 0
refresh
end
def refresh
self.contents.clear
draw_mpname(0,0)
end
end
#############
# Scene_Map #
#############
class Scene_Map
alias mog_vx06_start start
def start
@mpnm = Mpname.new($game_system.mpnm_x, $game_system.mpnm_y)
@mpnm.contents_opacity = $game_system.fdtm
if $game_switches[MOG::WM_SWITCH_VIS_DISABLE] == false
@mpnm.visible = true
else
@mpnm.visible = false
end
mog_vx06_start
end
alias mog_vx06_terminate terminate
def terminate
mog_vx06_terminate
@mpnm.dispose
end
alias mog_vx06_update update
def update
mog_vx06_update
location_name_update
end
def location_name_update
$game_system.mpnm_x = @mpnm.x
$game_system.mpnm_y = @mpnm.y
if $game_switches[MOG::WM_SWITCH_VIS_DISABLE] == true or $game_system.fdtm <= 0
@mpnm.visible = false
else
@mpnm.visible = true
end
if MOG::MPNMPS == 0 or MOG::MPNMPS == 1
if @mpnm.x < 0
@mpnm.x += 4
elsif @mpnm.x >= 0
@mpnm.x = 0
end
else
if @mpnm.x > 300
@mpnm.x -= 5
elsif @mpnm.x <= 300
@mpnm.x = 300
end
end
@mpnm.contents_opacity = $game_system.fdtm
if MOG::MPNMFD == true
$game_system.fdtm -= 3
end
end
alias mog_vx06_update_transfer_player update_transfer_player
def update_transfer_player
return unless $game_player.transfer?
@mpnm.contents_opacity = 0
mog_vx06_update_transfer_player
if MOG::MPNMPS == 0
$game_system.mpnm_x = -340
$game_system.mpnm_y = 0
elsif MOG::MPNMPS == 1
$game_system.mpnm_x = -340
$game_system.mpnm_y = 320
elsif MOG::MPNMPS == 2
$game_system.mpnm_x = 640
$game_system.mpnm_y = 0
else
$game_system.mpnm_x = 640
$game_system.mpnm_y = 320
end
@mpnm.y = $game_system.mpnm_y
@mpnm.x = $game_system.mpnm_x
$game_system.fdtm = 235 + 60 * MOG::MPNMTM
@mpnm.refresh
end
end
$mogscript = {} if $mogscript == nil
$mogscript["location_name_vx"] = true
复制代码
使用方法很简单,趁着无聊,顺便帮你做一个背景图片。
自己挑挑里面的坐标把显示位置弄合适就行了。
图片名"mpname",放Graphics/System里
mpname.png
(15.43 KB, 下载次数: 36)
下载附件
保存到相册
2012-12-20 14:07 上传
作者:
怪蜀黍
时间:
2012-12-20 14:09
改好了,拿走吧
Scripts.rvdata
(215.14 KB, 下载次数: 14)
2012-12-20 14:09 上传
点击文件名下载附件
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1