Project1
标题:
截图存档的问题
[打印本页]
作者:
p7l8k90
时间:
2010-9-29 10:58
标题:
截图存档的问题
本帖最后由 p7l8k90 于 2010-9-30 12:15 编辑
这东西很早就出了,相信很多人都看过,没看过的我发下截图,我这里有两个版本,普通的
普通截图存档.png
(390.72 KB, 下载次数: 4)
下载附件
保存到相册
2010-9-29 14:03 上传
和石焚刃暖的
石焚截图存档.png
(266.18 KB, 下载次数: 4)
下载附件
保存到相册
2010-9-29 14:03 上传
,普通的截图下方是调用角色战斗图片,代码如下:
@sp_ch[i].bitmap = RPG::Cache.battler(@characters[i][3], @characters[i][4])
复制代码
,而石焚刃暖截图下方调用的是Graphics/system/menu/headp/这个文件夹下的与角色战斗图片同名再加_save的图片,代码如下:
@sp_ch[i].bitmap = Bitmap.new("Graphics/system/menu/headp/" + @characters[i][3] + "_save.png")
复制代码
,接下来是问题,因为用了全动画战斗,所以我的角色战斗图片是透明的,即空像素,而由于某种原因,我又不想用石焚那种头像式截图存档,(原因说了也无妨,我做游戏的需要,它是仙剑2续传,我想尽量做的跟原来差不多一些,虽然只是测试版。)我想在截图存档出来的时候调用角色行走图,而且是面向朝右,停止时动画形态的,请问我该怎么办?恩……把整个截图存档脚本发出来吧,这样懂脚本的就都能解答了,恳请大家解答一下,急用,谢谢!截图存档代码(经过我修改的,哦对了,还有个问题,我把存档数目加到了100,它也确实有一百个存档,可问题是到了14号存档往下就看不到了,有是有,可是……怎么说呢?恩……不自动翻页,这么说应该差不多吧,很苦恼,虽然能用但是效果不太好,不,是太不好了,麻烦高手们也顺便解答了,再次拜谢!):
#===============================================================================
BBS_66RPG_DIR = "Save/" # 储存文件夹名,请制作游戏时自行建立此文件夹
# 若想使用自定义背景图,脚本62行的井号去掉,并放置一张相应图形。
# 在你的Scene_Title中找到这一段(如果使用其他插件脚本,在插件中找):
# for i in 0..3
# if FileTest.exist?("Save#{i+1}.rxdata")
# 请自行把0..3改为0..最大进度号,比如0..9
# "Save#{i+1}.rxdata" 改为"Save/Save#{i}.rxdata"
# 增加进度的方法:138,258行,继续添加。你也可以改“进度X”为“回忆X”或者“红/绿/蓝笔记本”
# 注意:这个脚本是兼容亿万星辰的“轩辕剑菜单”的版本,不过用在其他场合貌似也不会出错
# 使用时把这个脚本放在“轩辕剑菜单”脚本的下方,也就是更靠近Main的位置
# 兼容处理:叶子
#===============================================================================
module Screen
@screen = Win32API.new 'screenshot', 'Screenshot', %w(l l l l p l l), ''
@readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'
@findwindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'
module_function
#-----------------------------------------------------------------------------
# here comes the stuff...
# i add here the stuff for automatic change of the number for the screenshot
# so it wont overrite the old one...
# if you want to change so stuff change them in this line below
# or you can change them in your command line... like
# Screen::shot("screenshot", 2)
# this change the name and the type of the screenshot
# (0 = bmp, 1 = jpg and 2 = png)
# ----------------------------------------------------------------------------
def shot(file = "shot", typ = 1)
# to add the right extension...
if typ == 0
typname = ".bmp"
elsif typ == 1
typname = ".jpg"
elsif typ == 2
typname = ".png"
end
file_index = 0
dir = "Save/"
# make the filename....
file_name = dir + file.to_s + typname.to_s
if $shot_guodu == 1
file_name = "Graphics/Pictures/sys_screen.jpg"
$shot_guodu = 0
end
# make the screenshot.... Attention dont change anything from here on....
@screen.call(0,0,640,480,file_name,handel,typ)
end
# find the game window...
def handel
game_name = "\0" * 256
@readini.call('Game','Title','',game_name,255,".\\Game.ini")
game_name.delete!("\0")
return @findwindow.call('RGSS Player',game_name)
end
end
class Window_File < Window_Base
attr_accessor :index
def initialize(index = 0)
@backsp = Sprite.new
@backsp.z = 99
super(160,0,480,480)
#这行可以不用
self.contents = Bitmap.new(width - 32, height - 32)
@index = index
#这里我要说明一句,之所以用sprite是为了放缩图片
@sprite = Sprite.new
@sprite.visible = false
@sprite.z = 100
@sp_ch = []
@sp_ch[0] = Sprite.new
refresh
end
def refresh
self.contents.clear
for i in @sp_ch
i.visible = false
end
@sprite.visible = false
if FileTest.exist?(BBS_66RPG_DIR+"Save#{@index}.rxdata")
@sprite.visible = true
if FileTest.exist?(BBS_66RPG_DIR+"Save#{@index}.jpg")
@sprite.bitmap = Bitmap.new(BBS_66RPG_DIR+"Save#{@index}.jpg")
else
self.contents.draw_text(32,64,400,32,"截图似乎有点问题……您搞什么了您?")
end
@sprite.x = 176
@sprite.y = 16
@sprite.zoom_x = 0.7
@sprite.zoom_y = 0.7
file = File.open(BBS_66RPG_DIR+"Save#{@index}.rxdata", "r")
@time_stamp = file.mtime
@gold = Marshal.load(file)
@save_map_name = Marshal.load(file)
@characters = Marshal.load(file)
@frame_count = Marshal.load(file)
@game_system = Marshal.load(file)
@game_switches = Marshal.load(file)
@game_variables = Marshal.load(file)
@total_sec = @frame_count / Graphics.frame_rate
file.close
for i in
[email protected]
@sp_ch[i] = Sprite.new
@sp_ch[i].visible = true
@sp_ch[i].bitmap = RPG::Cache.battler(@characters[i][3], @characters[i][4])
@sp_ch[i].x = 180 + i*42
@sp_ch[i].y = 460 - @sp_ch[i].bitmap.height
@sp_ch[i].z = 101
end
# 描绘游戏时间
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(4, 390, 420 + 16, 32, time_string, 2)
# 描绘时间标记
self.contents.font.color = normal_color
time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
self.contents.draw_text(4, 420, 420 + 16, 32, time_string, 2)
self.contents.draw_text(4, 420 - 64, 420 + 16, 32, @save_map_name, 2)
self.contents.draw_text(4, 4, 420 + 16, 32, @gold, 2)
src_rect = Rect.new(0,0,16,16)
bitmap = Bitmap.new("Graphics/system/menu/back/money.png")
self.contents.blt(420 + 16 - @gold.size * 16, 4 + 8, bitmap, src_rect)
else
self.contents.draw_text(32,32,420 + 16,32,"空白记忆")
end
end
def dispose
super
@sprite.dispose
@backsp.dispose
for i in @sp_ch
i.dispose
end
end
end
class Scene_Save
def main
@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"])
@command_window.y = 0
@command_window.index = $game_temp.last_file_index
@content_window = Window_File.new($game_temp.last_file_index)
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面被切换的话就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
@command_window.dispose
@content_window.dispose
end
def update
@command_window.update
if @command_window.index != @content_window.index
@content_window.index = @command_window.index
@content_window.refresh
end
#——————下面这一部分是原装脚本——————#
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
if $game_temp.save_calling
$game_temp.save_calling = false
$scene = Scene_Map.new
return
end
$scene = Scene_Menu.new(4)
end
#———————————————————————#
if Input.trigger?(Input::C)
# 演奏存档 SE
$game_system.se_play($data_system.save_se)
# 写入存档数据
file = File.open(BBS_66RPG_DIR+"Save#{@command_window.index}.rxdata", "wb")
write_save_data(file)
if FileTest.exist?(BBS_66RPG_DIR+"shot.jpg")
File.rename(BBS_66RPG_DIR+"shot.jpg", BBS_66RPG_DIR+"Save#{@command_window.index}.jpg")
end
file.close
$game_temp.last_file_index = @command_window.index
# 如果被事件调用
if $game_temp.save_calling
# 清除存档调用标志
$game_temp.save_calling = false
# 切换到地图画面
$scene = Scene_Map.new
return
end
# 切换到菜单画面
$scene = Scene_Map.new
end
#———————————————————————#
end
#--------------------------------------------------------------------------
# ● 写入存档数据
# file : 写入用文件对像 (已经打开)
#--------------------------------------------------------------------------
def write_save_data(file)
# 生成描绘存档文件用的角色图形
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue, actor.id, actor.battler_name, actor.battler_hue])
end
#####################################################################
id = $game_map.map_id
name = $data_mapinfos[id].name
if name.include?("★")
@save_map_name = name.split(/★/)[0]
else
@save_map_name = name
end
Marshal.dump($game_party.gold.to_s, file)
Marshal.dump(@save_map_name, file)
#####################################################################
# 写入描绘存档文件用的角色数据
Marshal.dump(characters, file)
# 写入测量游戏时间用画面计数
Marshal.dump(Graphics.frame_count, file)
# 增加 1 次存档次数
$game_system.save_count += 1
# 保存魔法编号
# (将编辑器保存的值以随机值替换)
$game_system.magic_number = $data_system.magic_number
# 写入各种游戏对像
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
end
end
class Scene_Load
def initialize(force = false)
@in_game = force
# 再生成临时对像
$game_temp = Game_Temp.new
# 选择存档时间最新的文件
$game_temp.last_file_index = 0
latest_time = Time.at(0)
for i in 0..28
filename = BBS_66RPG_DIR+"Save#{i}.rxdata"
if FileTest.exist?(filename)
file = File.open(filename, "r")
if file.mtime > latest_time
latest_time = file.mtime
$game_temp.last_file_index = i
end
file.close
end
end
end
def main
@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"])
@command_window.y = 0
@command_window.index = $game_temp.last_file_index
@content_window = Window_File.new($game_temp.last_file_index)
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面被切换的话就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
@command_window.dispose
@content_window.dispose
end
def update
@command_window.update
if @command_window.index != @content_window.index
@content_window.index = @command_window.index
@content_window.refresh
end
#——————下面这一部分是原装脚本——————#
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
if @in_game
$scene = $scene = Scene_Menu.new(4)
else
# 切换到标题画面
$scene = Scene_Title.new
end
end
#———————————————————————#
if Input.trigger?(Input::C)
# 文件不存在的情况下
unless FileTest.exist?(BBS_66RPG_DIR+"Save#{@command_window.index}.rxdata")
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
if $piantou == 1
for i in 1..3
$menupicback[i].bitmap.dispose
end
end
# 演奏读档 SE
$game_system.se_play($data_system.load_se)
# 写入存档数据
file = File.open(BBS_66RPG_DIR+"Save#{@command_window.index}.rxdata", "rb")
read_save_data(file)
file.close
# 还原 BGM、BGS
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
# 刷新地图 (执行并行事件)
$game_map.update
# 切换到地图画面
$scene = Scene_Map.new
end
#———————————————————————#
end
#--------------------------------------------------------------------------
# ● 写入存档数据
# file : 写入用文件对像 (已经打开)
#--------------------------------------------------------------------------
def read_save_data(file)
@gold = Marshal.load(file)
@save_map_name = Marshal.load(file)
# 读取描绘存档文件用的角色数据
characters = Marshal.load(file)
# 读取测量游戏时间用画面计数
Graphics.frame_count = Marshal.load(file)
# 读取各种游戏对像
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = 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)
# 魔法编号与保存时有差异的情况下
# (加入编辑器的编辑过的数据)
if $game_system.magic_number != $data_system.magic_number
# 重新装载地图
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
# 刷新同伴成员
$game_party.refresh
end
end
class Scene_Menu
alias bbs_66rpg_shotsave_main main
def main
if @menu_index == 0
Screen::shot
end
bbs_66rpg_shotsave_main
end
end
class Interpreter
#--------------------------------------------------------------------------
# ● 调用存档画面
#--------------------------------------------------------------------------
def command_352
# 设置战斗中断标志
$game_temp.battle_abort = true
# 设置调用存档标志
$game_temp.save_calling = true
# 推进索引
@index += 1
# 结束
Screen::shot
return false
end
end
复制代码
作者:
goahead
时间:
2010-9-29 16:21
提示:
作者被禁止或删除 内容自动屏蔽
作者:
p7l8k90
时间:
2010-9-29 16:43
本帖最后由 p7l8k90 于 2010-9-29 16:46 编辑
回复
goahead
的帖子
那个……恕我愚钝,我怎么用怎么报错,麻烦您指点一下,把脚本左右衔接起来,或者您说具体写也行啊……,图像处理的部分在111行,目前用的是使用战斗图的形式,多谢了……
作者:
goahead
时间:
2010-9-29 16:47
提示:
作者被禁止或删除 内容自动屏蔽
作者:
p7l8k90
时间:
2010-9-29 17:48
回复
goahead
的帖子
那个……你确定你这有50个存档?而且是截图存档?
作者:
goahead
时间:
2010-9-30 10:49
提示:
作者被禁止或删除 内容自动屏蔽
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1