查看: 4823|回复: 17

[已经解决] 存档继承脚本怎么使用

[复制链接]
梦石
0
星屑
155
在线时间
478 小时
注册时间
2011-3-5
回帖
231
发表于 2014-7-27 18:36:22 | 显示全部楼层 |阅读模式

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

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

×
[pre lang="ruby" line="1"]#==============================================================================
#
# ▼ Yanfly Engine Ace - Save Engine Add-On: New Game+ v1.00
# -- Last Updated: 2011.12.26
# -- Level: Normal
# -- Requires: YEA - Ace Save Engine v1.01+
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YEA-NewGame+"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2011.12.26 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# New Game+ is a great way to provide replay value for your game. It lets the
# player re-experience the game in a different way with either carried over
# items, to carried over party members, to carried over skills, switches, and
# variables even. There exists many options to change how New Game+ will work
# for your game.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Item Notetags - These notetags go in the items notebox in the database.
# -----------------------------------------------------------------------------
# <no carry over>
# This will cause this specific item to not carry over in New Game+ if the item
# can be carried over. This does not affect any items that actors may have
# equipped.
#
# -----------------------------------------------------------------------------
# Weapon Notetags - These notetags go in the weapons notebox in the database.
# -----------------------------------------------------------------------------
# <no carry over>
# This will cause this specific item to not carry over in New Game+ if the item
# can be carried over. This does not affect any items that actors may have
# equipped.
#
# -----------------------------------------------------------------------------
# Armour Notetags - These notetags go in the armours notebox in the database.
# -----------------------------------------------------------------------------
# <no carry over>
# This will cause this specific item to not carry over in New Game+ if the item
# can be carried over. This does not affect any items that actors may have
# equipped.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
# This script requires Yanfly Engine Ace - Ace Save Engine v1.01+ and the
# script must be placed under Ace Save Engine in the script listing.
#
#==============================================================================

module YEA
  module NEW_GAME_PLUS
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - General Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # Description
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    NGP_SWITCH = 203           # If Switch ON, the game file has NG+ flag.
    NGP_TEXT   = "周目"   # Text used to show New Game+.
   
    # This is the help window text used for New Game+ when the New Game+
    # option is highlighted.
    NGP_HELP   = "继承新存档."
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Carry Over Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # These settings adjust what carries over and what doesn't. These settings
    # are very specific so adjust them carefully.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # This array contains all of the switches that you want carried over to
    # be maintained. Any switches that aren't here will be set false.
    CARRY_OVER_SWITCHES = [3, 6, 7,12,15,16,17,18]
   
    # This array contains all of the variables that you want carried over to
    # be maintained. Any variables that aren't here will be set to 0.
    CARRY_OVER_VARIABLES = [1,2,3,4,5]
   
    # If this is set to false, then actors will be completely reset back to
    # their original starting states. If it's set to true, then actors will
    # be kept exactly as they are.
    CARRY_OVER_ACTORS = true
   
    # These settings are only used if actors will be carried over. With this,
    # you can limit what specifics will be carried over for actors from levels
    # to equips to skills.
    CARRY_OVER_LEVELS = true
    CARRY_OVER_EQUIPS = true
    CARRY_OVER_SKILLS = true
   
    # If this is set to false, then the party members will revert back to the
    # original starting party members. If it's true, then the party setup will
    # remain exactly the same.
    CARRY_OVER_PARTY_MEMBERS = true
   
    # If any of these are set to false, then no items, weapons, or armours will
    # be carried over. If it's set to true, then the respective items will be
    # carried over to the newer game.
    CARRY_OVER_GOLD    = true
    CARRY_OVER_ITEMS   = true
    CARRY_OVER_WEAPONS = true
    CARRY_OVER_ARMOURS = true
   
  end # NEW_GAME_PLUS
end # YEA

#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================

if $imported["YEA-SaveEngine"]

module YEA
  module NEW_GAME_PLUS
    module_function
    #--------------------------------------------------------------------------
    # convert_integer_array
    #--------------------------------------------------------------------------
    def convert_integer_array(array)
      result = []
      array.each { |i|
        case i
        when Range; result |= i.to_a
        when Integer; result |=
        end }
      return result
    end
    #--------------------------------------------------------------------------
    # converted_contants
    #--------------------------------------------------------------------------
    CARRY_OVER_SWITCHES = convert_integer_array(CARRY_OVER_SWITCHES)
    CARRY_OVER_VARIABLES = convert_integer_array(CARRY_OVER_VARIABLES)
  end # NEW_GAME_PLUS
  module REGEXP
  module BASEITEM
   
    NO_CARRY_OVER = /<(?:NO_CARRY_OVER|no carry over)>/i
   
  end # BASEITEM
  end # REGEXP
end # YEA

#==============================================================================
# ■ DataManager
#==============================================================================

module DataManager
  
  #--------------------------------------------------------------------------
  # alias method: load_database
  #--------------------------------------------------------------------------
  class <<self; alias load_database_ngp load_database; end
  def self.load_database
    load_database_ngp
    load_notetags_ngp
  end
  
  #--------------------------------------------------------------------------
  # new method: load_notetags_ngp
  #--------------------------------------------------------------------------
  def self.load_notetags_ngp
    groups = [$data_items, $data_weapons, $data_armors]
    for group in groups
      for obj in group
        next if obj.nil?
        obj.load_notetags_ngp
      end
    end
  end
  
end # DataManager

#==============================================================================
# ■ RPG::BaseItem
#==============================================================================

class RPG::BaseItem
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :no_carry_over
  
  #--------------------------------------------------------------------------
  # common cache: load_notetags_ngp
  #--------------------------------------------------------------------------
  def load_notetags_ngp
    @no_carry_over = false
    #---
    self.note.split(/[\r\n]+/).each { |line|
      case line
      #---
      when YEA::REGEXP::BASEITEM::NO_CARRY_OVER
        @no_carry_over = true
      end
    } # self.note.split
    #---
  end
  
end # RPG::BaseItem

#==============================================================================
# ■ Switch
#==============================================================================

module Switch
  
  #--------------------------------------------------------------------------
  # self.new_game_plus
  #--------------------------------------------------------------------------
  def self.new_game_plus
    return $game_switches[YEA::NEW_GAME_PLUS::NGP_SWITCH]
  end
  
end # Switch

#==============================================================================
# ■ DataManager
#==============================================================================

module DataManager
  
  #--------------------------------------------------------------------------
  # new method: setup_new_game_plus
  #--------------------------------------------------------------------------
  def self.setup_new_game_plus(index)
    create_new_game_plus_objects(index)
    $game_map.setup($data_system.start_map_id)
    $game_player.moveto($data_system.start_x, $data_system.start_y)
    $game_player.refresh
    Graphics.frame_count = 0
  end
  
  #--------------------------------------------------------------------------
  # new method: create_new_game_plus_objects
  #--------------------------------------------------------------------------
  def self.create_new_game_plus_objects(index)
    load_game_without_rescue(index)
    ngp_reset_switches
    ngp_reset_variables
    ngp_reset_self_switches
    ngp_reset_actors
    ngp_reset_party
  end
  
  #--------------------------------------------------------------------------
  # new method: ngp_reset_switches
  #--------------------------------------------------------------------------
  def self.ngp_reset_switches
    for i in 0...$data_system.switches.size
      next if i <= 0
      next if YEA::NEW_GAME_PLUS::CARRY_OVER_SWITCHES.include?(i)
      $game_switches = false
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: ngp_reset_variables
  #--------------------------------------------------------------------------
  def self.ngp_reset_variables
    for i in 0...$data_system.variables.size
      next if i <= 0
      next if YEA::NEW_GAME_PLUS::CARRY_OVER_VARIABLES.include?(i)
      $game_variables = 0
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: ngp_reset_self_switches
  #--------------------------------------------------------------------------
  def self.ngp_reset_self_switches
    $game_self_switches = Game_SelfSwitches.new
  end
  
  #--------------------------------------------------------------------------
  # new method: ngp_reset_actors
  #--------------------------------------------------------------------------
  def self.ngp_reset_actors
    unless YEA::NEW_GAME_PLUS::CARRY_OVER_ACTORS
      $game_actors = Game_Actors.new
    else
      #---
      unless YEA::NEW_GAME_PLUS::CARRY_OVER_LEVELS
        for i in 0...$data_actors.size
          actor = $game_actors
          next if actor.nil?
          actor.new_game_plus_levels
        end
      end
      #---
      unless YEA::NEW_GAME_PLUS::CARRY_OVER_EQUIPS
        for i in 0...$data_actors.size
          actor = $game_actors
          next if actor.nil?
          actor.new_game_plus_equips
        end
      end
      #---
      unless YEA::NEW_GAME_PLUS::CARRY_OVER_SKILLS
        for i in 0...$data_actors.size
          actor = $game_actors
          next if actor.nil?
          actor.new_game_plus_skills
        end
      end
      #---
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: ngp_reset_party
  #--------------------------------------------------------------------------
  def self.ngp_reset_party
    gold = 0
    items = {}
    members = []
    #---
    if YEA::NEW_GAME_PLUS::CARRY_OVER_PARTY_MEMBERS
      for member in $game_party.members
        members.push(member.id)
      end
    end
    #---
    gold = $game_party.gold if YEA::NEW_GAME_PLUS::CARRY_OVER_GOLD
    #---
    if YEA::NEW_GAME_PLUS::CARRY_OVER_ITEMS
      for item in $data_items
        next if item.nil?
        next if item.no_carry_over
        items[item] = $game_party.item_number(item)
      end
    end
    #---
    if YEA::NEW_GAME_PLUS::CARRY_OVER_WEAPONS
      for item in $data_weapons
        next if item.nil?
        next if item.no_carry_over
        items[item] = $game_party.item_number(item)
      end
    end
    #---
    if YEA::NEW_GAME_PLUS::CARRY_OVER_ARMOURS
      for item in $data_armors
        next if item.nil?
        next if item.no_carry_over
        items[item] = $game_party.item_number(item)
      end
    end
    #---
    $game_party = Game_Party.new
    unless YEA::NEW_GAME_PLUS::CARRY_OVER_PARTY_MEMBERS
      $game_party.setup_starting_members
    end
    #---
    for member_id in members
      $game_party.add_actor(member_id)
    end
    $game_party.gain_gold(gold)
    for key in items
      item = key[0]
      next if item.nil?
      $game_party.gain_item(item, key[1])
    end
  end
  
end # DataManager

#==============================================================================
# ■ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  
  #--------------------------------------------------------------------------
  # new method: new_game_plus_levels
  #--------------------------------------------------------------------------
  def new_game_plus_levels
    @class_id = actor.class_id
    @level = actor.initial_level
    @exp = {}
    if $imported["YEA-ClassSystem"]
      init_unlocked_classes
      init_subclass
    end
    clear_param_plus
    init_exp
    refresh
  end
  
  #--------------------------------------------------------------------------
  # new method: new_game_plus_equips
  #--------------------------------------------------------------------------
  def new_game_plus_equips
    init_equips(actor.equips)
  end
  
  #--------------------------------------------------------------------------
  # new method: new_game_plus_skills
  #--------------------------------------------------------------------------
  def new_game_plus_skills
    init_skills
  end
  
end # Game_Actor

#==============================================================================
# ■ Window_FileAction
#==============================================================================

class Window_FileAction < Window_HorzCommand
  
  #--------------------------------------------------------------------------
  # alias method: add_load_command
  #--------------------------------------------------------------------------
  alias add_load_command_ngp add_load_command
  def add_load_command
    if new_game_plus?
      add_command(YEA::NEW_GAME_PLUS::NGP_TEXT, :new_game_plus)
    else
      add_load_command_ngp
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: new_game_plus?
  #--------------------------------------------------------------------------
  def new_game_plus?
    return false if @header.nil?
    return false if @header[:switches].nil?
    return @header[:switches][YEA::NEW_GAME_PLUS::NGP_SWITCH]
  end
  
  #--------------------------------------------------------------------------
  # alias method: update_help
  #--------------------------------------------------------------------------
  alias update_help_ngp update_help
  def update_help
    case current_symbol
    when :new_game_plus; @help_window.set_text(YEA::NEW_GAME_PLUS::NGP_HELP)
    else; update_help_ngp
    end
  end
  
end # Window_FileAction

#==============================================================================
# ■ Scene_File
#==============================================================================

class Scene_File < Scene_MenuBase
  
  #--------------------------------------------------------------------------
  # alias method: create_action_window
  #--------------------------------------------------------------------------
  alias create_action_window_ngp create_action_window
  def create_action_window
    create_action_window_ngp
    @action_window.set_handler(:new_game_plus, method(:on_action_ngp))
  end
  
  #--------------------------------------------------------------------------
  # new method: on_action_ngp
  #--------------------------------------------------------------------------
  def on_action_ngp
    Sound.play_load
    DataManager.setup_new_game_plus(@file_window.index)
    fadeout_all
    $game_system.on_after_load
    SceneManager.goto(Scene_Map)
  end
  
end # Scene_File

end # $imported["YEA-SaveEngine"]

#==============================================================================
#
# ▼ End of File
#
#==============================================================================[/pre]

…あたしは天

梦石
0
星屑
2308
在线时间
4033 小时
注册时间
2010-10-4
回帖
10548

开拓者贵宾

发表于 2014-7-27 18:45:19 | 显示全部楼层
插入Main以上,插件脚本以下。
脚本中根据说明设置好即可

点评

什么,结贴了=口=!?  发表于 2014-7-27 19:45
给我结贴吧 QAQ  发表于 2014-7-27 19:40
插入Main以上,插件脚本以下。  发表于 2014-7-27 19:36
...我是说如何使用 不是说看不懂说明的意思QAQ  发表于 2014-7-27 19:23
好好学英语,Please~  发表于 2014-7-27 19:04
回复

使用道具 举报

梦石
1
星屑
23236
在线时间
9564 小时
注册时间
2012-6-19
回帖
7018

开拓者短篇九导演组冠军

发表于 2014-7-27 19:43:08 | 显示全部楼层
本帖最后由 喵呜喵5 于 2014-7-27 19:51 编辑

[pre lang="ruby" line="1"]#==============================================================================
#
# ▼ 养肥系统 AceEngine Ace - 存档系统插件: 开始新游戏增强 v1.00
# -- 最终更新: 2011.12.26
# -- 等级: 普通人能够用的脚本
# -- 要求插入脚本: YEA - Ace Save Engine v1.01+
# -- 无节操的顺手翻译: 喵呜喵5
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YEA-NewGame+"] = true

#==============================================================================
# ▼ 更新日志
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2011.12.26 - 开始写并且写完了~#
#==============================================================================
# ▼ 介绍
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 这脚本能够实现继承存档的功能,详细的说明太长懒得翻译
#
#==============================================================================
# ▼ 使用方法
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 脚本扔到▼ Materials/素材 下 ▼ Main 以上
# 记得保存,总之就是个没啥特殊用法的脚本啦
#
# -----------------------------------------------------------------------------
# 物品备注 - 如果把下面的<no carry over>扔到对应物品的备注栏里
# -----------------------------------------------------------------------------
# <no carry over>
#
# 就不会被继承到新游戏中了
#
# -----------------------------------------------------------------------------
# 武器备注 - 同上
# -----------------------------------------------------------------------------
# <no carry over>
#
# -----------------------------------------------------------------------------
# 防具备注 - 同上
# -----------------------------------------------------------------------------
# <no carry over>
#
#==============================================================================
# ▼ 注意
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 这是VA脚本不是VX脚本#
#
# 这脚本还需要养肥引擎脚本Yanfly Engine Ace - Ace Save Engine v1.01+
# 并且在编辑器中的位置必须比引擎脚本更下
#
#==============================================================================

module YEA
  module NEW_GAME_PLUS

    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - 普通设置 -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # 帮助文字
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    NGP_SWITCH = 203      # 开关打开的时候存档将显示周目标志.
    NGP_TEXT   = "周目"   # 显示周目标志的文字.

    # 能够继承存档的时候帮助窗口的提示文字   
    NGP_HELP   = "继承新存档."

    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - 需要继承的内容 -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # 看清楚了再设置
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # 需要继承的开关
    CARRY_OVER_SWITCHES = [3, 6, 7,12,15,16,17,18]

    # 需要继承的变量
    CARRY_OVER_VARIABLES = [1,2,3,4,5]

    # 设置成 false 的话不继承角色信息
    CARRY_OVER_ACTORS = true

    # 继承角色等级、继承角色装备、继承角色技能
    # 上面那个角色信息不继承的话这下面三个也继承不了
    CARRY_OVER_LEVELS = true
    CARRY_OVER_EQUIPS = true
    CARRY_OVER_SKILLS = true

    # 继承队伍成员
    CARRY_OVER_PARTY_MEMBERS = true

    # 继承金钱、物品、道具、装备
    CARRY_OVER_GOLD    = true
    CARRY_OVER_ITEMS   = true
    CARRY_OVER_WEAPONS = true
    CARRY_OVER_ARMOURS = true

  end # 别理这行
end # 也别理这行

#==============================================================================
# ▼ 看不懂的话就别碰这以下的脚本了
#==============================================================================[/pre]

点评

喵大人蟹蟹w感激不尽!  发表于 2014-7-27 19:54

评分

参与人数 2星屑 +200 梦石 +1 收起 理由
VIPArcher + 100 (ΦωΦ)养肥系统
taroxd + 100 + 1 认可答案

查看全部评分

回复

使用道具 举报

梦石
0
星屑
50
在线时间
120 小时
注册时间
2013-1-15
回帖
12
发表于 2014-7-28 22:25:57 | 显示全部楼层
看看嘛V型从V刹消息称

评分

参与人数 1星屑 -50 收起 理由
taroxd -50 灌水

查看全部评分

回复 0 1

使用道具 举报

梦石
0
星屑
155
在线时间
478 小时
注册时间
2011-3-5
回帖
231
 楼主| 发表于 2014-7-29 13:09:51 | 显示全部楼层
weeeyu 发表于 2014-7-28 22:25
看看嘛V型从V刹消息称

@taroxd 这里有人无意义回复。顺便帮我结个帖撒。

点评

早就结掉啦~  发表于 2014-7-29 13:22
回复

使用道具 举报

梦石
0
星屑
814
在线时间
122 小时
注册时间
2018-7-23
回帖
78
发表于 2021-4-15 21:09:32 | 显示全部楼层
喵呜喵5 发表于 2014-7-27 19:43
#==============================================================================
#
# ▼ 养肥系统 Ace ...

头大了,就算翻译过来,真的普通人看得懂。。问题是,他的那个前置脚本哪里找?
回复

使用道具 举报

头像被屏蔽
梦石
0
星屑
-990
在线时间
11 小时
注册时间
2022-3-14
回帖
6
发表于 2022-4-16 14:14:01 | 显示全部楼层
提示: 该帖被管理员或版主屏蔽
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部