じ☆ve冰风 发表于 4 天前

关于DataManager.save_game(1)无法生成存档文件的问题


如图,一般使用这条指令会生成一个Save02.rvdata2文件
可是在加了Khas灯光脚本之后,再次使用同样的指令却无法生成文件。
因为我做的游戏不允许玩家自己存档,是到了特定的剧情由系统自动存档,于是便打算使用这条指令。
请问有什么办法能让这条指令兼容Khas灯光脚本,或Khas灯光脚本兼容这个指令吗?
以下是我的Khas灯光脚本:(由于不会弄那个脚本展示栏啥的,我就直接复制上来了。)

=begin
#-------------------------------------------------------------------------------
# * Khas Awesome Light Effects
#-------------------------------------------------------------------------------
# * 作者 Khas Arcthunder - arcthunder.site40.net
# * 版本: 1.0 EN
# * Released on: 17/01/2012
#
#-------------------------------------------------------------------------------
# * Terms of Use
#-------------------------------------------------------------------------------
# When using any Khas script, you agree with the following terms:
# 1. You must give credit to Khas;
# 2. All Khas scripts are licensed under a Creative Commons license;
# 3. All Khas scripts are for non-commercial projects. If you need some script
#    for your commercial project (I accept requests for this type of project),
#    send an email to with your request;
# 4. All Khas scripts are for personal use, you can use or edit for your own
#    project, but you are not allowed to post any modified version;
# 5. You can’t give credit to yourself for posting any Khas script;
# 6. If you want to share a Khas script, don’t post the direct download link,
#    please redirect the user to arcthunder.site40.net
#
#-------------------------------------------------------------------------------
# * 特点
#-------------------------------------------------------------------------------
# - 真实的灯光
# - 灯光不会穿过墙、遮挡物和天花板
# - 静态光源
# - 动态光源(角色手电)
# - 多种效果
# - 使用简单 (注释)
#
#-------------------------------------------------------------------------------
# * 警告 - 表现效果
#-------------------------------------------------------------------------------
# 这个脚本对于老人机杀伤力巨大! 本脚本测试于 Core 2 Duo E4500 和 Core i5,
# 以下为会影响表现效果的地方:
#
# 1. 地图大小
# 本脚本会在地图表面搜索,为了剪切灯光图片.大地图会增加表面的读取,影响动态光源
的表现效果。地图大小不会影响静态灯光的效果。

#
# 2. 灯光效果数量
# 本脚本在屏幕上绘制,绘制之前还会判断灯光效果是否在屏幕之外。
(在地图外的话脚本将不会绘制超出的灯光效果). 太多灯光将会使游戏卡吨,这是我猜的。

# 3. 灯光效果图片大小
# 图片越大,将其绘制成动态光源耗时越长,建议图片最大为200x200像素
#-------------------------------------------------------------------------------
# * 注意 - 灯光的图片
#-------------------------------------------------------------------------------
#      1. 图片大小必须是2的倍数 例如: 150x150
#      2. 图片长宽相等,例如: 156x156
#      3. 图片颜色必须要反色
#-------------------------------------------------------------------------------
# * 介绍 - 1. 设定你的效果!
#-------------------------------------------------------------------------------
#
# 189行为灯光设定
# 查看默认效果来学习如何使用.
#
#-------------------------------------------------------------------------------
# * 介绍 - 2. 使用你设定的效果!
#-------------------------------------------------------------------------------
# 在事件中添加注释
#
#
#
# x为效果ID
#
#-------------------------------------------------------------------------------
# * 介绍 - 3. 灯笼效果!
#-------------------------------------------------------------------------------
# 动态光源(灯笼)默认是不可见的,这需要你使用脚本呼出来显示灯笼T:
#
# l = $game_map.lantern
#
   将手灯放入变量

# l.set_graphic(i)
#
#   设定灯笼的图片为i,i为在Graphics/Lights里的灯笼图片名

# l.set_multiple_graphics(h)
# 将灯笼的图片设定为 h, h必须在下面的哈希表中填写有
# 结构:
#
# h = {2=>"ld",4=>"ll",6=>"lr",8=>"lu"}
#
# 其中:
# "ld" 当用灯笼的角色向下看时的灯光图片
# "ll" 当用灯笼的角色向左看时的灯光图片
# "lr" 当用灯笼的角色向右看时的灯光图片
# "lu" 当用灯笼的角色向上看时的灯光图片
#
# l.change_owner(角色)
# 将灯笼的主人交给某一角色. 角色必须为以下:

# $game_player            蓝色含量;
#
# s.set_alpha(a)
# 立即改变画面颜色为 a.
#
# s.change_color(时间,r,g,b)
# 在一定时间内逐渐改变画面颜色, 其中:
# 时间 => 变成黑夜的时间 (帧);
# r => 红色含量;
# g => 绿色含量;
# b => 蓝色含量;
#
# s.change_color(时间,r,g,b,a)
# 在一定时间内逐渐改变画面颜色和不透明度, 其中:
# 时间 => 变成黑夜的时间 (帧);
# r => 红色含量;
# g => 绿色含量;
# b => 蓝色含量;
# a => 不透明度
#
# s.change_alpha(时间,a)
# 在一定时间内逐渐改变表面不透明度, where:
# 时间 => 变成黑夜的时间 (帧);
# a => 不透明度
#
#-------------------------------------------------------------------------------
# * 介绍 - 5. 更改画面色调!
#-------------------------------------------------------------------------------
# 你可以使用事件命令中的更改画面色调,请将204行的"Surface_UE" 设定改为 true.
#
# 如果你决定使用这个功能, 请设置一些细节:
# 1. 颜色的数值必须在 0 到 255;
# 2. 时间按帧计算;
# 3. "灰色" 值将等同于不透明度的数值
#
#-------------------------------------------------------------------------------
# * Instructions - 6. 设定你的图块标志!
#-------------------------------------------------------------------------------
# 为了使效果图片有遮挡效果, 地图有三种遮挡效果: 墙, 障碍和屋顶.
#   墙会和真的墙一样有影子, 所以要和障碍与屋顶区分开来.
#
#
#-------------------------------------------------------------------------------
# * Setup Part
#-------------------------------------------------------------------------------
=end
module Light_Core
Effects = { #   [图片,不透明度,变化,裁剪图片],    在事件中使用,效果的ID.
# 图片 => 在 Graphics/Lights 文件夹里;
# 不透明度 => 灯光效果的不透明度;
# 变化 => 灯光效果的不透明度变化(闪烁);
# 裁剪图片 => true:裁剪,false:不裁剪;(制造光线被墙壁遮挡的效果)

# X => [图片,不透明度,变化,裁剪]
0 => ["light",255,0,true],
1 => ["torch",200,20,true],
2 => ["torch_m",255,0,true],
3 => ["light_R",255,0,true],
4 => ["light_B",255,0,true],
5 => ["light_l",200,50,true],
6 => ["light",100,0,true],
7 => ["light",180,0,true],
#-------------------------------------------------------------------------------
# 其他设定
#-------------------------------------------------------------------------------
} #sb,4=>sb,6=>sb,8=>sb}
    Light_Bitcore.push(sb)
    @bitmap = {2=>Light_Bitcore[@key].clone,4=>Light_Bitcore[@key].clone,6=>Light_Bitcore[@key].clone,8=>Light_Bitcore[@key].clone}
    @range = @bitmap.width/2
    @w = @bitmap.width
    @h = @bitmap.height
    @mr = @range - 16
end
def set_multiple_graphics(ba)
    dispose
    @key = ba
    @key.values.each {|key| Light_Bitcore.push(key)}
    @bitmap = {2=>Light_Bitcore[@key].clone,4=>Light_Bitcore[@key].clone,6=>Light_Bitcore[@key].clone,8=>Light_Bitcore[@key].clone}
    @range = @bitmap.width/2
    @w = @bitmap.width
    @h = @bitmap.height
    @mr = @range - 16
end
def get_graphic
    return @bitmap[@char.direction].clone
end
def show
    return if @bitmap.nil?
    @visible = true
end
def hide
    @visible = false
end
def restore
    return if @key.nil?
    @key.values.each {|key| Light_Bitcore.push(key)}
    @bitmap = {2=>Light_Bitcore[@key].clone,4=>Light_Bitcore[@key].clone,6=>Light_Bitcore[@key].clone,8=>Light_Bitcore[@key].clone}
end
def dispose
    return if @bitmap.nil?
    @bitmap.values.each { |b| b.dispose }
    @bitmap = nil
end
def change_owner(char)
    @char = char
end
def render
end
def sx
    return $game_map.adjust_x(@char.real_x)*32-@mr
end
def sy
    return $game_map.adjust_y(@char.real_y)*32-@mr
end
def x
    return (@char.real_x*32 - @mr).to_f
end
def y
    return (@char.real_y*32 - @mr).to_f
end
end
class Light_Surface
def initialize
    @ta = @a = 0
    @tr = @r = 255
    @tg = @g = 255
    @tb = @b = 255
    @va = @vr = @vg = @vb = 0.0
    @timer = 0
end
def refresh
    return if @timer == 0
    @a += @va
    @r += @vr
    @g += @vg
    @b += @vb
    $game_map.light_surface.opacity = @a
    @timer -= 1
end
def change_color(time,r,g,b,a=nil)
    r = 0 if r < 0; r = 255 if r > 255
    g = 0 if g < 0; g = 255 if g > 255
    b = 0 if b < 0; b = 255 if b > 255
    unless a.nil?
      a = 0 if a < 0; a = 255 if a > 255
    end
    @timer = time
    @tr = 255-r
    @tg = 255-g
    @tb = 255-b
    @va = (a.nil? ? 0 : (a-@a).to_f/@timer)
    @vr = (@tr - @r).to_f/@timer
    @vg = (@tg - @g).to_f/@timer
    @vb = (@tb - @b).to_f/@timer
end
def change_alpha(time,a)
    a = 0 if a < 0; a = 255 if a > 255
    @timer = time
    @ta = a
    @vr = @vg = @vb = 0.0
    @va = (a-@a).to_f/@timer
end
def set_color(r,g,b)
    r = 0 if r < 0; r = 255 if r > 255
    g = 0 if g < 0; g = 255 if g > 255
    b = 0 if b < 0; b = 255 if b > 255
    @tr = @r = 255-r
    @tg = @g = 255-g
    @tb = @b = 255-b
    @va = @vr = @vg = @vb = 0.0
    @timer = 0
end
def set_alpha(a)
    a = 0 if a < 0; a = 255 if a > 255
    @ta = @a = a
    $game_map.light_surface.opacity = @a
    @va = @vr = @vg = @vb = 0.0
    @timer = 0
end
def alpha
    return @a
end
def color
    return Color.new(@r,@g,@b)
end
end
class Game_Map
include Light_Core
attr_accessor :light_surface
attr_accessor :light_sources
attr_accessor :surfaces
attr_accessor :effect_surface
attr_accessor :lantern
alias kbl_setup_events setup_events
alias kbl_initialize initialize
alias kbl_update update
def initialize
    kbl_initialize
    @effect_surface = Light_Surface.new
    @lantern = Light_DSource.new
end
def update(arg)
    @effect_surface.refresh if arg
    kbl_update(arg)
end
def first_tag(x,y)
    tag = tileset.flags >> 12
    return tag > 0 ? tag : 0
end
def setup_events
    @light_sources.nil? ? @light_sources = [] : @light_sources.clear
    setup_surfaces
    merge_surfaces
    kbl_setup_events
end
def setup_surfaces
    @surfaces = []
    for x in 0..(width-1)
      for y in 0..(height-1)
      tag = first_tag(x,y)
      if tag == Wall_Tag
          i = tile_id(x,y,0)
          if i & 0x02 == 0x02
            @surfaces
页: [1]
查看完整版本: 关于DataManager.save_game(1)无法生成存档文件的问题