Project1
标题:
公共事件自制菜单的方法是否和XP一样?
[打印本页]
作者:
jy03037318
时间:
2009-1-22 08:51
标题:
公共事件自制菜单的方法是否和XP一样?
我感觉不太一样!
我只需要 存档和结束 这两个选项, 我按照XP那样做对不对?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
001:并行处理
名称: 目标: 条件开关:
并行处理 并行处理 0007:游戏开始
执行内容:
条件分歧:按钮 B 被按下时
开关操作: [0008:菜单] = ON
开关操作: [0007:游戏开始] = OFF
分歧结束
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
002:菜单
名称: 目标: 条件开关:
菜单 自动执行 0008:菜单
执行内容:
文章:需要怎样?
显示选择项:存档,结束,取消
[存档] 的场合
播放SE: …………
打开存档画面
[结束] 的场合
游戏结束
[取消] 的场合
分歧结束
开关操作: [0008:菜单] = OFF
开关操作: [0007:游戏开始] = ON
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
我这样做之后游戏中储存的时候有时会显示
脚本'Scene-File'的第 223 行发生了 TypeError。
no marshal_dump is defined for class Sprite
就是这句 Marshal.dump($game_player, file) 有问题
不是每次储存都会出现,有时好好的,但是有时就会出现这种情况,为什么会这样??
这一句到底是什么意思呢?
[LINE]1,#dddddd[/LINE]
版务信息:本贴由楼主自主结贴~
作者:
雪流星
时间:
2009-1-22 09:30
上传工程看看
公共事件应该一样
可能是你的脚本哪里出了问题
作者:
jy03037318
时间:
2009-1-22 23:12
既然一样,那为什么我使用这个 公共事件 自制的 存档 和 结束 就会出现这个问题
而如果我不使用这个公共事件,用 默认菜单 储存或结束 的话就什么问题都没有呢
顺便问一句~怎么上传工程
作者:
越前リョーマ
时间:
2009-1-22 23:30
应该是你脚本改错了吧,
事件是没区别的。
作者:
jy03037318
时间:
2009-1-23 00:41
我没改过脚本,上面说了~我用这个公共事件就会出现这个
脚本'Scene-File'的第 223 行发生了 TypeError。
no marshal_dump is defined for class Sprite
如国不用就什么事都没~~~这怎么解释呢??
作者:
jy03037318
时间:
2009-1-23 05:29
更正一下!!
现在我用默认的储存方法也会出现这个问题,我在地图1储存一下,然后场景移动,到地图2,如果储存的话就会出错!!
我现在极度郁闷这到底是什么引起的!!我就用了这4个脚本
升级提示:
#=======================================================================
#★升级提示★
#-----------------------------------------------------------------------
#★作者: Zhong_zw
#★联系方式:66RPG.com论坛短信 或
[email protected]
#=======================================================================
class Game_Actor < Game_Battler
attr_accessor :last_level
def initialize(actor_id)
super()
setup(actor_id)
@last_level = 0
@last_skill_id = 0
end
def last_atk
return actor.parameters[2,@last_level]
end
def last_def
return actor.parameters[3,@last_level]
end
def last_spi
return actor.parameters[4,@last_level]
end
def last_agi
return actor.parameters[5,@last_level]
end
def now_atk
return actor.parameters[2,@level]
end
def now_def
return actor.parameters[3,@level]
end
def now_spi
return actor.parameters[4,@level]
end
def now_agi
return actor.parameters[5,@level]
end
def change_exp(exp, show)
@last_level = @level
last_skills = skills
@exp = [[exp, 9999999].min, 0].max
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
level_up
end
while @exp < @exp_list[@level]
level_down
end
@hp = [@hp, maxhp].min
@mp = [@mp, maxmp].min
if show and @level > last_level
zhonglevelup_push(skills - last_skills)
end
end
#==========================================================================
#★角色升级显示
#==========================================================================
def zhonglevelup_push(new_skills)
text = [@actor_id,new_skills]
$game_temp.levelup_texts.push(text)
end
end
class Scene_Battle < Scene_Base
def display_level_up
exp = $game_troop.exp_total
$game_party.remove_states_battle
@message_window.contents_opacity = 0
@message_window.opacity = 0
@levelup_window = Window_zhonglevelup.new
for actor in $game_party.existing_members
last_level = actor.level
last_skills = actor.skills
actor.gain_exp(exp, true)
end
update_zhonglevelup
end
#==========================================================================
#★等待升级窗口刷新
#==========================================================================
def update_zhonglevelup
@levelup_window.update
while @levelup_window.visible
@levelup_window.update
Graphics.update
Input.update
end
end
end
class Game_Temp
attr_accessor :levelup_texts
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias oldinitialize initialize
def initialize
@levelup_texts = []
oldinitialize
end
end
class Window_zhonglevelup < Window_Base
attr_accessor :index
def initialize
super(122, 15, 350, 345)
$game_temp.levelup_texts = []
@index = 0
@skill_index = 0
@skill_window = Window_Base.new(122,23,260,36)
@skill_window.opacity = 0
@skill_window.z = self.z - 1
@main_window = Window_Base.new(122,59,260,290)
@main_window.opacity = 0
@main_window.z = self.z - 1
self.opacity = 0
self.visible = false
#update
end
#--------------------------------------------------------------------------
# ★ $game_temp.levelup_texts = [角色id,新特技]
#--------------------------------------------------------------------------
def update
zhonginputupdate if @index <= $game_temp.levelup_texts.size-1
if @index <= $game_temp.levelup_texts.size-1
self.visible = true
@main_window.opacity = 150
actor = $game_actors[$game_temp.levelup_texts[@index][0]]
if @skill_index == 0 and $game_temp.levelup_texts[@index][1].size != 0
@skill_index = $game_temp.levelup_texts[@index][1].size
end
level = actor.level
last_level = actor.last_level
atk = actor.now_atk
now_def = actor.now_def
spi = actor.now_spi
agi = actor.now_agi
last_atk = actor.last_atk
last_def = actor.last_def
last_spi = actor.last_spi
last_agi = actor.last_agi
self.contents.clear
# x = 122
# y = 58
@skill_window.opacity = $game_temp.levelup_texts[@index][1].size != 0 ? 150 : 0
skill_name = $game_temp.levelup_texts[@index][1][@skill_index - 1].name if @skill_index != 0
level_name = Vocab::level
atk_name = Vocab::atk
def_name = Vocab::def
spi_name = Vocab::spi
agi_name = Vocab::agi
font = self.contents.font.size
x = 5
y = 165
self.contents.draw_text(x,y,60,60,atk_name)
self.contents.draw_text(x,y+30,60,60,def_name)
self.contents.draw_text(x,y+60,60,60,spi_name)
self.contents.draw_text(x,y+90,60,60,agi_name)
self.contents.draw_text(x + 45,y,60,60, last_atk)
self.contents.draw_text(x + 45,y+30,60,60,last_def)
self.contents.draw_text(x + 45,y+60,60,60,last_spi)
self.contents.draw_text(x + 45,y + 90,60,60,last_agi)
self.contents.draw_text(x,y-30,60,60,level_name)
self.contents.draw_text(x + 45,y-30,60,60,last_level)
self.contents.font.color = Color.new(0,255,0,255)
self.contents.draw_text(x + 105,y-30,60,60,level)
bitmap_5 = Bitmap.new("Graphics/system/箭头")
rect_5 = Rect.new(0,0,bitmap_5.width,bitmap_5.height)
self.contents.blt(x + 70,y - 18,bitmap_5,rect_5)
if atk > last_atk
self.contents.draw_text(x+105,y,60,60,atk)
atk_opacity = 255
else
atk_opacity = 0
end
bitmap_1 = Bitmap.new("Graphics/system/箭头")
rect_1 = Rect.new(0,0,bitmap_1.width,bitmap_1.height)
self.contents.blt(x+70,y+12,bitmap_1,rect_1,atk_opacity)
if now_def > last_def
self.contents.draw_text(x+105,y+30,60,60,now_def)
def_opacity = 255
else
def_opacity = 0
end
bitmap_2 = Bitmap.new("Graphics/system/箭头")
rect_2 = Rect.new(0,0,bitmap_1.width,bitmap_1.height)
self.contents.blt(x+70,y+42,bitmap_1,rect_1,def_opacity)
if spi > last_spi
self.contents.draw_text(x+105,y+60,60,60,spi)
spi_opacity = 255
else
spi_opacity = 0
end
bitmap_3 = Bitmap.new("Graphics/system/箭头")
rect_3 = Rect.new(0,0,bitmap_1.width,bitmap_1.height)
self.contents.blt(x+70,y+72,bitmap_1,rect_1,spi_opacity)
if agi > last_agi
self.contents.draw_text(x + 105,y + 90,60,60,agi)
agi_opacity = 255
else
agi_opacity = 0
end
bitmap_4 = Bitmap.new("Graphics/system/箭头")
rect_4 = Rect.new(0,0,bitmap_1.width,bitmap_1.height)
self.contents.blt(x+70,y+102,bitmap_1,rect_1,agi_opacity)
self.contents.font.color = normal_color
self.contents.font.size = 16
self.contents.draw_text(60, -19, 120, 60,"学会了 #{skill_name}")if @skill_index != 0
self.contents.font.color = Color.new(255,255,0,255)
self.contents.draw_text(61, -19,120,60," #{skill_name}")
self.contents.font.size = font
draw_face(actor.face_name, actor.face_index,3, 55, size = 80)
draw_actor_name(actor, 92, 55)
draw_actor_hp(actor, 95, 85)
draw_actor_mp(actor, 95, 115)
self.contents.font.color = normal_color
actor.hp = [actor.maxhp,9999].min
actor.mp = [actor.maxmp,9999].min
else
@main_window.visible = false
@skill_window.visible =false
self.visible = false
end
end
#==========================================================================
#★窗口按键刷新
#==========================================================================
def zhonginputupdate
if Input.trigger?(Input::DOWN)
if @skill_index != 0
@skill_index -= 1
end
@index += 1 if @skill_index == 0
end
if Input.trigger?(Input::UP)
if @skill_index != 0
@skill_index -= 1
end
@index += 1 if @skill_index == 0
end
if Input.trigger?(Input::RIGHT)
if @skill_index != 0
@skill_index -= 1
end
@index += 1 if @skill_index == 0
end
if Input.trigger?(Input::LEFT)
if @skill_index != 0
@skill_index -= 1
end
@index += 1 if @skill_index == 0
end
if Input.trigger?(Input::B)
if @skill_index != 0
@skill_index -= 1
end
@index += 1 if @skill_index == 0
end
if Input.trigger?(Input::C)
if @skill_index != 0
@skill_index -= 1
end
@index += 1 if @skill_index == 0
end
end
#==========================================================================
def dispose
super
@skill_window.dispose
@main_window.dispose
end
end
class Scene_Map < Scene_Base
def start
super
$game_map.refresh
@spriteset = Spriteset_Map.new
@message_window = Window_Message.new
@levelup_window = Window_zhonglevelup.new
@lus_window = Window_Base.new(122,23,260,36)
@m_window = Window_Base.new(122,59,260,290)
@m_window.opacity = 0
@lus_window.opacity = 0
@m_window.z = 9998
@lus_window.z = 9998
@levelup_window.z = 9999
end
def update
super
$game_map.interpreter.update
$game_map.update
$game_player.update
$game_system.update
@spriteset.update
@message_window.update
unless $game_message.visible
update_levelup_window
update_transfer_player
update_encounter
update_call_menu
update_call_debug
update_scene_change
end
end
def update_levelup_window
@levelup_window.update
while @levelup_window.visible
@lus_window.opacity = $game_temp.levelup_texts[@levelup_window.index][1].size != 0 ? 150 : 0
@m_window.opacity = 150
@levelup_window.update
Graphics.update
Input.update
end
@m_window.opacity = 0
@lus_window.opacity = 0
end
def terminate
super
if $scene.is_a?(Scene_Battle) # バトル画面に切り替え中の場合
@spriteset.dispose_characters # 背景作成のためにキャラを隠す
end
snapshot_for_background
@spriteset.dispose
@message_window.dispose
@levelup_window.dispose
@m_window.dispose
@lus_window.dispose
if $scene.is_a?(Scene_Battle) # バトル画面に切り替え中の場合
perform_battle_transition # 戦闘前トランジション実行
end
end
end
复制代码
自动显示地图名
#====================================================================
#★显示地名脚本
#--------------------------------------------------------------------
#★作者:Zhong_Zw
#★联系方式:66rpg.com论坛短信 或
[email protected]
#★注:与站上的肯定有区别,因为是我默写的,如有雷同,纯属巧合!
#=====================================================================
SWICHES = 3
class Mapname_window < Window_Base
def initialize
super(0, 0, 280, WLH + 64)
self.opacity = 0
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.size = 32
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(1,1,120,32,$game_map.name,2)
self.contents.font.color = normal_color
self.contents.draw_text(0,0,120,32,$game_map.name,2)
end
def update
super
refresh
end
end
class Game_Map
attr_accessor :name
def setup(map_id)
@map_id = map_id
@map = load_data(sprintf("Data/Map%03d.rvdata", @map_id))
@mapinfo = load_data("Data/MapInfos.rvdata")
#============================
@name = @mapinfo[@map_id].name
#============================
@display_x = 0
@display_y = 0
@passages = $data_system.passages
referesh_vehicles
setup_events
setup_scroll
setup_parallax
@need_refresh = false
end
end
class Scene_Map < Scene_Base
alias oldstart start
def start
oldstart
@mapname_window = Mapname_window.new
@mapname_window.x = 272
@levelup_window = Window_zhonglevelup.new
@lus_window = Window_Base.new(122,23,260,36)
@m_window = Window_Base.new(122,59,260,290)
@m_window.opacity = 0
@lus_window.opacity = 0
@m_window.z = 9998
@lus_window.z = 9998
@levelup_window.z = 9999
@last_mapname = $game_map.name
unless $game_switches[SWICHES]
@mapname_window.opacity = 0
@mapname_window.contents_opacity = 0
end
end
def update
super
$game_map.interpreter.update
$game_map.update
$game_player.update
$game_system.update
@spriteset.update
@message_window.update
if @last_name != $game_map.name
@last_name = $game_map.name
if $game_switches[SWICHES]
@mapname_window.update
#@mapname_window.opacity = 200
@mapname_window.x = 272
@mapname_window.contents_opacity = 255
end
end
if @mapname_window.x <= 440
@mapname_window.x += 1
# @mapname_window.opacity -= 2
@mapname_window.contents_opacity -= 2
end
unless $game_message.visible
update_levelup_window
update_transfer_player
update_encounter
update_call_menu
update_call_debug
update_scene_change
end
end
def update_levelup_window
@levelup_window.update
while @levelup_window.visible
@lus_window.opacity = $game_temp.levelup_texts[@levelup_window.index][1].size != 0 ? 150 : 0
@m_window.opacity = 150
@levelup_window.update
Graphics.update
Input.update
end
@m_window.opacity = 0
@lus_window.opacity = 0
end
alias oldterminate terminate
def terminate
@mapname_window.dispose
oldterminate
end
end
复制代码
路牌提示:
#==============================================================================
# 路牌提示系统 by 沉影不器
#------------------------------------------------------------------------------
# 功能说明:
# 仿照《黑暗圣剑传说2 序章》(柳柳)的介绍里提到的效果写的,据说是空之轨迹里的效果
# 原游戏的实现方式是公共事件播放动画, 以下引用原描述:
# "方便玩家的路牌设计, 当靠近路牌的时候, 路牌就会指引玩家的方向"
#------------------------------------------------------------------------------
# 使用说明(详见范例工程):
# ① 制作路牌皮肤文件, 包含三个文件(64×64的窗体和两个箭头标志)
# ② 在地图上创建路牌事件, 并在事件中用注释写上指路内容, 允许多项
# ③ 指路内容格式为(忽略空格): 方向代号 = 该方向所指向的名称
# 其中方向代号为: 2 4 6 8
# 例: 2 = 悦来客栈 显示"↓ 悦来客栈"
# ④ 创建与路牌事件同名的区域, 表示玩家进入该区域时激活相应路牌
#==============================================================================
# □ Spriteset_Roadsign
#==============================================================================
class Spriteset_Roadsign
#--------------------------------------------------------------------------
# ○ 参数设定
#--------------------------------------------------------------------------
WIDTH_MIN = 96 # 窗体最小宽度
SHOW_TIME = 60 # 窗体显示时间
FONT = "黑体" # 字体
FONT_SIZE = 14 # 字体大小
FONT_SHADOW = false # 字体阴影
FONT_COLOR = Color.new(0,0,0) # 字体颜色
SIGN_SKIN = "Roadsign" # 路牌皮肤
SKIN_SIZE = 8 # 皮肤厚度(边框)
SIGN_OPACITY = 192 # 路牌不透明度
X_ADJ = 0 # 路牌箭头坐标微调
Y_ADJ = 0
#--------------------------------------------------------------------------
# ○ 初始化对象
# event : 事件
#--------------------------------------------------------------------------
def initialize(event)
@event = event
# 显示控制符
@show = true
# 显示时间计数
@show_count = 0
# 相对定位
@x_plus = 0
@y_plus = 0
# 描绘内容
@texts = get_texts
# 主'窗体'
@base_sprite = Sprite.new
@base_sprite.z = 999
@base_sprite.opacity = 0
# 大小和尺寸
set_size
get_pos
reset_pos
# 描绘皮肤
draw_skin
refresh
end
#--------------------------------------------------------------------------
# ○ 释放
#--------------------------------------------------------------------------
def dispose
@base_sprite.bitmap.dispose
@base_sprite.dispose
@arrow_sprite.bitmap.dispose
@arrow_sprite.dispose
end
#--------------------------------------------------------------------------
# ○ 是否释放
#--------------------------------------------------------------------------
def disposed?
return @base_sprite.disposed?
end
#--------------------------------------------------------------------------
# ○ 更新画面
#--------------------------------------------------------------------------
def update
# 跟随路牌
reset_pos
# 显示期
if @show_count > 0
@show_count -= 1
return
end
# 开始显示期
if @base_sprite.opacity >= 255
@show_count = SHOW_TIME
@show = false
end
# 显示中或隐藏中
if @show
@base_sprite.opacity += 8 if @base_sprite.opacity < 255
else
@base_sprite.opacity -= 8 if @base_sprite.opacity > 0
end
@arrow_sprite.opacity = @base_sprite.opacity
# 自释放
self.dispose if !@show and @base_sprite.opacity <= 0
end
#--------------------------------------------------------------------------
# ○ 获取描绘文本
#--------------------------------------------------------------------------
def get_texts
down = @event.read_roadsign("2")
left = @event.read_roadsign("4")
right = @event.read_roadsign("6")
up = @event.read_roadsign("8")
texts = []
texts.push("↓ " + down) if down != ""
texts.push("← " + left) if left != ""
texts.push("→ " + right) if right != ""
texts.push("↑ " + up) if up != ""
return texts
end
#--------------------------------------------------------------------------
# ○ 创建位图
#--------------------------------------------------------------------------
def create_bitmap(width, height)
@base_sprite.bitmap = Bitmap.new(width, height)
# 字体设定
@base_sprite.bitmap.font = Font.new(FONT, FONT_SIZE)
@base_sprite.bitmap.font.shadow = FONT_SHADOW
@base_sprite.bitmap.font.color = FONT_COLOR
end
#--------------------------------------------------------------------------
# ○ 设定尺寸
#--------------------------------------------------------------------------
def set_size
# 最小宽度
width = WIDTH_MIN
# 测试宽度的临时位图
test_bitmap = Bitmap.new(1, 1)
test_bitmap.font = Font.new(FONT, FONT_SIZE)
for text in @texts
c_width = test_bitmap.text_size(text).width
width = c_width if c_width > width
end
height = @texts.size * line_height
create_bitmap(width+SKIN_SIZE*2, height+SKIN_SIZE*2)
# 释放临时位图
test_bitmap.dispose
end
#--------------------------------------------------------------------------
# ○ 获取坐标
#--------------------------------------------------------------------------
def get_pos
x = @event.screen_x - width/2
if @event.screen_y > height
y = @event.screen_y - height - 32
# 箭头类型标志
up = true
else
y = @event.screen_y
# 箭头类型标志
up = false
end
# 相对定位
@x_plus = x - @event.screen_x
@y_plus = y - @event.screen_y
set_arrow_sprite(up)
end
#--------------------------------------------------------------------------
# ○ 重设坐标
#--------------------------------------------------------------------------
def reset_pos
# 相对定位
@base_sprite.x = @event.screen_x + @x_plus
@base_sprite.y = @event.screen_y + @y_plus
@arrow_sprite.x = @event.screen_x - 16 + X_ADJ
@arrow_sprite.y = @event.screen_y - 32 + Y_ADJ
end
#--------------------------------------------------------------------------
# ○ 设定箭头
#--------------------------------------------------------------------------
def set_arrow_sprite(up = true)
@arrow_sprite = Sprite.new
@arrow_sprite.opacity = 0
# 上下两套箭头
case up
when true
bitmap = Cache.system(SIGN_SKIN + "_arrow_up")
rect = Rect.new(0, 0, bitmap.width, bitmap.height)
@arrow_sprite.bitmap = Bitmap.new(rect.width, rect.height)
@arrow_sprite.bitmap.blt(0, 0, bitmap, rect, SIGN_OPACITY)
when false
bitmap = Cache.system(SIGN_SKIN + "_arrow_down")
rect = Rect.new(0, 0, bitmap.width, bitmap.height)
@arrow_sprite.bitmap = Bitmap.new(rect.width, rect.height)
@arrow_sprite.bitmap.blt(0, 0, bitmap, rect, SIGN_OPACITY)
end
bitmap.dispose
end
#--------------------------------------------------------------------------
# ○ 获取宽度
#--------------------------------------------------------------------------
def width
return @base_sprite.width
end
#--------------------------------------------------------------------------
# ○ 获取高度
#--------------------------------------------------------------------------
def height
return @base_sprite.height
end
#--------------------------------------------------------------------------
# ○ 获取行高
#--------------------------------------------------------------------------
def line_height
return FONT_SIZE + 2
end
#--------------------------------------------------------------------------
# ○ 描绘皮肤
#--------------------------------------------------------------------------
def draw_skin
# 皮肤文件
skin = Cache.system(SIGN_SKIN)
@base_sprite.bitmap.clear
# 描绘角
src_rect = Rect.new(0,0,16,16)
@base_sprite.bitmap.blt(0, 0, skin, src_rect, SIGN_OPACITY)
src_rect = Rect.new(48,0,16,16)
@base_sprite.bitmap.blt(width-16, 0, skin, src_rect, SIGN_OPACITY)
src_rect = Rect.new(0,48,16,16)
@base_sprite.bitmap.blt(0, height-16, skin, src_rect, SIGN_OPACITY)
src_rect = Rect.new(48,48,16,16)
@base_sprite.bitmap.blt(width-16, height-16, skin, src_rect, SIGN_OPACITY)
# 描绘边
dest_rect = Rect.new(16,0,width-32,16)
src_rect = Rect.new(16,0,32,16)
@base_sprite.bitmap.stretch_blt(dest_rect, skin, src_rect, SIGN_OPACITY)
dest_rect = Rect.new(16,height-16,width-32,16)
src_rect = Rect.new(16,48,32,16)
@base_sprite.bitmap.stretch_blt(dest_rect, skin, src_rect, SIGN_OPACITY)
dest_rect = Rect.new(0,16,16,height-32)
src_rect = Rect.new(0,16,16,32)
@base_sprite.bitmap.stretch_blt(dest_rect, skin, src_rect, SIGN_OPACITY)
dest_rect = Rect.new(width-16,16,16,height-32)
src_rect = Rect.new(48,16,16,32)
@base_sprite.bitmap.stretch_blt(dest_rect, skin, src_rect, SIGN_OPACITY)
# 描绘底
dest_rect = Rect.new(16,16,width-32,height-32)
src_rect = Rect.new(16,16,32,32)
@base_sprite.bitmap.stretch_blt(dest_rect, skin, src_rect, SIGN_OPACITY)
# 释放皮肤文件
skin.dispose
end
#--------------------------------------------------------------------------
# ○ 刷新
#--------------------------------------------------------------------------
def refresh
# 逐行
for i in
[email protected]
rect = Rect.new(SKIN_SIZE, i*line_height+SKIN_SIZE, @base_sprite.width, line_height)
text = @texts[i]
@base_sprite.bitmap.draw_text(rect, text)
end
end
end
#==============================================================================
# ■ Game_Event
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# ◎ 定义实例变量
#--------------------------------------------------------------------------
attr_reader :name # 事件名称
attr_accessor :roadsign # 路牌标志
#--------------------------------------------------------------------------
# ◎ 刷新
#--------------------------------------------------------------------------
alias old_refresh refresh
def refresh
# 事件名称
@name = @event.name
# 路牌
@roadsign = ''
old_refresh
end
#-------------------------------------------------------------------------
# ○ 读取路牌指定字段
# section : 字段名
# ignore_caps : 忽略大小写(仅字段名)
#-------------------------------------------------------------------------
def read_roadsign(section, ignore_caps = false)
result = ''
# 忽略大小写时,全部转大写
section.upcase! if ignore_caps
# 转symbol方便比较
s = section.to_sym
@roadsign.each_line{|line|
temp = line.split(/=/)
# 去掉干扰字符
temp.each {|i| i.strip!}
temp[0].upcase! if ignore_caps
if temp[0].to_sym == s
unless temp[1] == nil
result = temp[1]
end
# 如果希望同名字段值覆盖前面的字段,去掉下一行
break
end
}
return result
end
end
#==============================================================================
# ■ Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ◎ 刷新画面
#--------------------------------------------------------------------------
alias old_update update
def update
old_update
# 路牌窗体刷新
unless @roadsign_sprite == nil or @roadsign_sprite.disposed?
@roadsign_sprite.update
end
end
#--------------------------------------------------------------------------
# ◎ 增加步数
#--------------------------------------------------------------------------
alias old_increase_steps increase_steps
def increase_steps
old_increase_steps
# 路牌操作
setup_roadsign_spriteset
end
#--------------------------------------------------------------------------
# ○ 显示路牌
#--------------------------------------------------------------------------
def setup_roadsign_spriteset
name = roadsign_name
return if name == "" or name == @old_name
@old_name = name
event = get_event(name)
return if event == nil
roadsign_event = setup_roadsign_event(event)
return if roadsign_event == nil
# 生成路牌窗体
if @roadsign_sprite == nil or @roadsign_sprite.disposed?
@roadsign_sprite = Spriteset_Roadsign.new(roadsign_event)
end
end
#--------------------------------------------------------------------------
# ○ 设置路牌
# event : 事件(Game_Map内部)
#--------------------------------------------------------------------------
def setup_roadsign_event(event)
return if event.list == nil
for line in event.list
if line.code == 108 or 408
unless line.parameters.empty?
event.roadsign += line.parameters.to_s + "\r\n"
end
end
end
return event
end
#--------------------------------------------------------------------------
# ○ 查找路牌名称
#--------------------------------------------------------------------------
def roadsign_name
for area in $data_areas.values
return area.name if $game_player.in_area?(area)
end
@old_name = ""
return @old_name
end
#--------------------------------------------------------------------------
# ○ 获取事件
# event_name : 事件名
#--------------------------------------------------------------------------
def get_event(event_name)
$game_map.events.each_value {|event|
return event if event.name == event_name}
return nil
end
end
复制代码
作者:
jy03037318
时间:
2009-1-23 05:30
一次发不完 还有这个
截图存档:
#==============================================================================
# vx新截图存档 by 沉影不器
#------------------------------------------------------------------------------
# ☆ 核心部分是内存位图的输入输出
# (快速存储Bitmap的Marshal 作者: 柳之一) 强大啊
#------------------------------------------------------------------------------
# ▼ 相比rmxp正版截图存档(作者: 柳柳),主要变动如下:
# ① 省去了 screenshot.dll 文件 (因快速存储Bitmap的Marshal的存在)
# ② 无须人工新建存档文件夹,脚本将自建
# ③ 方便地更改最大存档数,只需设置最大值
#==============================================================================
MAX_SAVE_ID = 12 # 最大存档数
SAVE_DIR = "Saves/" # 改变的存档目录(不希望改变目录请删)
#==============================================================================
# (快速存储Bitmap的Marshal 作者: 柳之一) 强大啊
#==============================================================================
class Font
def marshal_dump
end
def marshal_load(obj)
end
end
class Bitmap
# 传送到内存的API函数
RtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
RtlMoveMemory_ip = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')
def _dump(limit)
data = "rgba" * width * height
RtlMoveMemory_pi.call(data, address, data.length)
[width, height, Zlib::Deflate.deflate(data)].pack("LLa*") # 压缩
end
def self._load(str)
w, h, zdata = str.unpack("LLa*")
b = self.new(w, h)
RtlMoveMemory_ip.call(b.address, Zlib::Inflate.inflate(zdata), w * h * 4)
return b
end
# [[[bitmap.object_id * 2 + 16] + 8] + 16] == 数据的开头
def address
buffer, ad = "rgba", object_id * 2 + 16
RtlMoveMemory_pi.call(buffer, ad, 4)
ad = buffer.unpack("L")[0] + 8
RtlMoveMemory_pi.call(buffer, ad, 4)
ad = buffer.unpack("L")[0] + 16
RtlMoveMemory_pi.call(buffer, ad, 4)
return buffer.unpack("L")[0]
end
end
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_accessor :save_bitmap # 存档位图
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
alias ini initialize
def initialize
ini
@save_bitmap = Bitmap.new(1, 1)
end
end
#==============================================================================
# ■ Window_SaveFile
#==============================================================================
class Window_SaveFile < Window_Base
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :filename # 文件名
attr_reader :file_exist # 文件存在标志
#--------------------------------------------------------------------------
# ● 初始化对象
# file_index : 存档文件索引 (0~3)
# filename : 文件名
#--------------------------------------------------------------------------
def initialize(file_index, filename)
super(160, 56, 384, 360)
@file_index = file_index
@filename = filename
make_dir(SAVE_DIR) if SAVE_DIR != nil
load_gamedata
refresh(@file_index)
end
#--------------------------------------------------------------------------
# ● 读取部分游戏数据
#--------------------------------------------------------------------------
def load_gamedata
@file_exist = FileTest.exist?(SAVE_DIR + @filename)
if @file_exist
file = File.open(SAVE_DIR + @filename, "r")
begin
@characters = Marshal.load(file)
@frame_count = Marshal.load(file)
@last_bgm = Marshal.load(file)
@last_bgs = Marshal.load(file)
@game_system = Marshal.load(file)
@game_message = Marshal.load(file)
@game_switches = Marshal.load(file)
@game_variables = Marshal.load(file)
@game_self_switches = Marshal.load(file)
@game_actors = Marshal.load(file)
@game_party = Marshal.load(file)
@game_troop = Marshal.load(file)
@game_map = Marshal.load(file)
@game_player = Marshal.load(file)
# 读取截图
@file_bitmap = Marshal.load(file)
@total_sec = @frame_count / Graphics.frame_rate
rescue
@file_exist = false
ensure
file.close
end
end
end
#--------------------------------------------------------------------------
# ● 刷新
# index : 索引
#--------------------------------------------------------------------------
def refresh(index)
file_index = index
self.contents.clear
self.contents.font.color = normal_color
if @file_exist
# 描绘底部阴影
self.contents.fill_rect(12+3, 4+3, 326,249, Color.new(0,0,64))
# 描绘截图
draw_snap_bitmap(12, 4)
draw_party_characters(152, 296)
draw_playtime(0, 296+8, contents.width - 40, 2)
else
self.contents.draw_text(0, 296, 384-32, 24, "无此存档!", 1)
end
end
#--------------------------------------------------------------------------
# ◎ 更改索引
# index : 索引
#--------------------------------------------------------------------------
def file_index=(file_index)
@file_index = file_index
end
#--------------------------------------------------------------------------
# ● 描绘游戏人物
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_party_characters(x, y)
for i in
[email protected]
name = @characters[i][0]
index = @characters[i][1]
draw_character(name, index, x + i * 48, y)
end
end
#--------------------------------------------------------------------------
# ◎ 生成保存路径
# path : 路径
#--------------------------------------------------------------------------
def make_dir(path)
dir = path.split("/")
for i in 0...dir.size
unless dir == "."
add_dir = dir[0..i].join("/")
begin
Dir.mkdir(add_dir)
rescue
end
end
end
end
#--------------------------------------------------------------------------
# ◎ 生成文件名
# file_index : 存档文件索引 (0~3)
#--------------------------------------------------------------------------
def make_filename(file_index)
return "Save#{file_index + 1}.rvdata"
end
#--------------------------------------------------------------------------
# ◎ 描绘截图
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_snap_bitmap(x, y)
bitmap = @file_bitmap
if bitmap == nil
self.contents.draw_text(0, 112, 384-32, 24, "找不到截图文件!", 1)
else
self.contents.blur
rect = Rect.new(0, 0, 0, 0)
rect.width = bitmap.width
rect.height = bitmap.height
self.contents.blt(x, y, bitmap, rect)
end
end
#--------------------------------------------------------------------------
# ● 描绘游戏时间
# x : 描绘目标 X 坐标
# y : 描绘目标 Y 坐标
# width : 宽
# align : 配置
#--------------------------------------------------------------------------
def draw_playtime(x, y, width, align)
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, width, WLH, time_string, 2)
end
end
#==============================================================================
# ■ Scene_Base
#==============================================================================
class Scene_Base
#--------------------------------------------------------------------------
# ◎ 生成存档位图快照
#--------------------------------------------------------------------------
def snapshot_for_save
d_rect = Rect.new(0, 0, 326, 249)
s_rect = Rect.new(0, 0, 544, 416)
save_bitmap = Graphics.snap_to_bitmap
$game_temp.save_bitmap.dispose
$game_temp.save_bitmap = Bitmap.new(326, 249)
$game_temp.save_bitmap.stretch_blt(d_rect, save_bitmap, s_rect)
end
end
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● 结束处理
#--------------------------------------------------------------------------
alias save_terminate terminate
def terminate
snapshot_for_save
save_terminate
end
end
#==============================================================================
# ■ Scene_Title
#==============================================================================
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# ● 判断继续是否有效
#--------------------------------------------------------------------------
def check_continue
@continue_enabled = (Dir.glob(SAVE_DIR + 'Save*.rvdata').size > 0)
end
end
#==============================================================================
# ■ Scene_File
#------------------------------------------------------------------------------
# 处理文件的类。
#==============================================================================
class Scene_File < Scene_Base
#--------------------------------------------------------------------------
# ● 初始化对象
# saving : 存档标志 (false 为载入画面)
# from_title : 调用标题画面的 "继续" 标志
# from_event : 事件的 "调用存档画面" 的调用标志
#--------------------------------------------------------------------------
def initialize(saving, from_title, from_event)
@saving = saving
@from_title = from_title
@from_event = from_event
end
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
create_menu_background
@help_window = Window_Help.new
create_command_window
if @saving
@index = $game_temp.last_file_index
@help_window.set_text(Vocab::SaveMessage)
else
@index = self.latest_file_index
@help_window.set_text(Vocab::LoadMessage)
end
@refresh_index = @command_window.index = @index
@item_max = MAX_SAVE_ID
create_savefile_window
end
#--------------------------------------------------------------------------
# ● 结束处理
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@help_window.dispose
dispose_item_windows
end
#--------------------------------------------------------------------------
# ● 还原至原先的画面
#--------------------------------------------------------------------------
def return_scene
if @from_title
$scene = Scene_Title.new
elsif @from_event
$scene = Scene_Map.new
else
$scene = Scene_Menu.new(4)
end
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
update_menu_background
@help_window.update
update_savefile_windows
update_savefile_selection
end
#--------------------------------------------------------------------------
# ◎ 生成存档文件列表窗口
#--------------------------------------------------------------------------
def create_command_window
file_names = []
digit = MAX_SAVE_ID.to_s.size
str_f = ""
digit.times{|n| str_f += "0"}
str_f[str_f.size-1, 1] = digit.to_s
for i in 0...MAX_SAVE_ID
id = sprintf("%#{str_f}d", i+1)
file_names.push(Vocab::File + "\s" + id)
end
@command_window = Window_Command.new(160, file_names)
@command_window.height = 360
@command_window.y = 56
end
#--------------------------------------------------------------------------
# ● 生成存档文件窗口
#--------------------------------------------------------------------------
def create_savefile_window
@savefile_window = Window_SaveFile.new(@command_window.index, make_filename(@command_window.index))
end
#--------------------------------------------------------------------------
# ● 释放存档文件
#--------------------------------------------------------------------------
def dispose_item_windows
@command_window.dispose
@savefile_window.dispose
end
#--------------------------------------------------------------------------
# ● 更新存档文件窗口
#--------------------------------------------------------------------------
def update_savefile_windows
@command_window.update
@savefile_window.update
end
#--------------------------------------------------------------------------
# ● 更新存档文件选择
#--------------------------------------------------------------------------
def update_savefile_selection
if Input.trigger?(Input::C)
determine_savefile
end
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
end
if @refresh_index != @command_window.index
@refresh_index = @command_window.index
@savefile_window.dispose
create_savefile_window
end
end
#--------------------------------------------------------------------------
# ● 确定存档文件
#--------------------------------------------------------------------------
def determine_savefile
if @saving
Sound.play_save
do_save
else
if @savefile_window.file_exist
Sound.play_load
do_load
else
Sound.play_buzzer
return
end
end
$game_temp.last_file_index = @index
end
#--------------------------------------------------------------------------
# ◎ 生成文件名
# file_index : 存档文件索引
#--------------------------------------------------------------------------
def make_filename(file_index)
return "Save#{file_index + 1}.rvdata"
end
#--------------------------------------------------------------------------
# ● 按时间戳选择最新的文件
#--------------------------------------------------------------------------
def latest_file_index
index = 0
latest_time = Time.at(0) # 时间戳
for i in 0...MAX_SAVE_ID
file_name = make_filename(i)
if FileTest.exist?(SAVE_DIR + file_name)
file = File.open(SAVE_DIR + file_name, "r")
if file.mtime > latest_time
latest_time = file.mtime
index = i
end
end
end
return index
end
#--------------------------------------------------------------------------
# ● 执行存档
#--------------------------------------------------------------------------
def do_save
file_name = make_filename(@command_window.index)
file = File.open(SAVE_DIR + file_name, "wb")
write_save_data(file)
# 保存位图
$file_bitmap = $game_temp.save_bitmap
Marshal.dump($file_bitmap, file)
file.close
return_scene
end
#--------------------------------------------------------------------------
# ● 执行载入
#--------------------------------------------------------------------------
def do_load
file_name = make_filename(@command_window.index)
file = File.open(SAVE_DIR + file_name, "rb")
read_save_data(file)
file.close
$scene = Scene_Map.new
RPG::BGM.fade(1500)
Graphics.fadeout(60)
Graphics.wait(40)
@last_bgm.play
@last_bgs.play
end
end
复制代码
作者:
轩辕民
时间:
2009-1-23 06:28
是不是脚本里面用到的那个没被定义啊?{/bz}
作者:
project999
时间:
2009-1-24 18:03
是文件的问题么?
作者:
越前リョーマ
时间:
2009-1-24 19:05
你删几个别的脚本掉试试,
我估计是脚本冲突。 [LINE]1,#dddddd[/LINE]
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
作者:
jy03037318
时间:
2009-1-25 07:42
果然是脚本冲突~
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1