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

Project1

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

[有事请教] 求助大神们,请问如何将地图名代入变数并显示于存档中

[复制链接]

Lv2.观梦者

梦石
0
星屑
863
在线时间
297 小时
注册时间
2018-8-24
帖子
5
跳转到指定楼层
1
发表于 2024-10-8 23:10:49 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
200星屑
本帖最后由 helsingtsai 于 2024-10-10 20:37 编辑

我使用了Yanfly Ace Save Engine v1.03的脚本,同时想将编辑角色的名称代入变数并保存于存档介面中的地图名
比如像"XXX的家"这样,虽然也有尝试修改但还是行不通,还请大佬们不吝赐教。
RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ?\ Yanfly Engine Ace - Ace Save Engine v1.03
  4. # -- Last Updated: 2012.07.22
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-SaveEngine"] = true
  12.  
  13. #==============================================================================
  14. # ?\ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.07.22 - Fixed: Location Drawing.
  17. # 2012.01.23 - Anti-crash method added for removed maps.
  18. # 2011.12.26 - Compatibility Update: New Game+
  19. # 2011.12.26 - Started Script and Finished.
  20. #
  21. #==============================================================================
  22. # ?\ Introduction
  23. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  24. # This script provides a new save interface for the player. Along with a new
  25. # interface, the player can also load and delete saves straight from the menu
  26. # itself. This will in turn make the save command from the Main Menu always
  27. # available, but the save option within the new save menu will be enabled
  28. # depending on whether or not it is allowed or disallowed. From the interface,
  29. # the player is given more information regarding the save file including the
  30. # the location the player saved at, the amount of gold available, and any
  31. # variables that you want to show the player as well.
  32. #
  33. #==============================================================================
  34. # ?\ Instructions
  35. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  36. # To install this script, open up your script editor and copy/paste this script
  37. # to an open slot below ?\ Materials/ef?T but above ?\ Main. Remember to save.
  38. #
  39. # For first time installers, be warned that loading this script the first time
  40. # may not display all information in the status window for save files made
  41. # before the installation of this script. To remedy this, just load up the save
  42. # and save the file again.
  43. #
  44. #==============================================================================
  45. # ?\ Compatibility
  46. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  47. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  48. # it will run with RPG Maker VX without adjusting.
  49. #
  50. #==============================================================================
  51.  
  52. module YEA
  53.   module SAVE
  54.  
  55.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  56.     # - Slot Window Settings -
  57.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  58.     # This section adjusts how the slot window appears on the left side of the
  59.     # screen. This also adjusts the maximum number of saves a player can make,
  60.     # the way the slot names appear, and the icons used.
  61.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  62.     MAX_FILES = 99         # Maximum saves a player can make. Default: 16
  63.     SLOT_NAME = "存档 %s"  # How the file slots will be named.
  64.  
  65.     # These are the icons
  66.     SAVE_ICON  = 368       # Icon used to indicate a save is present.
  67.     EMPTY_ICON = 375       # Icon used to indicate an empty file.
  68.  
  69.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  70.     # - Action Window Settings -
  71.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  72.     # This section adjusts how the action window appears, the sound effect
  73.     # played when deleting files, and what appears in the help window above.
  74.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  75.     ACTION_LOAD   = "读取"           # Text used for loading games.
  76.     ACTION_SAVE   = "储存"           # Text used for saving games.
  77.     ACTION_DELETE = "删除"         # Text used for deleting games.
  78.     DELETE_SOUND  = RPG::SE.new("Shot1", 100, 100) # Sound for deleting.
  79.  
  80.     # These text settings adjust what displays in the help window.
  81.     SELECT_HELP = "请选择一个存档位。"
  82.     LOAD_HELP   = "读取之前储存的游戏进度。"
  83.     SAVE_HELP   = "储存目前的游戏进度。"
  84.     DELETE_HELP = "删除该存档位上的游戏进度。"
  85.  
  86.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  87.     # - Status Window Settings -
  88.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  89.     # This section adjusts how the status window appears in the middle of the
  90.     # screen (that displays the game's data) such as the total playtime, total
  91.     # times saved, total gold, the party's current location, and the variables
  92.     # to be displayed.
  93.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  94.     EMPTY_TEXT = "无存档"      # Text used when no save data is present.
  95.     PLAYTIME   = "游玩时间"          # Text used for total playtime.
  96.     TOTAL_SAVE = "存档次数:"     # Text used to indicate total saves.
  97.     TOTAL_GOLD = "持有金钱:"       # Text used to indicate total gold.
  98.     LOCATION   = "目前地点:"        # Text used to indicate current location.
  99.  
  100.     # These variables will be shown in each of the two columns for those who
  101.     # would want to display more information than just what's shown. Input the
  102.     # variables into the arrays below to designate what data will be shown.
  103.     COLUMN1_VARIABLES = [1, 2]
  104.     COLUMN2_VARIABLES = [3, 4]
  105.  
  106.   end # SAVE
  107. end # YEA
  108.  
  109. #==============================================================================
  110. # ?\ Editting anything past this point may potentially result in causing
  111. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  112. # halitosis so edit at your own risk.
  113. #==============================================================================
  114.  
  115. #==============================================================================
  116. # ?! Icon
  117. #==============================================================================
  118.  
  119. module Icon
  120.  
  121.   #--------------------------------------------------------------------------
  122.   # self.save_icon
  123.   #--------------------------------------------------------------------------
  124.   def self.save_icon; return YEA::SAVE::SAVE_ICON; end
  125.  
  126.   #--------------------------------------------------------------------------
  127.   # self.empty_icon
  128.   #--------------------------------------------------------------------------
  129.   def self.empty_icon; return YEA::SAVE::EMPTY_ICON; end
  130.  
  131. end # Icon
  132.  
  133. #==============================================================================
  134. # ?! Numeric
  135. #==============================================================================
  136.  
  137. class Numeric
  138.  
  139.   #--------------------------------------------------------------------------
  140.   # new method: group_digits
  141.   #--------------------------------------------------------------------------
  142.   unless $imported["YEA-CoreEngine"]
  143.   def group; return self.to_s; end
  144.   end # $imported["YEA-CoreEngine"]
  145.  
  146. end # Numeric
  147.  
  148. #==============================================================================
  149. # ?! DataManager
  150. #==============================================================================
  151.  
  152. module DataManager
  153.  
  154.   #--------------------------------------------------------------------------
  155.   # overwrite method: savefile_max
  156.   #--------------------------------------------------------------------------
  157.   def self.savefile_max
  158.     return YEA::SAVE::MAX_FILES
  159.   end
  160.  
  161.   #--------------------------------------------------------------------------
  162.   # overwrite method: self.make_save_header
  163.   #--------------------------------------------------------------------------
  164.   def self.make_save_header
  165.     header = {}
  166.     header[:characters]    = $game_party.characters_for_savefile
  167.     header[:playtime_s]    = $game_system.playtime_s
  168.     header[:system]        = Marshal.load(Marshal.dump($game_system))
  169.     header[:timer]         = Marshal.load(Marshal.dump($game_timer))
  170.     header[:message]       = Marshal.load(Marshal.dump($game_message))
  171.     header[:switches]      = Marshal.load(Marshal.dump($game_switches))
  172.     header[:variables]     = Marshal.load(Marshal.dump($game_variables))
  173.     header[:self_switches] = Marshal.load(Marshal.dump($game_self_switches))
  174.     header[:actors]        = Marshal.load(Marshal.dump($game_actors))
  175.     header[:party]         = Marshal.load(Marshal.dump($game_party))
  176.     header[:troop]         = Marshal.load(Marshal.dump($game_troop))
  177.     header[:map]           = Marshal.load(Marshal.dump($game_map))
  178.     header[:player]        = Marshal.load(Marshal.dump($game_player))
  179.     header
  180.   end
  181.  
  182. end # DataManager
  183.  
  184. #==============================================================================
  185. # ?! Window_MenuCommand
  186. #==============================================================================
  187.  
  188. class Window_MenuCommand < Window_Command
  189.  
  190.   #--------------------------------------------------------------------------
  191.   # overwrite method: save_enabled
  192.   #--------------------------------------------------------------------------
  193.   def save_enabled; return true; end
  194.  
  195. end # Window_MenuCommand
  196.  
  197. #==============================================================================
  198. # ?! Window_FileList
  199. #==============================================================================
  200.  
  201. class Window_FileList < Window_Selectable
  202.  
  203.   #--------------------------------------------------------------------------
  204.   # initialize
  205.   #--------------------------------------------------------------------------
  206.   def initialize(dx, dy)
  207.     super(dx, dy, 128, Graphics.height - dy)
  208.     refresh
  209.     activate
  210.     select(SceneManager.scene.first_savefile_index)
  211.   end
  212.  
  213.   #--------------------------------------------------------------------------
  214.   # item_max
  215.   #--------------------------------------------------------------------------
  216.   def item_max; return DataManager.savefile_max; end
  217.  
  218.   #--------------------------------------------------------------------------
  219.   # current_item_enabled?
  220.   #--------------------------------------------------------------------------
  221.   def current_item_enabled?
  222.     header = DataManager.load_header(index)
  223.     return false if header.nil? && SceneManager.scene_is?(Scene_Load)
  224.     return true
  225.   end
  226.  
  227.   #--------------------------------------------------------------------------
  228.   # refresh
  229.   #--------------------------------------------------------------------------
  230.   def refresh
  231.     create_contents
  232.     draw_all_items
  233.   end
  234.  
  235.   #--------------------------------------------------------------------------
  236.   # draw_item
  237.   #--------------------------------------------------------------------------
  238.   def draw_item(index)
  239.     header = DataManager.load_header(index)
  240.     enabled = !header.nil?
  241.     rect = item_rect(index)
  242.     rect.width -= 4
  243.     draw_icon(save_icon?(header), rect.x, rect.y, enabled)
  244.     change_color(normal_color, enabled)
  245.     text = sprintf(YEA::SAVE::SLOT_NAME, (index + 1).group)
  246.     draw_text(rect.x+24, rect.y, rect.width-24, line_height, text)
  247.   end
  248.  
  249.   #--------------------------------------------------------------------------
  250.   # save_icon?
  251.   #--------------------------------------------------------------------------
  252.   def save_icon?(header)
  253.     return Icon.empty_icon if header.nil?
  254.     return Icon.save_icon
  255.   end
  256.  
  257. end # Window_FileList
  258.  
  259. #==============================================================================
  260. # ?! Window_FileStatus
  261. #==============================================================================
  262.  
  263. class Window_FileStatus < Window_Base
  264.  
  265.   #--------------------------------------------------------------------------
  266.   # initialize
  267.   #--------------------------------------------------------------------------
  268.   def initialize(dx, dy, file_window)
  269.     super(dx, dy, Graphics.width - dx, Graphics.height - dy)
  270.     @file_window = file_window
  271.     @current_index = @file_window.index
  272.     refresh
  273.   end
  274.  
  275.   #--------------------------------------------------------------------------
  276.   # update
  277.   #--------------------------------------------------------------------------
  278.   def update
  279.     super
  280.     return if @file_window.index < 0
  281.     return if @current_index == @file_window.index
  282.     @current_index = @file_window.index
  283.     refresh
  284.   end
  285.  
  286.   #--------------------------------------------------------------------------
  287.   # refresh
  288.   #--------------------------------------------------------------------------
  289.   def refresh
  290.     contents.clear
  291.     reset_font_settings
  292.     @header = DataManager.load_header(@file_window.index)
  293.     if @header.nil?
  294.       draw_empty
  295.     else
  296.       draw_save_contents
  297.     end
  298.   end
  299.  
  300.   #--------------------------------------------------------------------------
  301.   # draw_empty
  302.   #--------------------------------------------------------------------------
  303.   def draw_empty
  304.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  305.     rect = Rect.new(0, 0, contents.width, contents.height)
  306.     contents.fill_rect(rect, colour)
  307.     text = YEA::SAVE::EMPTY_TEXT
  308.     change_color(system_color)
  309.     draw_text(rect, text, 1)
  310.   end
  311.  
  312.   #--------------------------------------------------------------------------
  313.   # draw_save_slot
  314.   #--------------------------------------------------------------------------
  315.   def draw_save_slot(dx, dy, dw)
  316.     reset_font_settings
  317.     change_color(system_color)
  318.     text = sprintf(YEA::SAVE::SLOT_NAME, "")
  319.     draw_text(dx, dy, dw, line_height, text)
  320.     cx = text_size(text).width
  321.     change_color(normal_color)
  322.     draw_text(dx+cx, dy, dw-cx, line_height, (@file_window.index+1).group)
  323.   end
  324.  
  325.   #--------------------------------------------------------------------------
  326.   # draw_save_playtime
  327.   #--------------------------------------------------------------------------
  328.   def draw_save_playtime(dx, dy, dw)
  329.     return if @header[:playtime_s].nil?
  330.     reset_font_settings
  331.     change_color(system_color)
  332.     draw_text(dx, dy, dw, line_height, YEA::SAVE::PLAYTIME, 0)
  333.     change_color(normal_color)
  334.     draw_text(dx, dy, dw, line_height, @header[:playtime_s], 2)
  335.   end
  336.  
  337.   #--------------------------------------------------------------------------
  338.   # draw_save_total_saves
  339.   #--------------------------------------------------------------------------
  340.   def draw_save_total_saves(dx, dy, dw)
  341.     return if @header[:system].nil?
  342.     reset_font_settings
  343.     change_color(system_color)
  344.     text = YEA::SAVE::TOTAL_SAVE
  345.     draw_text(dx, dy, dw, line_height, text)
  346.     cx = text_size(text).width
  347.     change_color(normal_color)
  348.     draw_text(dx+cx, dy, dw-cx, line_height, @header[:system].save_count.group)
  349.   end
  350.  
  351.   #--------------------------------------------------------------------------
  352.   # draw_save_gold
  353.   #--------------------------------------------------------------------------
  354.   def draw_save_gold(dx, dy, dw)
  355.     return if @header[:party].nil?
  356.     reset_font_settings
  357.     change_color(system_color)
  358.     draw_text(dx, dy, dw, line_height, YEA::SAVE::TOTAL_GOLD)
  359.     text = Vocab::currency_unit
  360.     draw_text(dx, dy, dw, line_height, text, 2)
  361.     cx = text_size(text).width
  362.     change_color(normal_color)
  363.     text = @header[:party].gold.group
  364.     draw_text(dx, dy, dw-cx, line_height, text, 2)
  365.   end
  366.  
  367.   #--------------------------------------------------------------------------
  368.   # draw_save_location
  369.   #--------------------------------------------------------------------------
  370.   def draw_save_location(dx, dy, dw)
  371.     return if @header[:map].nil?
  372.     reset_font_settings
  373.     change_color(system_color)
  374.     draw_text(dx, dy, dw, line_height, YEA::SAVE::LOCATION)
  375.     change_color(normal_color)
  376.     cx = text_size(YEA::SAVE::LOCATION).width
  377.     return if $data_mapinfos[@header[:map].map_id].nil?
  378.     text = @header[:map].display_name
  379.     text = $data_mapinfos[@header[:map].map_id].name if text == ""
  380.     draw_text(dx+cx, dy, dw-cx, line_height, text)
  381.   end
  382.   #--------------------------------------------------------------------------
  383.   # draw_save_characters
  384.   #--------------------------------------------------------------------------
  385.   def draw_save_characters(dx, dy)
  386.     return if @header[:party].nil?
  387.     reset_font_settings
  388.     make_font_smaller
  389.     dw = (contents.width - dx) / @header[:party].max_battle_members
  390.     dx += dw/2
  391.     for member in @header[:party].battle_members
  392.       next if member.nil?
  393.       member = @header[:actors][member.id]
  394.       change_color(normal_color)
  395.       draw_actor_graphic(member, dx, dy)
  396.       text = member.name
  397.       #draw_text(dx-dw/2, dy, dw, line_height, text, 1)
  398.       #text = member.level.group
  399.       #draw_text(dx-dw/2, dy-line_height, dw-4, line_height, text, 2)
  400.       #cx = text_size(text).width
  401.       #change_color(system_color)
  402.       #text = Vocab::level_a
  403.       #draw_text(dx-dw/2, dy-line_height, dw-cx-4, line_height, text, 2)
  404.       #dx += dw
  405.     end
  406.   end
  407.  
  408.   #--------------------------------------------------------------------------
  409.   # draw_save_column1
  410.   #--------------------------------------------------------------------------
  411.   def draw_save_column1(dx, dy, dw)
  412.     data = YEA::SAVE::COLUMN1_VARIABLES
  413.     draw_column_data(data, dx, dy, dw)
  414.   end
  415.  
  416.   #--------------------------------------------------------------------------
  417.   # draw_save_column2
  418.   #--------------------------------------------------------------------------
  419.   def draw_save_column2(dx, dy, dw)
  420.     data = YEA::SAVE::COLUMN2_VARIABLES
  421.     draw_column_data(data, dx, dy, dw)
  422.   end
  423.  
  424.   #--------------------------------------------------------------------------
  425.   # draw_column_data
  426.   #--------------------------------------------------------------------------
  427.   def draw_column_data(data, dx, dy, dw)
  428.     return if @header[:variables].nil?
  429.     reset_font_settings
  430.     for variable_id in data
  431.       next if $data_system.variables[variable_id].nil?
  432.       change_color(system_color)
  433.       name = $data_system.variables[variable_id]
  434.       draw_text(dx, dy, dw, line_height, name, 0)
  435.       value = @header[:variables][variable_id].group
  436.       change_color(normal_color)
  437.       draw_text(dx, dy, dw, line_height, value, 2)
  438.       dy += line_height
  439.     end
  440.   end
  441.  
  442.   #--------------------------------------------------------------------------
  443.   # draw_save_contents
  444.   #--------------------------------------------------------------------------
  445.   def draw_save_contents
  446.     draw_save_slot(4, 0, contents.width/2-8)
  447.     draw_save_playtime(contents.width/2+4, 0, contents.width/2-8)
  448.     draw_save_total_saves(4, line_height, contents.width/2-8)
  449.     draw_save_gold(contents.width/2+4, line_height, contents.width/2-8)
  450.     draw_save_location(4, line_height*2, contents.width-8)
  451.     draw_save_characters(0, line_height*5 + line_height/3)
  452.     draw_save_column1(16, line_height*7, contents.width/2-48)
  453.     draw_save_column2(contents.width/2+16, line_height*7, contents.width/2-48)
  454.   end
  455.  
  456. end # Window_FileStatus
  457.  
  458. #==============================================================================
  459. # ?! Window_FileAction
  460. #==============================================================================
  461.  
  462. class Window_FileAction < Window_HorzCommand
  463.  
  464.   #--------------------------------------------------------------------------
  465.   # initialize
  466.   #--------------------------------------------------------------------------
  467.   def initialize(dx, dy, file_window)
  468.     @file_window = file_window
  469.     super(dx, dy)
  470.     deactivate
  471.     unselect
  472.   end
  473.  
  474.   #--------------------------------------------------------------------------
  475.   # window_width
  476.   #--------------------------------------------------------------------------
  477.   def window_width; Graphics.width - 128; end
  478.  
  479.   #--------------------------------------------------------------------------
  480.   # col_max
  481.   #--------------------------------------------------------------------------
  482.   def col_max; return 3; end
  483.  
  484.   #--------------------------------------------------------------------------
  485.   # update
  486.   #--------------------------------------------------------------------------
  487.   def update
  488.     super
  489.     return if @file_window.index < 0
  490.     return if @current_index == @file_window.index
  491.     @current_index = @file_window.index
  492.     refresh
  493.   end
  494.  
  495.   #--------------------------------------------------------------------------
  496.   # make_command_list
  497.   #--------------------------------------------------------------------------
  498.   def make_command_list
  499.     @header = DataManager.load_header(@file_window.index)
  500.     add_load_command
  501.     add_save_command
  502.     add_delete_command
  503.   end
  504.  
  505.   #--------------------------------------------------------------------------
  506.   # add_load_command
  507.   #--------------------------------------------------------------------------
  508.   def add_load_command
  509.     add_command(YEA::SAVE::ACTION_LOAD, :load, load_enabled?)
  510.   end
  511.  
  512.   #--------------------------------------------------------------------------
  513.   # load_enabled?
  514.   #--------------------------------------------------------------------------
  515.   def load_enabled?
  516.     return false if @header.nil?
  517.     return true
  518.   end
  519.  
  520.   #--------------------------------------------------------------------------
  521.   # add_save_command
  522.   #--------------------------------------------------------------------------
  523.   def add_save_command
  524.     add_command(YEA::SAVE::ACTION_SAVE, :save, save_enabled?)
  525.   end
  526.  
  527.   #--------------------------------------------------------------------------
  528.   # save_enabled?
  529.   #--------------------------------------------------------------------------
  530.   def save_enabled?
  531.     return false if @header.nil? && SceneManager.scene_is?(Scene_Load)
  532.     return false if SceneManager.scene_is?(Scene_Load)
  533.     return false if $game_system.save_disabled
  534.     return true
  535.   end
  536.  
  537.   #--------------------------------------------------------------------------
  538.   # add_delete_command
  539.   #--------------------------------------------------------------------------
  540.   def add_delete_command
  541.     add_command(YEA::SAVE::ACTION_DELETE, :delete, delete_enabled?)
  542.   end
  543.  
  544.   #--------------------------------------------------------------------------
  545.   # delete_enabled?
  546.   #--------------------------------------------------------------------------
  547.   def delete_enabled?
  548.     return false if @header.nil?
  549.     return true
  550.   end
  551.  
  552.   #--------------------------------------------------------------------------
  553.   # update_help
  554.   #--------------------------------------------------------------------------
  555.   def update_help
  556.     case current_symbol
  557.     when :load; @help_window.set_text(YEA::SAVE::LOAD_HELP)
  558.     when :save; @help_window.set_text(YEA::SAVE::SAVE_HELP)
  559.     when :delete; @help_window.set_text(YEA::SAVE::DELETE_HELP)
  560.     end
  561.   end
  562.  
  563. end # Window_FileAction
  564.  
  565. #==============================================================================
  566. # ?! Scene_File
  567. #==============================================================================
  568.  
  569. class Scene_File < Scene_MenuBase
  570.  
  571.   #--------------------------------------------------------------------------
  572.   # overwrite method: start
  573.   #--------------------------------------------------------------------------
  574.   def start
  575.     super
  576.     create_all_windows
  577.   end
  578.  
  579.   #--------------------------------------------------------------------------
  580.   # overwrite method: terminate
  581.   #--------------------------------------------------------------------------
  582.   def terminate
  583.     super
  584.   end
  585.  
  586.   #--------------------------------------------------------------------------
  587.   # overwrite method: update
  588.   #--------------------------------------------------------------------------
  589.   def update
  590.     super
  591.   end
  592.  
  593.   #--------------------------------------------------------------------------
  594.   # new method: create_all_windows
  595.   #--------------------------------------------------------------------------
  596.   def create_all_windows
  597.     create_help_window
  598.     create_file_window
  599.     create_action_window
  600.     create_status_window
  601.   end
  602.  
  603.   #--------------------------------------------------------------------------
  604.   # overwrite method: create_help_window
  605.   #--------------------------------------------------------------------------
  606.   def create_help_window
  607.     @help_window = Window_Help.new
  608.     @help_window.set_text(YEA::SAVE::SELECT_HELP)
  609.   end
  610.  
  611.   #--------------------------------------------------------------------------
  612.   # new method: create_file_window
  613.   #--------------------------------------------------------------------------
  614.   def create_file_window
  615.     wy = @help_window.height
  616.     @file_window = Window_FileList.new(0, wy)
  617.     @file_window.set_handler(:ok, method(:on_file_ok))
  618.     @file_window.set_handler(:cancel, method(:return_scene))
  619.   end
  620.  
  621.   #--------------------------------------------------------------------------
  622.   # new method: create_action_window
  623.   #--------------------------------------------------------------------------
  624.   def create_action_window
  625.     wx = @file_window.width
  626.     wy = @help_window.height
  627.     @action_window = Window_FileAction.new(wx, wy, @file_window)
  628.     @action_window.help_window = @help_window
  629.     @action_window.set_handler(:cancel, method(:on_action_cancel))
  630.     @action_window.set_handler(:load, method(:on_action_load))
  631.     @action_window.set_handler(:save, method(:on_action_save))
  632.     @action_window.set_handler(:delete, method(:on_action_delete))
  633.   end
  634.  
  635.   #--------------------------------------------------------------------------
  636.   # new method: create_status_window
  637.   #--------------------------------------------------------------------------
  638.   def create_status_window
  639.     wx = @action_window.x
  640.     wy = @action_window.y + @action_window.height
  641.     @status_window = Window_FileStatus.new(wx, wy, @file_window)
  642.   end
  643.  
  644.   #--------------------------------------------------------------------------
  645.   # new method: on_file_ok
  646.   #--------------------------------------------------------------------------
  647.   def on_file_ok
  648.     @action_window.activate
  649.     index = SceneManager.scene_is?(Scene_Load) ? 0 : 1
  650.     @action_window.select(index)
  651.   end
  652.  
  653.   #--------------------------------------------------------------------------
  654.   # new method: on_action_cancel
  655.   #--------------------------------------------------------------------------
  656.   def on_action_cancel
  657.     @action_window.unselect
  658.     @file_window.activate
  659.     @help_window.set_text(YEA::SAVE::SELECT_HELP)
  660.   end
  661.  
  662.   #--------------------------------------------------------------------------
  663.   # new method: on_action_load
  664.   #--------------------------------------------------------------------------
  665.   def on_action_load
  666.     if DataManager.load_game(@file_window.index)
  667.       on_load_success
  668.     else
  669.       Sound.play_buzzer
  670.     end
  671.   end
  672.  
  673.   #--------------------------------------------------------------------------
  674.   # overwrite method: on_load_success
  675.   #--------------------------------------------------------------------------
  676.   def on_load_success
  677.     Sound.play_load
  678.     fadeout_all
  679.     $game_system.on_after_load
  680.     SceneManager.goto(Scene_Map)
  681.   end
  682.  
  683.   #--------------------------------------------------------------------------
  684.   # new method: on_action_save
  685.   #--------------------------------------------------------------------------
  686.   def on_action_save
  687.     @action_window.activate
  688.     if DataManager.save_game(@file_window.index)
  689.       on_save_success
  690.       refresh_windows
  691.     else
  692.       Sound.play_buzzer
  693.     end
  694.   end
  695.  
  696.   #--------------------------------------------------------------------------
  697.   # overwrite method: on_save_success
  698.   #--------------------------------------------------------------------------
  699.   def on_save_success; Sound.play_save; end
  700.  
  701.   #--------------------------------------------------------------------------
  702.   # new method: on_action_delete
  703.   #--------------------------------------------------------------------------
  704.   def on_action_delete
  705.     @action_window.activate
  706.     DataManager.delete_save_file(@file_window.index)
  707.     on_delete_success
  708.     refresh_windows
  709.   end
  710.  
  711.   #--------------------------------------------------------------------------
  712.   # new method: on_delete_success
  713.   #--------------------------------------------------------------------------
  714.   def on_delete_success
  715.     YEA::SAVE::DELETE_SOUND.play
  716.   end
  717.  
  718.   #--------------------------------------------------------------------------
  719.   # new method: refresh_windows
  720.   #--------------------------------------------------------------------------
  721.   def refresh_windows
  722.     @file_window.refresh
  723.     @action_window.refresh
  724.     @status_window.refresh
  725.   end
  726.  
  727. end # Scene_File
  728.  
  729. #==============================================================================
  730. # ?! Scene_Save
  731. #==============================================================================
  732.  
  733. class Scene_Save < Scene_File
  734.  
  735.   #--------------------------------------------------------------------------
  736.   # overwrite method: on_savefile_ok
  737.   #--------------------------------------------------------------------------
  738.   def on_savefile_ok; super; end
  739.  
  740.   #--------------------------------------------------------------------------
  741.   # overwrite method: on_save_success
  742.   #--------------------------------------------------------------------------
  743.   def on_save_success; super; end
  744.  
  745. end # help_window_text
  746.  
  747. #==============================================================================
  748. # ?! Scene_Load
  749. #==============================================================================
  750.  
  751. class Scene_Load < Scene_File
  752.  
  753.   #--------------------------------------------------------------------------
  754.   # overwrite method: on_savefile_ok
  755.   #--------------------------------------------------------------------------
  756.   def on_savefile_ok; super; end
  757.  
  758.   #--------------------------------------------------------------------------
  759.   # overwrite method: on_load_success
  760.   #--------------------------------------------------------------------------
  761.   def on_load_success; super; end
  762.  
  763. end # Scene_Load
  764.  
  765. #==============================================================================
  766. #
  767. # ?\ End of File
  768. #
  769. #==============================================================================

Lv4.逐梦者

梦石
0
星屑
6160
在线时间
793 小时
注册时间
2019-1-20
帖子
204
2
发表于 2024-10-8 23:10:50 | 只看该作者
  1. #旧存档需要全部删除
  2. #脚本放在源脚本后面,会整合的就自己搞吧

  3. module DataManager
  4.   def self.actor_name(n)
  5.     actor = n >= 1 ? $game_actors[n] : nil
  6.     actor ? actor.name : ""
  7.   end
  8. #--------------------------------------------------------------------------
  9.   def self.party_member_name(n)
  10.     actor = n >= 1 ? $game_party.members[n - 1] : nil
  11.     actor ? actor.name : ""
  12.   end  
  13. #--------------------------------------------------------------------------
  14.   def self.convert_escape_characters(text)
  15.     result = text.to_s.clone
  16.     result.gsub!(/\\/)            { "\e" }
  17.     result.gsub!(/\e\e/)          { "\\" }
  18.     result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
  19.     result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
  20.     result.gsub!(/\eN\[(\d+)\]/i) { DataManager.actor_name($1.to_i) }
  21.     result.gsub!(/\eP\[(\d+)\]/i) { DataManager.party_member_name($1.to_i) }
  22.     result.gsub!(/\eG/i)          { Vocab::currency_unit }
  23.     result
  24.   end
  25. #--------------------------------------------------------------------------
  26.   def self.make_save_header
  27.     header = {}

  28.     text = $game_map.display_name
  29.     text = $data_mapinfos[$game_map.map_id].name if text == ""
  30.     text=DataManager.convert_escape_characters(text)
  31.     header[:name] =text  

  32.     header[:characters]    = $game_party.characters_for_savefile
  33.     header[:playtime_s]    = $game_system.playtime_s
  34.     header[:system]        = Marshal.load(Marshal.dump($game_system))
  35.     header[:timer]         = Marshal.load(Marshal.dump($game_timer))
  36.     header[:message]       = Marshal.load(Marshal.dump($game_message))
  37.     header[:switches]      = Marshal.load(Marshal.dump($game_switches))
  38.     header[:variables]     = Marshal.load(Marshal.dump($game_variables))
  39.     header[:self_switches] = Marshal.load(Marshal.dump($game_self_switches))
  40.     header[:actors]        = Marshal.load(Marshal.dump($game_actors))
  41.     header[:party]         = Marshal.load(Marshal.dump($game_party))
  42.     header[:troop]         = Marshal.load(Marshal.dump($game_troop))
  43.     header[:map]           = Marshal.load(Marshal.dump($game_map))
  44.     header[:player]        = Marshal.load(Marshal.dump($game_player))
  45.     header
  46.   end
  47. end # DataManager
  48. ###
  49. class Window_FileStatus < Window_Base
  50.   #--------------------------------------------------------------------------
  51.   # draw_save_location
  52.   #--------------------------------------------------------------------------
  53.   def draw_save_location(dx, dy, dw)
  54.     return if @header[:map].nil?
  55.     reset_font_settings
  56.     change_color(system_color)
  57.     draw_text(dx, dy, dw, line_height, YEA::SAVE::LOCATION)
  58.     change_color(normal_color)
  59.     cx = text_size(YEA::SAVE::LOCATION).width
  60.     return if $data_mapinfos[@header[:map].map_id].nil?
  61.     #text = @header[:map].display_name
  62.     #text = $data_mapinfos[@header[:map].map_id].name if text == ""
  63.    
  64.     text=@header[:name]  
  65.    
  66.     draw_text(dx+cx, dy, dw-cx, line_height, text)
  67.   end
  68. end #
  69. ###
复制代码



提高解答机会的方法:
看一下对应版本的帮助文件 看天气预报说今天不下雨
改变问题为更有可能的或常见的 如:天气自动变化下雨→天气系统 果然不准呀~
使用论坛的搜索功能查找相关问题 好丧啊... ...想看女装
清楚说明实际上你想解决的问题  想看坛友的女装  
脚本自己有改过的地方要标明  不要遮脸的
脚本有问题但不是默认的要全部贴出来 大胆点,尽情发
三包原则:包有BUG,包甩锅,包咕咕
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
863
在线时间
297 小时
注册时间
2018-8-24
帖子
5
3
 楼主| 发表于 2024-10-11 17:57:40 | 只看该作者
本帖最后由 helsingtsai 于 2024-10-11 21:06 编辑


感谢你的回答,现在存档已经能够显示出想要的效果了
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-17 23:32

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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