设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 110|回复: 0

[转载发布] Chapter Select

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58883
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68848

    灌水之王

    发表于 2026-8-2 08:34:41 | 显示全部楼层 |阅读模式
    Made for a request here.

    Features:

    [1] Game starting by selecting a Chapter.

    [2] Unlock-able new chapters.

    [3] Each Chapter able to start with its own map & starting characters.

    [4] Inheritable save files for each chapter.

    [5] Can set up to 10 Chapters max.

    [6] Change-able Background/Text

    [7] Able to set whether or not to reset character's level

    Snap-Shot:



    How to Use:

    [1] Paste script below Material and above Main

    [2] Set up data accordingly in SETTINGS AREA in the script.

    [3] Use this script call at the end of each chapter to enable next chapter.

    chapter_clearedCompatibility:

    This script modifies the Title Scene's New Game Command, but the rest are properly aliased.

    You can safely put this script below other custom scripts without worrying much about conflicts.

    Terms of Use:

    Free for both Commercial and Non-Commercial.

    Script:
    Spoiler: Cleaned up script taken from the post at bottom of the page
                    Code:       
    1. #==============================================================================
    2. # ■ Meow Face Chapter Selection
    3. #------------------------------------------------------------------------------
    4. # Select Chapter to Start Game
    5. #==============================================================================
    6. # How to Use:
    7. # [1] Put this script below Material and above Main
    8. # [2] Set up the required data in SETTINGS AREA below
    9. # [3] At the end of each chapter, use this script call to save file
    10. #      chapter_cleared
    11. #==============================================================================
    12. module MF_CHAPTER
    13. #==============================================================================
    14. # SETTINGS AREA
    15. #==============================================================================
    16. #------------------------------------------------------------------------------
    17. # How many chapters are there (1 to 10 MAX)
    18. #------------------------------------------------------------------------------
    19.   MAXCHAPTER = 10
    20. #------------------------------------------------------------------------------
    21. # Background picture (in Graphics\Titles1 folder)
    22. #------------------------------------------------------------------------------
    23.   BACKGROUND = "Fountain"
    24. #------------------------------------------------------------------------------
    25. # Title
    26. #------------------------------------------------------------------------------
    27.   TITLE = "SELECT CHAPTER"
    28. #------------------------------------------------------------------------------
    29. # Chapter's Name
    30. # Starting from top down, Chapter 1, Chapter 2, etc etc
    31. #------------------------------------------------------------------------------
    32.   NAME = [
    33.   "Chapter One",
    34.   "Chapter Two",
    35.   "Chapter Three",
    36.   "Chapter Four",
    37.   "Chapter Five",
    38.   "Chapter Six",
    39.   "Chapter Seven",
    40.   "Chapter Eight",
    41.   "Chapter Nine",
    42.   "Chapter Ten",
    43.   ] #Do Not Remove
    44. #------------------------------------------------------------------------------
    45. # Chapter's Description
    46. # Starting from top down, Chapter 1, Chapter 2, etc etc
    47. #------------------------------------------------------------------------------
    48.   DESC = [
    49.   "Chapter 1 Descriptions",
    50.   "Chapter 2 Descriptions",
    51.   "Chapter 3 Descriptions",
    52.   "Chapter 4 Descriptions",
    53.   "Chapter 5 Descriptions",
    54.   "Chapter 6 Descriptions",
    55.   "Chapter 7 Descriptions",
    56.   "Chapter 8 Descriptions",
    57.   "Chapter 9 Descriptions",
    58.   "Chapter 10 Descriptions",
    59.   ] #Do Not Remove
    60. #------------------------------------------------------------------------------
    61. # Starting Map for each Chapter
    62. # [MapID, StartX, StartY]
    63. # Starting top down from Chapter 1 to Chapter 10
    64. #------------------------------------------------------------------------------
    65.   MAP = [
    66.   [1,1,1],
    67.   [2,1,7],
    68.   [3,12,16],
    69.   [4,1,1],
    70.   [5,1,1],
    71.   [6,1,1],
    72.   [7,1,1],
    73.   [8,1,1],
    74.   [9,1,1],
    75.   [10,1,1],
    76.   ] #Do Not Remove
    77. #------------------------------------------------------------------------------
    78. # Starting Actors for each Chapter
    79. # Starting top down from Chapter 1 to Chapter 10
    80. #------------------------------------------------------------------------------
    81.   ACTORS = [
    82.   [1,4,2,5],
    83.   [1,2,3,4],
    84.   [1,2,3],
    85.   [2,3,4,5],
    86.   [1,2,3,4],
    87.   [1,2,3,4],
    88.   [1,2,3,4],
    89.   [1,2,3,4],
    90.   [1,2,3,4],
    91.   [1,2,3,4],
    92.   ] #Do Not Remove
    93. #------------------------------------------------------------------------------
    94. # Reset Actor's Level? true/false
    95. # Automatic set to true if previous chapter load file = nil
    96. #------------------------------------------------------------------------------
    97.   RESET = false
    98. #------------------------------------------------------------------------------
    99. # Data Loading for each Chapter
    100. # This loads the data of the previous chapters during chapter selection
    101. # So set up the file for each chapter accordingly
    102. # Starting top down from Chapter 1 to Chapter 10
    103. # nil = No load file
    104. #------------------------------------------------------------------------------
    105.   LOAD_FILE = [
    106.   nil,
    107.   "Chapter1_Cleared.rvdata2",
    108.   "Chapter2_Cleared.rvdata2",
    109.   "Chapter3_Cleared.rvdata2",
    110.   "Chapter4_Cleared.rvdata2",
    111.   "Chapter5_Cleared.rvdata2",
    112.   "Chapter6_Cleared.rvdata2",
    113.   "Chapter7_Cleared.rvdata2",
    114.   "Chapter8_Cleared.rvdata2",
    115.   "Chapter9_Cleared.rvdata2",
    116.   ] #Do Not Remove
    117. #------------------------------------------------------------------------------
    118. # Save Data's Name
    119. #------------------------------------------------------------------------------
    120.   SAVE_FILE = [
    121.   "Chapter1_Cleared.rvdata2",
    122.   "Chapter2_Cleared.rvdata2",
    123.   "Chapter3_Cleared.rvdata2",
    124.   "Chapter4_Cleared.rvdata2",
    125.   "Chapter5_Cleared.rvdata2",
    126.   "Chapter6_Cleared.rvdata2",
    127.   "Chapter7_Cleared.rvdata2",
    128.   "Chapter8_Cleared.rvdata2",
    129.   "Chapter9_Cleared.rvdata2",
    130.   "Chapter10_Cleared.rvdata2",
    131.   ] #Do Not Remove
    132. #==============================================================================
    133. # END OF SETTINGS AREA
    134. # !!EDIT BEYOND THIS LINE AT YOUR OWN RISK!!
    135. #==============================================================================
    136. end
    137. module DataManager
    138.   class <<self
    139.     alias meow_god create_game_objects
    140.     alias meow_load extract_save_contents
    141.     alias meow_save make_save_contents
    142.   end
    143.   def self.make_save_contents
    144.     meowdata = meow_save
    145.     meowdata[:chapter] = $game_chapter
    146.     meowdata
    147.   end
    148.   def self.extract_save_contents(contents)
    149.     meow_load(contents)
    150.     $game_chapter = contents[:chapter]
    151.   end
    152.   def self.make_save_party
    153.     contents = {}
    154.     contents[:actors]        = $game_actors
    155.     contents[:party]         = $game_party
    156.     contents[:player]        = $game_player
    157.     contents
    158.   end
    159.   def self.extract_party(contents)
    160.     $game_actors        =contents[:actors]
    161.     $game_party         = contents[:party]
    162.     $game_player        = contents[:player]
    163.   end
    164.   def self.save_chapter(chapter)
    165.     filename = MF_CHAPTER::SAVE_FILE[chapter]
    166.     File.open(filename, "wb") do |file|
    167.       $game_system.on_before_save
    168.       Marshal.dump(make_save_party, file)
    169.     end
    170.     return true
    171.   end
    172.   def self.load_chapter(chapter)
    173.     filename = MF_CHAPTER::LOAD_FILE[chapter]
    174.     File.open(filename, "rb") do |file|
    175.       extract_party(Marshal.load(file))
    176.     end
    177.     return true
    178.   end
    179.   def self.create_game_objects
    180.     meow_god
    181.     $game_chapter = Game_Chapter.new
    182.   end
    183.   def self.setup_chapter
    184.     chapter = $game_chapter.id
    185.     load_chapter(chapter) if MF_CHAPTER::LOAD_FILE[chapter] != nil
    186.     $game_party.setup_members(chapter)
    187.     $game_map.setup(MF_CHAPTER::MAP[chapter][0])
    188.     $game_player.moveto(MF_CHAPTER::MAP[chapter][1], MF_CHAPTER::MAP[chapter][2])
    189.     $game_player.refresh
    190.     Graphics.frame_count = 0
    191.   end
    192. end
    193. class Game_Party < Game_Unit
    194.   def setup_members(n)
    195.     if MF_CHAPTER::LOAD_FILE[$game_chapter.id] != nil
    196.       @actors.each do |m|
    197.         $game_actors[m].setup(m) if MF_CHAPTER::RESET == true
    198.         $game_actors[m].hp = $game_actors[m].mhp
    199.         $game_actors[m].mp = $game_actors[m].mmp
    200.       end
    201.     end
    202.     @actors = []
    203.     @meowparty = MF_CHAPTER::ACTORS[n]
    204.       @meowparty.each do |meow|
    205.         $game_party.add_actor(meow)
    206.       end
    207.   end
    208. end
    209. class Game_Chapter
    210.   attr_accessor :id
    211.   def initialize
    212.     @id = 0
    213.   end
    214.   def set(n)
    215.     @id = n
    216.   end
    217. end
    218. class Game_Interpreter
    219.   def chapter_cleared
    220.     DataManager.save_chapter($game_chapter.id)
    221.   end
    222. end
    223. class Window_Chapter < Window_Base
    224.   def initialize
    225.     super(0, 0, Graphics.width, Graphics.height)
    226.     self.opacity = 0
    227.     draw_horz_line(Graphics.height - 100)
    228.     draw_horz_line(Graphics.height - 36)
    229.     draw_horz_line(68); draw_horz_line(69)
    230.     draw_horz_line(8); draw_horz_line(7)
    231.     draw_title
    232.   end
    233.   def window_width
    234.     Graphics.width
    235.   end
    236.   def window_height
    237.     Graphics.height
    238.   end
    239.   def draw_horz_line(y)
    240.     line_y = y + line_height / 2 - 1
    241.     contents.fill_rect(0, line_y, contents_width, 2, line_color)
    242.   end
    243.   def line_color
    244.     color = normal_color
    245.     color.alpha = 48
    246.     color
    247.   end
    248.   def draw_title
    249.     contents.font.size = 64
    250.     contents.font.bold = true
    251.     draw_text((Graphics.width/2) - (320/2), 18, 320, 68, MF_CHAPTER::TITLE)
    252.     contents.font.size = Font.default_size
    253.     contents.font.bold = false
    254.   end
    255. end
    256. class Window_ChapterSelect < Window_Command
    257.   def initialize
    258.     super(0,0)
    259.     update_placement
    260.     self.opacity = 0
    261.     create_help_window
    262.   end
    263.   def window_width
    264.     return 180
    265.   end
    266.   def window_height
    267.     fitting_height(6)
    268.   end
    269.   def update_placement
    270.     self.x = (Graphics.width - width) / 2
    271.     self.y = ((Graphics.height - height) / 2) - 12
    272.   end
    273.   def create_help_window
    274.     @help_window = Window_Help.new
    275.     @help_window.y = Graphics.height - @help_window.height + 4
    276.     @help_window.opacity = 0
    277.   end
    278.   def make_command_list
    279.     add_command(MF_CHAPTER::NAME[0], :ch1)
    280.     add_command(MF_CHAPTER::NAME[1], :ch2, File.exist?(MF_CHAPTER::SAVE_FILE[0]))if MF_CHAPTER::MAXCHAPTER >= 2
    281.     add_command(MF_CHAPTER::NAME[2], :ch3, File.exist?(MF_CHAPTER::SAVE_FILE[1])) if MF_CHAPTER::MAXCHAPTER >= 3
    282.     add_command(MF_CHAPTER::NAME[3], :ch4, File.exist?(MF_CHAPTER::SAVE_FILE[2])) if MF_CHAPTER::MAXCHAPTER >= 4
    283.     add_command(MF_CHAPTER::NAME[4], :ch5, File.exist?(MF_CHAPTER::SAVE_FILE[3])) if MF_CHAPTER::MAXCHAPTER >= 5
    284.     add_command(MF_CHAPTER::NAME[5], :ch6, File.exist?(MF_CHAPTER::SAVE_FILE[4])) if MF_CHAPTER::MAXCHAPTER >= 6
    285.     add_command(MF_CHAPTER::NAME[6], :ch7, File.exist?(MF_CHAPTER::SAVE_FILE[5])) if MF_CHAPTER::MAXCHAPTER >= 7
    286.     add_command(MF_CHAPTER::NAME[7], :ch8, File.exist?(MF_CHAPTER::SAVE_FILE[6])) if MF_CHAPTER::MAXCHAPTER >= 8
    287.     add_command(MF_CHAPTER::NAME[8], :ch9, File.exist?(MF_CHAPTER::SAVE_FILE[7])) if MF_CHAPTER::MAXCHAPTER >= 9
    288.     add_command(MF_CHAPTER::NAME[9], :ch10, File.exist?(MF_CHAPTER::SAVE_FILE[8])) if MF_CHAPTER::MAXCHAPTER >= 10
    289.   end
    290.   def process_cursor_move
    291.     super
    292.     if @index <= 1
    293.       @help_window.set_text(MF_CHAPTER::DESC[@index])
    294.     else
    295.       if File.exist?(MF_CHAPTER::SAVE_FILE[@index-1])
    296.         text = MF_CHAPTER::DESC[@index]
    297.       else
    298.         text = "???"
    299.       end
    300.       @help_window.set_text(text)
    301.     end
    302.   end
    303. end
    304. class Scene_Title < Scene_Base
    305.   def command_new_game
    306.     SceneManager.call(Scene_Chapter)
    307.   end
    308. end
    309. class Scene_Chapter < Scene_Base
    310.   def start
    311.     super
    312.     create_background2
    313.     create_back_window
    314.     create_command_window
    315.   end
    316.   def create_background2
    317.     @spritech = Sprite.new
    318.     @spritech.bitmap = Cache.title1(MF_CHAPTER::BACKGROUND)
    319.     @spritech.tone.set(0, 0, 0, 180)
    320.   end
    321.   def terminate
    322.     super
    323.     @spritech.bitmap.dispose if @spritech
    324.     @spritech.dispose if @spritech
    325.   end
    326.   def create_back_window
    327.     @back_window = Window_Chapter.new
    328.   end
    329.   def create_command_window
    330.     @command_window = Window_ChapterSelect.new
    331.     @command_window.set_handler(:ch1, method(:chapter))
    332.     @command_window.set_handler(:ch2, method(:chapter))
    333.     @command_window.set_handler(:ch3, method(:chapter))
    334.     @command_window.set_handler(:ch4, method(:chapter))
    335.     @command_window.set_handler(:ch5, method(:chapter))
    336.     @command_window.set_handler(:ch6, method(:chapter))
    337.     @command_window.set_handler(:ch7, method(:chapter))
    338.     @command_window.set_handler(:ch8, method(:chapter))
    339.     @command_window.set_handler(:ch9, method(:chapter))
    340.     @command_window.set_handler(:ch10, method(:chapter))
    341.     @command_window.set_handler(:cancel, method(:return_scene))
    342.   end
    343.   def chapter
    344.     DataManager.create_game_objects
    345.     case @command_window.current_symbol
    346.     when :ch1; $game_chapter.set(0)
    347.     when :ch2; $game_chapter.set(1)
    348.     when :ch3; $game_chapter.set(2)
    349.     when :ch4; $game_chapter.set(3)
    350.     when :ch5; $game_chapter.set(4)
    351.     when :ch6; $game_chapter.set(5)
    352.     when :ch7; $game_chapter.set(6)
    353.     when :ch8; $game_chapter.set(7)
    354.     when :ch9; $game_chapter.set(8)
    355.     when :ch10; $game_chapter.set(9)
    356.     end
    357.     DataManager.setup_chapter
    358.     fadeout_all
    359.     $game_map.autoplay
    360.     SceneManager.goto(Scene_Map)
    361.   end
    362. end
    复制代码

    Final Update:

    All cleaned up and aliased

    The only overwrite method is the Title Scene's New Game Command.

    You can now safely put this script below all other scripts without having to worry much about conflicts.


    本贴来自国际rpgmaker官方论坛作者:MeowFace处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/chapter-select.45356/

    本帖子中包含更多资源

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

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-17 12:44 , Processed in 0.138726 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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