Project1
标题:
请问如何在对话时同时出现一个窗口显示对话角色的属性等
[打印本页]
作者:
zhangmdk
时间:
2012-12-6 02:47
标题:
请问如何在对话时同时出现一个窗口显示对话角色的属性等
这是一个用于角色升级的地图,与队伍角色对白后可以选择给这个角色升级。
我想让在与角色对白时能出现一个窗口,然后显示这个角色的属性值等信息,请问有没有相关的范例啊?
另外,我使用了一个显示地图信息的脚本,修改成动态显示当前的行动次数等内容,如下:
#==============================================================================
# 地图名及区域名显示 by Beside
#------------------------------------------------------------------------------
# 功能: 动态显示玩家所在区域及地图名。
#==============================================================================
MWINDOW_X = 0 # 窗口X坐标
MWINDOW_Y = 0 # 窗口Y坐标
WEIGH = 545 # 窗口宽度
START_TIME = 30 # 窗口出现时间
COUN_TIME = 300 # 窗口持续时间
FADE_TIME = 30 # 窗口淡去时间
TEXT1_SIZE = 10 # 地图名的字体大小
TEXT2_SIZE = 15 # 区域名的字体大小
TEXT3_SIZE = 15 # 附加名的字体大小
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 + 16
#==============================================================================
# ■ 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
if @map_id==9 || @map_id==11 || @map_id==12 || @map_id==64
#locationname = load_data("Data/MapInfos.rvdata")[@map_id].name
#gametime = Graphics.frame_count / Graphics.frame_rate
kp = $game_variables[41]
daysnum = $game_variables[19]
ct = $game_variables[31]
cs= $game_variables[47]
tb= $game_variables[49]
self.contents.clear
#self.contents.draw_text(4, WLH*0, 150, WLH, "游戏时间:#{gametime}", 0)
#self.contents.draw_text(0, WLH*0, 150, WLH, "资金 #{kp} KP", 0)
#self.contents.draw_text(150, WLH*0, 150, WLH, "今天是第 #{daysnum} 天", 0)
if ct!=0
self.contents.draw_text(2, WLH*0, 500, WLH, "第#{daysnum}天"" ""可行动#{ct}次"" ""◆"" ""资金#{kp}KP"" ""周纯收#{cs}KP"" ""同伴#{tb}人", 0)
else
self.contents.draw_text(2, WLH*0, 500, WLH, "第#{daysnum}天"" ""行动用尽"" ""◆"" ""资金#{kp}KP"" ""周纯收#{cs}KP"" ""同伴#{tb}人", 0)
end
@time_count = START_TIME + COUN_TIME + FADE_TIME
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
else
if self.opacity > 0 || self.contents_opacity > 0
self.opacity -= 255 / FADE_TIME
self.contents_opacity -= 255 / FADE_TIME
@time_count -= 1
end
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
复制代码
原本我想再次利用这个脚本去做这个角色信息窗口,于是复制了一遍并修改了类名。
但运行时发现进入游戏就会出现一个“SystemStackError”的错误,错误地点不一定在哪,而且错误点都在原游戏脚本处,错误内容是“stack level too deep”。
求各位大神帮助。 m(__ __)m
作者:
66zqqqqqq
时间:
2012-12-6 16:05
我也有相同的问题,快来人啊...
作者:
zhangmdk
时间:
2012-12-6 23:03
66zqqqqqq 发表于 2012-12-6 16:05
我也有相同的问题,快来人啊...
用这个吧,我用一个显示地图名的脚本改的
#==============================================================================
# 地图名及区域名显示 by Beside
#------------------------------------------------------------------------------
# 功能: 动态显示玩家所在区域及地图名。
#===============================================================================
START_TIME = 30 # 窗口出现时间
COUN_TIME = 300 # 窗口持续时间
FADE_TIME = 30 # 窗口淡去时间
TEXT1_SIZE = 10 # 地图名的字体大小
TEXT2_SIZE = 15 # 区域名的字体大小
TEXT3_SIZE = 15 # 附加名的字体大小
TEXT1_COLOR = Color.new(255,255,255) # 地图名的默认颜色
TEXT2_COLOR = 0 # 区域名的默认颜色代码(0-31)
TEXT3_COLOR = 0 # 附加名的默认颜色代码(0-31)
SKIN = "window" # 窗口皮肤的文件名
#====人员属性窗口参数定义===================================================
RENYUAN_KEY = 499 #窗口显示开关 默认499
RENYUAN_WINDOW_X = 0 # 窗口X坐标
RENYUAN_WINDOW_Y = 60 # 窗口Y坐标
RENYUAN_WEIGH = 545 # 窗口宽度
RENYUAN_HEIGHT = TEXT1_SIZE + TEXT2_SIZE + TEXT3_SIZE + 16
#==============================================================================
# ■ Window_Map
#------------------------------------------------------------------------------
# 显示当前进度中的所在场景名称的窗口。
#==============================================================================
class Renyuan_Window_Map < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
@id = 0
@a_id = 0
super(RENYUAN_WINDOW_X, RENYUAN_WINDOW_Y, RENYUAN_WEIGH, RENYUAN_HEIGHT)
self.opacity = 0
self.contents_opacity = 0
self.windowskin = Cache.system(SKIN)
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
@map_id = $game_map.map_id
# if ( @map_id==11 || @map_id==12 ) && $game_switches[RENYUAN_KEY] #此处设置出现窗口的地图ID以及出现的开关
if $game_switches[RENYUAN_KEY]
self.contents.draw_text(2, WLH*0, 500, WLH, "内容", 0)
@time_count = START_TIME + COUN_TIME + FADE_TIME
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
else
if self.opacity > 0 || self.contents_opacity > 0
self.opacity -= 255 / FADE_TIME
self.contents_opacity -= 255 / FADE_TIME
@time_count -= 1
end
end
end
end
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
# 处理地图画面的类。
#==============================================================================
class Scene_Map < Scene_Base
alias _start start
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
@renyuan_window = Renyuan_Window_Map.new
_start
end
alias _terminate terminate
def terminate
@renyuan_window.dispose
_terminate
end
alias _update update
def update
@renyuan_window.refresh
_update
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1