设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1932|回复: 5
打印 上一主题 下一主题

[已经过期] 截图存档的问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
16 小时
注册时间
2009-9-20
帖子
232
跳转到指定楼层
1
发表于 2010-9-29 10:58:19 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 p7l8k90 于 2010-9-30 12:15 编辑

这东西很早就出了,相信很多人都看过,没看过的我发下截图,我这里有两个版本,普通的 和石焚刃暖的 ,普通的截图下方是调用角色战斗图片,代码如下:
  1. @sp_ch[i].bitmap = RPG::Cache.battler(@characters[i][3], @characters[i][4])
复制代码
,而石焚刃暖截图下方调用的是Graphics/system/menu/headp/这个文件夹下的与角色战斗图片同名再加_save的图片,代码如下:
  1. @sp_ch[i].bitmap = Bitmap.new("Graphics/system/menu/headp/" + @characters[i][3] + "_save.png")
复制代码
,接下来是问题,因为用了全动画战斗,所以我的角色战斗图片是透明的,即空像素,而由于某种原因,我又不想用石焚那种头像式截图存档,(原因说了也无妨,我做游戏的需要,它是仙剑2续传,我想尽量做的跟原来差不多一些,虽然只是测试版。)我想在截图存档出来的时候调用角色行走图,而且是面向朝右,停止时动画形态的,请问我该怎么办?恩……把整个截图存档脚本发出来吧,这样懂脚本的就都能解答了,恳请大家解答一下,急用,谢谢!截图存档代码(经过我修改的,哦对了,还有个问题,我把存档数目加到了100,它也确实有一百个存档,可问题是到了14号存档往下就看不到了,有是有,可是……怎么说呢?恩……不自动翻页,这么说应该差不多吧,很苦恼,虽然能用但是效果不太好,不,是太不好了,麻烦高手们也顺便解答了,再次拜谢!):
  1. #===============================================================================

  2. BBS_66RPG_DIR = "Save/"  # 储存文件夹名,请制作游戏时自行建立此文件夹

  3. # 若想使用自定义背景图,脚本62行的井号去掉,并放置一张相应图形。

  4. # 在你的Scene_Title中找到这一段(如果使用其他插件脚本,在插件中找):
  5. #    for i in 0..3
  6. #      if FileTest.exist?("Save#{i+1}.rxdata")
  7. # 请自行把0..3改为0..最大进度号,比如0..9
  8. # "Save#{i+1}.rxdata" 改为"Save/Save#{i}.rxdata"

  9. # 增加进度的方法:138,258行,继续添加。你也可以改“进度X”为“回忆X”或者“红/绿/蓝笔记本”

  10. # 注意:这个脚本是兼容亿万星辰的“轩辕剑菜单”的版本,不过用在其他场合貌似也不会出错
  11. #   使用时把这个脚本放在“轩辕剑菜单”脚本的下方,也就是更靠近Main的位置
  12. # 兼容处理:叶子
  13. #===============================================================================
  14. module Screen  
  15. @screen = Win32API.new 'screenshot', 'Screenshot', %w(l l l l p l l), ''
  16. @readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'
  17. @findwindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'
  18. module_function
  19. #-----------------------------------------------------------------------------
  20. # here comes the stuff...
  21. # i add here the stuff for automatic change of the number for the screenshot
  22. # so it wont overrite the old one...
  23. # if you want to change so stuff change them in this line below
  24. # or you can change them in your command line... like
  25. # Screen::shot("screenshot", 2)
  26. # this change the name and the type of the screenshot
  27. # (0 = bmp, 1 = jpg and 2 = png)
  28. # ----------------------------------------------------------------------------
  29. def shot(file = "shot", typ = 1)
  30.   # to add the right extension...
  31.   if typ == 0
  32.     typname = ".bmp"
  33.   elsif typ == 1
  34.     typname = ".jpg"
  35.   elsif typ == 2
  36.     typname = ".png"
  37.   end   
  38.   file_index = 0   
  39.   dir = "Save/"   
  40.   # make the filename....
  41.   file_name = dir + file.to_s + typname.to_s   
  42.   if $shot_guodu == 1
  43.     file_name = "Graphics/Pictures/sys_screen.jpg"
  44.     $shot_guodu = 0
  45.   end
  46.   # make the screenshot.... Attention dont change anything from here on....
  47.   @screen.call(0,0,640,480,file_name,handel,typ)
  48. end
  49. # find the game window...
  50. def handel
  51.   game_name = "\0" * 256
  52.   @readini.call('Game','Title','',game_name,255,".\\Game.ini")
  53.   game_name.delete!("\0")
  54.   return @findwindow.call('RGSS Player',game_name)
  55. end
  56. end

  57. class Window_File < Window_Base
  58. attr_accessor :index
  59. def initialize(index = 0)
  60.   @backsp = Sprite.new
  61.   @backsp.z = 99
  62.   super(160,0,480,480)
  63.   #这行可以不用
  64.   self.contents = Bitmap.new(width - 32, height - 32)
  65.   @index = index
  66.   #这里我要说明一句,之所以用sprite是为了放缩图片
  67.   @sprite = Sprite.new
  68.   @sprite.visible = false
  69.   @sprite.z = 100
  70.   @sp_ch = []
  71.   @sp_ch[0] = Sprite.new
  72.   refresh
  73. end
  74. def refresh
  75.   self.contents.clear
  76.   for i in @sp_ch
  77.     i.visible = false
  78.   end
  79.   @sprite.visible = false
  80.   if FileTest.exist?(BBS_66RPG_DIR+"Save#{@index}.rxdata")
  81.     @sprite.visible = true
  82.     if FileTest.exist?(BBS_66RPG_DIR+"Save#{@index}.jpg")
  83.       @sprite.bitmap = Bitmap.new(BBS_66RPG_DIR+"Save#{@index}.jpg")
  84.     else
  85.       self.contents.draw_text(32,64,400,32,"截图似乎有点问题……您搞什么了您?")
  86.     end
  87.     @sprite.x = 176
  88.     @sprite.y = 16
  89.     @sprite.zoom_x = 0.7
  90.     @sprite.zoom_y = 0.7
  91.     file = File.open(BBS_66RPG_DIR+"Save#{@index}.rxdata", "r")
  92.     @time_stamp = file.mtime
  93.     @gold = Marshal.load(file)
  94.     @save_map_name = Marshal.load(file)
  95.     @characters = Marshal.load(file)
  96.     @frame_count = Marshal.load(file)
  97.     @game_system = Marshal.load(file)
  98.     @game_switches = Marshal.load(file)
  99.     @game_variables = Marshal.load(file)
  100.     @total_sec = @frame_count / Graphics.frame_rate
  101.     file.close
  102.     for i in [email protected]
  103.       @sp_ch[i] = Sprite.new
  104.       @sp_ch[i].visible = true
  105.       @sp_ch[i].bitmap = RPG::Cache.battler(@characters[i][3], @characters[i][4])
  106.       @sp_ch[i].x = 180 + i*42      
  107.       @sp_ch[i].y = 460 - @sp_ch[i].bitmap.height
  108.       @sp_ch[i].z = 101
  109.     end
  110.     # 描绘游戏时间
  111.     hour = @total_sec / 60 / 60
  112.     min = @total_sec / 60 % 60
  113.     sec = @total_sec % 60
  114.     time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  115.     self.contents.font.color = normal_color
  116.     self.contents.draw_text(4, 390, 420 + 16, 32, time_string, 2)
  117.     # 描绘时间标记
  118.     self.contents.font.color = normal_color
  119.     time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  120.     self.contents.draw_text(4, 420, 420 + 16, 32, time_string, 2)
  121.     self.contents.draw_text(4, 420 - 64, 420 + 16, 32, @save_map_name, 2)
  122.     self.contents.draw_text(4, 4, 420 + 16, 32, @gold, 2)
  123.     src_rect = Rect.new(0,0,16,16)
  124.     bitmap = Bitmap.new("Graphics/system/menu/back/money.png")
  125.     self.contents.blt(420 + 16 - @gold.size * 16, 4 + 8, bitmap, src_rect)
  126.   else
  127.     self.contents.draw_text(32,32,420 + 16,32,"空白记忆")
  128.   end
  129. end
  130. def dispose
  131.   super
  132.   @sprite.dispose
  133.   @backsp.dispose
  134.   for i in @sp_ch
  135.     i.dispose
  136.   end
  137. end
  138. end


  139. class Scene_Save
  140. def main
  141.   @command_window = Window_Command.new(160,["No.0","No.1","No.2","No.3","No.4","No.5","No.6","No.7","No.8","No.9","No.10","No.11","No.12","No.13","No.14","No.15","No.16","No.17","No.18","No.19","No.20","No.21","No.22","No.23","No.24","No.25","No.26","No.27","No.28","No.29","No.30","No.31","No.32","No.33","No.34","No.35","No.36","No.37","No.38","No.39","No.40","No.41","No.42","No.43","No.44","No.45","No.46","No.47","No.48","No.49","No.50","No.51","No.52","No.53","No.54","No.55","No.56","No.57","No.58","No.59","No.60","No.61","No.62","No.63","No.64","No.65","No.66","No.67","No.68","No.69","No.70","No.71","No.72","No.73","No.74","No.75","No.76","No.77","No.78","No.79","No.80","No.81","No.82","No.83","No.84","No.85","No.86","No.87","No.88","No.89","No.90","No.91","No.92","No.93","No.94","No.95","No.96","No.97","No.98","No.99"])
  142.   @command_window.y = 0
  143.   @command_window.index = $game_temp.last_file_index
  144.   @content_window = Window_File.new($game_temp.last_file_index)
  145.   # 执行过渡
  146.   Graphics.transition
  147.   # 主循环
  148.   loop do
  149.     # 刷新游戏画面
  150.     Graphics.update
  151.     # 刷新输入信息
  152.     Input.update
  153.     # 刷新画面
  154.     update
  155.     # 如果画面被切换的话就中断循环
  156.     if $scene != self
  157.       break
  158.     end
  159.   end
  160.   # 准备过渡
  161.   Graphics.freeze
  162.   @command_window.dispose
  163.   @content_window.dispose
  164. end
  165. def update
  166.   @command_window.update   
  167.   if @command_window.index != @content_window.index
  168.     @content_window.index = @command_window.index
  169.     @content_window.refresh
  170.   end   
  171.   #——————下面这一部分是原装脚本——————#
  172.   if Input.trigger?(Input::B)  
  173.     $game_system.se_play($data_system.cancel_se)
  174.     if $game_temp.save_calling
  175.       $game_temp.save_calling = false
  176.       $scene = Scene_Map.new
  177.       return
  178.     end
  179.     $scene = Scene_Menu.new(4)
  180.   end   
  181.   #———————————————————————#   
  182.   if Input.trigger?(Input::C)
  183.     # 演奏存档 SE
  184.     $game_system.se_play($data_system.save_se)
  185.     # 写入存档数据
  186.     file = File.open(BBS_66RPG_DIR+"Save#{@command_window.index}.rxdata", "wb")
  187.     write_save_data(file)
  188.     if FileTest.exist?(BBS_66RPG_DIR+"shot.jpg")
  189.       File.rename(BBS_66RPG_DIR+"shot.jpg", BBS_66RPG_DIR+"Save#{@command_window.index}.jpg")
  190.     end
  191.     file.close
  192.     $game_temp.last_file_index = @command_window.index
  193.     # 如果被事件调用
  194.     if $game_temp.save_calling
  195.       # 清除存档调用标志
  196.       $game_temp.save_calling = false
  197.       # 切换到地图画面
  198.       $scene = Scene_Map.new
  199.       return
  200.     end
  201.     # 切换到菜单画面
  202.     $scene = Scene_Map.new
  203.   end
  204.   #———————————————————————#
  205. end
  206. #--------------------------------------------------------------------------
  207. # ● 写入存档数据
  208. #     file : 写入用文件对像 (已经打开)
  209. #--------------------------------------------------------------------------
  210. def write_save_data(file)
  211.   # 生成描绘存档文件用的角色图形
  212.   characters = []
  213.   for i in 0...$game_party.actors.size
  214.     actor = $game_party.actors[i]
  215.     characters.push([actor.character_name, actor.character_hue, actor.id, actor.battler_name, actor.battler_hue])
  216.   end
  217.   #####################################################################
  218.   id = $game_map.map_id
  219.   name = $data_mapinfos[id].name
  220.   if name.include?("★")
  221.     @save_map_name = name.split(/★/)[0]
  222.   else
  223.     @save_map_name = name
  224.   end
  225.   Marshal.dump($game_party.gold.to_s, file)
  226.   Marshal.dump(@save_map_name, file)
  227.   #####################################################################
  228.   # 写入描绘存档文件用的角色数据
  229.   Marshal.dump(characters, file)
  230.   # 写入测量游戏时间用画面计数
  231.   Marshal.dump(Graphics.frame_count, file)
  232.   # 增加 1 次存档次数
  233.   $game_system.save_count += 1
  234.   # 保存魔法编号
  235.   # (将编辑器保存的值以随机值替换)
  236.   $game_system.magic_number = $data_system.magic_number
  237.   # 写入各种游戏对像
  238.   Marshal.dump($game_system, file)
  239.   Marshal.dump($game_switches, file)
  240.   Marshal.dump($game_variables, file)
  241.   Marshal.dump($game_self_switches, file)
  242.   Marshal.dump($game_screen, file)
  243.   Marshal.dump($game_actors, file)
  244.   Marshal.dump($game_party, file)
  245.   Marshal.dump($game_troop, file)
  246.   Marshal.dump($game_map, file)
  247.   Marshal.dump($game_player, file)
  248. end
  249. end


  250. class Scene_Load
  251. def initialize(force = false)
  252.   @in_game = force
  253.   # 再生成临时对像
  254.   $game_temp = Game_Temp.new
  255.   # 选择存档时间最新的文件
  256.   $game_temp.last_file_index = 0
  257.   latest_time = Time.at(0)
  258.   for i in 0..28
  259.     filename = BBS_66RPG_DIR+"Save#{i}.rxdata"
  260.     if FileTest.exist?(filename)
  261.       file = File.open(filename, "r")
  262.       if file.mtime > latest_time
  263.         latest_time = file.mtime
  264.         $game_temp.last_file_index = i
  265.       end
  266.       file.close
  267.     end
  268.   end
  269. end  
  270. def main
  271.   @command_window = Window_Command.new(160,["No.0","No.1","No.2","No.3","No.4","No.5","No.6","No.7","No.8","No.9","No.10","No.11","No.12","No.13","No.14","No.15","No.16","No.17","No.18","No.19","No.20","No.21","No.22","No.23","No.24","No.25","No.26","No.27","No.28","No.29","No.30","No.31","No.32","No.33","No.34","No.35","No.36","No.37","No.38","No.39","No.40","No.41","No.42","No.43","No.44","No.45","No.46","No.47","No.48","No.49","No.50","No.51","No.52","No.53","No.54","No.55","No.56","No.57","No.58","No.59","No.60","No.61","No.62","No.63","No.64","No.65","No.66","No.67","No.68","No.69","No.70","No.71","No.72","No.73","No.74","No.75","No.76","No.77","No.78","No.79","No.80","No.81","No.82","No.83","No.84","No.85","No.86","No.87","No.88","No.89","No.90","No.91","No.92","No.93","No.94","No.95","No.96","No.97","No.98","No.99"])
  272.   @command_window.y = 0
  273.   @command_window.index = $game_temp.last_file_index
  274.   @content_window = Window_File.new($game_temp.last_file_index)
  275.   # 执行过渡
  276.   Graphics.transition
  277.   # 主循环
  278.   loop do
  279.     # 刷新游戏画面
  280.     Graphics.update
  281.     # 刷新输入信息
  282.     Input.update
  283.     # 刷新画面
  284.     update
  285.     # 如果画面被切换的话就中断循环
  286.     if $scene != self
  287.       break
  288.     end
  289.   end
  290.   # 准备过渡
  291.   Graphics.freeze
  292.   @command_window.dispose
  293.   @content_window.dispose
  294. end
  295. def update
  296.   @command_window.update   
  297.   if @command_window.index != @content_window.index
  298.     @content_window.index = @command_window.index
  299.     @content_window.refresh
  300.   end   
  301.   #——————下面这一部分是原装脚本——————#
  302.   if Input.trigger?(Input::B)  
  303.   # 演奏取消 SE
  304.   $game_system.se_play($data_system.cancel_se)
  305.    if @in_game
  306.      $scene = $scene = Scene_Menu.new(4)
  307.    else
  308.      # 切换到标题画面
  309.      $scene = Scene_Title.new
  310.    end
  311.   end   
  312.   #———————————————————————#   
  313.   if Input.trigger?(Input::C)
  314.     # 文件不存在的情况下
  315.     unless FileTest.exist?(BBS_66RPG_DIR+"Save#{@command_window.index}.rxdata")
  316.       # 演奏冻结 SE
  317.       $game_system.se_play($data_system.buzzer_se)
  318.       return
  319.     end
  320.     if $piantou == 1
  321.       for i in 1..3
  322.         $menupicback[i].bitmap.dispose
  323.       end
  324.     end
  325.     # 演奏读档 SE
  326.     $game_system.se_play($data_system.load_se)
  327.     # 写入存档数据
  328.     file = File.open(BBS_66RPG_DIR+"Save#{@command_window.index}.rxdata", "rb")
  329.     read_save_data(file)
  330.     file.close
  331.     # 还原 BGM、BGS
  332.     $game_system.bgm_play($game_system.playing_bgm)
  333.     $game_system.bgs_play($game_system.playing_bgs)
  334.     # 刷新地图 (执行并行事件)
  335.     $game_map.update
  336.     # 切换到地图画面
  337.     $scene = Scene_Map.new
  338.   end
  339.   #———————————————————————#
  340. end
  341. #--------------------------------------------------------------------------
  342. # ● 写入存档数据
  343. #     file : 写入用文件对像 (已经打开)
  344. #--------------------------------------------------------------------------
  345. def read_save_data(file)
  346.   @gold = Marshal.load(file)
  347.   @save_map_name = Marshal.load(file)
  348.   # 读取描绘存档文件用的角色数据
  349.   characters = Marshal.load(file)
  350.   # 读取测量游戏时间用画面计数
  351.   Graphics.frame_count = Marshal.load(file)
  352.   # 读取各种游戏对像
  353.   $game_system        = Marshal.load(file)
  354.   $game_switches      = Marshal.load(file)
  355.   $game_variables     = Marshal.load(file)
  356.   $game_self_switches = Marshal.load(file)
  357.   $game_screen        = Marshal.load(file)
  358.   $game_actors        = Marshal.load(file)
  359.   $game_party         = Marshal.load(file)
  360.   $game_troop         = Marshal.load(file)
  361.   $game_map           = Marshal.load(file)
  362.   $game_player        = Marshal.load(file)
  363.   # 魔法编号与保存时有差异的情况下
  364.   # (加入编辑器的编辑过的数据)
  365.   if $game_system.magic_number != $data_system.magic_number
  366.     # 重新装载地图
  367.     $game_map.setup($game_map.map_id)
  368.     $game_player.center($game_player.x, $game_player.y)
  369.   end
  370.   # 刷新同伴成员
  371.   $game_party.refresh
  372. end
  373. end

  374. class Scene_Menu
  375. alias bbs_66rpg_shotsave_main main
  376. def main
  377.   if @menu_index == 0
  378.     Screen::shot
  379.   end   
  380.   bbs_66rpg_shotsave_main
  381. end
  382. end

  383. class Interpreter
  384. #--------------------------------------------------------------------------
  385. # ● 调用存档画面
  386. #--------------------------------------------------------------------------
  387. def command_352
  388.   # 设置战斗中断标志
  389.   $game_temp.battle_abort = true
  390.   # 设置调用存档标志
  391.   $game_temp.save_calling = true
  392.   # 推进索引
  393.   @index += 1
  394.   # 结束
  395.   Screen::shot
  396.   return false
  397. end
  398. end
复制代码
头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
21 小时
注册时间
2007-7-3
帖子
573
2
发表于 2010-9-29 16:21:51 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
16 小时
注册时间
2009-9-20
帖子
232
3
 楼主| 发表于 2010-9-29 16:43:44 | 只看该作者
本帖最后由 p7l8k90 于 2010-9-29 16:46 编辑

回复 goahead 的帖子


    那个……恕我愚钝,我怎么用怎么报错,麻烦您指点一下,把脚本左右衔接起来,或者您说具体写也行啊……,图像处理的部分在111行,目前用的是使用战斗图的形式,多谢了……
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
21 小时
注册时间
2007-7-3
帖子
573
4
发表于 2010-9-29 16:47:04 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
16 小时
注册时间
2009-9-20
帖子
232
5
 楼主| 发表于 2010-9-29 17:48:45 | 只看该作者
回复 goahead 的帖子

那个……你确定你这有50个存档?而且是截图存档?
   
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
21 小时
注册时间
2007-7-3
帖子
573
6
发表于 2010-9-30 10:49:26 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-11-23 20:54

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表