设为首页收藏本站

仙剑之十里坡

 找回密码
 加入我们

QQ登录

只需一步,快速开始

搜索
查看: 3494|回复: 0
打印 上一主题 下一主题

自编的地图存档脚本

[复制链接]

1008

主题

5

听众

2万

积分

返璞归真

不器用な星の瞬き

会员等级: 10

  • TA的每日心情
    擦汗
    昨天 22:18
  • 签到天数: 1365 天

    [LV.10]以坛为家III

    精华
    2
    积分
    23737
    历练
    3
    声望
    133
    人气
    2540

    转帖之王 金融巨子 黑色羽翼

    单身中……
    帮我摆脱单身吧
    跳转到指定楼层
    1
    发表于 2011-6-30 14:09:38 |只看该作者 |倒序浏览
    本帖最后由 BlackFeather 于 2011-6-30 14:11 编辑

    1. class Scene_Map
    2.   def update
    3.     # 循环
    4.     loop do
    5.       # 按照地图、实例、主角的顺序刷新
    6.       # (本更新顺序不会在的满足事件的执行条件下成为给予角色瞬间移动
    7.       #  的机会的重要因素)
    8.       $game_map.update
    9.       $game_system.map_interpreter.update
    10.       $game_player.update
    11.       # 系统 (计时器)、画面刷新
    12.       $game_system.update
    13.       $game_screen.update
    14.       # 如果主角在场所移动中就中断循环
    15.       unless $game_temp.player_transferring
    16.         break
    17.       end
    18.       # 执行场所移动
    19.       transfer_player
    20.       # 处理过渡中的情况下、中断循环
    21.       if $game_temp.transition_processing
    22.         break
    23.       end
    24.     end
    25.     # 刷新活动块
    26.     @spriteset.update
    27.     # 刷新信息窗口
    28.     @message_window.update
    29.     # 游戏结束的情况下
    30.     if $game_temp.gameover
    31.       # 切换的游戏结束画面
    32.       $scene = Scene_Gameover.new
    33.       return
    34.     end
    35.     # 返回标题画面的情况下
    36.     if $game_temp.to_title
    37.       # 切换到标题画面
    38.       $scene = Scene_Title.new
    39.       return
    40.     end
    41.     # 处理过渡中的情况下
    42.     if $game_temp.transition_processing
    43.       # 清除过渡处理中标志
    44.       $game_temp.transition_processing = false
    45.       # 执行过渡
    46.       if $game_temp.transition_name == ""
    47.         Graphics.transition(20)
    48.       else
    49.         Graphics.transition(40, "Graphics/Transitions/" +
    50.           $game_temp.transition_name)
    51.       end
    52.     end
    53.     # 显示信息窗口中的情况下
    54.     if $game_temp.message_window_showing
    55.       return
    56.     end
    57.     # 遇敌计数为 0 且、且遇敌列表不为空的情况下
    58.     # 按下 B 键的情况下
    59.     if Input.trigger?(Input::B)
    60.       # 不是在事件执行中或菜单禁止中
    61.       unless $game_system.map_interpreter.running? or
    62.              $game_system.menu_disabled
    63.         # 设置菜单调用标志以及 SE 演奏
    64.         $game_temp.menu_calling = true
    65.         $game_temp.menu_beep = true
    66.       end
    67.     end
    68.     if Input.trigger?(Input::F5)
    69.       # 不是在事件执行中或菜单禁止中
    70.       unless $game_system.map_interpreter.running? or
    71.              $game_system.save_disabled
    72.          #截图存档
    73.          Screen::shot
    74.          map_save
    75.       end
    76.     end
    77.     # 调试模式为 ON 并且按下 F9 键的情况下
    78.     if $DEBUG and Input.press?(Input::F9)
    79.       # 设置调用调试标志
    80.       $game_temp.debug_calling = true
    81.     end
    82.     # 不在主角移动中的情况下
    83.     unless $game_player.moving?
    84.       # 执行各种画面的调用
    85.       if $game_temp.battle_calling
    86.         call_battle
    87.       elsif $game_temp.shop_calling
    88.         call_shop
    89.       elsif $game_temp.name_calling
    90.         call_name
    91.       elsif $game_temp.menu_calling
    92.         call_menu
    93.       elsif $game_temp.save_calling
    94.         call_save
    95.       elsif $game_temp.debug_calling
    96.         call_debug
    97.       end
    98.     end
    99.   end
    100.   def map_save
    101.     # 演奏存档 SE
    102.     $game_system.se_play($data_system.save_se)
    103.     # 写入存档数据
    104.     file = File.open(BBS_66RPG_DIR+"Save11.rxdata", "wb")
    105.     write_save_data(file)
    106.     if FileTest.exist?(BBS_66RPG_DIR+"shot.jpg")
    107.       File.rename(BBS_66RPG_DIR+"shot.jpg", BBS_66RPG_DIR+"Save11.jpg")
    108.     end
    109.     file.close
    110.   end
    111.   def write_save_data(file)
    112.     # 生成描绘存档文件用的角色图形
    113.     characters = []
    114.     for i in 0...$game_party.actors.size
    115.       actor = $game_party.actors[i]
    116.       characters.push([actor.character_name, actor.character_hue, actor.id, actor.battler_name, actor.battler_hue])
    117.     end
    118.     # 写入描绘存档文件用的角色数据
    119.     Marshal.dump(characters, file)
    120.     # 写入测量游戏时间用画面计数
    121.     Marshal.dump(Graphics.frame_count, file)
    122.     # 增加 1 次存档次数
    123.     $game_system.save_count += 1
    124.     # 保存魔法编号
    125.     # (将编辑器保存的值以随机值替换)
    126.     $game_system.magic_number = $data_system.magic_number
    127.     # 写入各种游戏对像
    128.     Marshal.dump($game_system, file)
    129.     Marshal.dump($game_switches, file)
    130.     Marshal.dump($game_variables, file)
    131.     Marshal.dump($game_self_switches, file)
    132.     Marshal.dump($game_screen, file)
    133.     Marshal.dump($game_actors, file)
    134.     Marshal.dump($game_party, file)
    135.     Marshal.dump($game_troop, file)
    136.     Marshal.dump($game_map, file)
    137.     Marshal.dump($game_player, file)
    138.   end
    139.   #--------------------------------------------------------------------------
    140.   # ● 主角的场所移动
    141.   #--------------------------------------------------------------------------
    142.   def transfer_player
    143.     # 清除主角场所移动调试标志
    144.     $game_temp.player_transferring = false
    145.     # 移动目标与现在的地图有差异的情况下
    146.     if $game_map.map_id != $game_temp.player_new_map_id
    147.       # 设置新地图
    148.       $game_map.setup($game_temp.player_new_map_id)
    149.     end
    150.     # 设置主角位置
    151.     $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
    152.     # 设置主角朝向
    153.     case $game_temp.player_new_direction
    154.     when 2  # 下
    155.       $game_player.turn_down
    156.     when 4  # 左
    157.       $game_player.turn_left
    158.     when 6  # 右
    159.       $game_player.turn_right
    160.     when 8  # 上
    161.       $game_player.turn_up
    162.     end
    163.     # 矫正主角姿势
    164.     $game_player.straighten
    165.     # 刷新地图 (执行并行事件)
    166.     $game_map.update
    167.     # 在生成活动块
    168.     @spriteset.dispose
    169.     @spriteset = Spriteset_Map.new
    170.     # 处理过渡中的情况下
    171.     if $game_temp.transition_processing
    172.       # 清除过渡处理中标志
    173.       $game_temp.transition_processing = false
    174.       # 执行过渡
    175.       Graphics.transition(20)
    176.     end
    177.     # 执行地图设置的 BGM、BGS 的自动切换
    178.     $game_map.autoplay
    179.     # 设置画面
    180.     Graphics.frame_reset
    181.     # 刷新输入信息
    182.     Input.update
    183.   end
    184. end
    复制代码


    没有使用截图存档的请把79、112、113、114行注释掉
    注意,是按F5地图存档
    分享到: QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    转播转播0 分享淘帖0 分享分享0 收藏收藏0
    夜空の星に 捧げた願いの
    欠片積めて 爆誕する奇跡
    您需要登录后才可以回帖 登录 | 加入我们

    手机版|Archiver|仙剑之十里坡 ( 苏ICP备11022766号 )  

    GMT+8, 2024-5-4 14:35 , Processed in 0.298441 second(s), 32 queries .

    Powered by Discuz! X2.5

    © 2001-2012 Comsenz Inc.

    回顶部