Chapter Select
Made for a request here.Features:
Game starting by selecting a Chapter.
Unlock-able new chapters.
Each Chapter able to start with its own map & starting characters.
Inheritable save files for each chapter.
Can set up to 10 Chapters max.
Change-able Background/Text
Able to set whether or not to reset character's level
Snap-Shot:
http://s3.postimg.org/4azkkwm43/chapterselect.png
How to Use:
Paste script below Material and above Main
Set up data accordingly in SETTINGS AREA in the script.
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:
#==============================================================================
# ■ Meow Face Chapter Selection
#------------------------------------------------------------------------------
# Select Chapter to Start Game
#==============================================================================
# How to Use:
# Put this script below Material and above Main
# Set up the required data in SETTINGS AREA below
# At the end of each chapter, use this script call to save file
# chapter_cleared
#==============================================================================
module MF_CHAPTER
#==============================================================================
# SETTINGS AREA
#==============================================================================
#------------------------------------------------------------------------------
# How many chapters are there (1 to 10 MAX)
#------------------------------------------------------------------------------
MAXCHAPTER = 10
#------------------------------------------------------------------------------
# Background picture (in Graphics\Titles1 folder)
#------------------------------------------------------------------------------
BACKGROUND = "Fountain"
#------------------------------------------------------------------------------
# Title
#------------------------------------------------------------------------------
TITLE = "SELECT CHAPTER"
#------------------------------------------------------------------------------
# Chapter's Name
# Starting from top down, Chapter 1, Chapter 2, etc etc
#------------------------------------------------------------------------------
NAME = [
"Chapter One",
"Chapter Two",
"Chapter Three",
"Chapter Four",
"Chapter Five",
"Chapter Six",
"Chapter Seven",
"Chapter Eight",
"Chapter Nine",
"Chapter Ten",
] #Do Not Remove
#------------------------------------------------------------------------------
# Chapter's Description
# Starting from top down, Chapter 1, Chapter 2, etc etc
#------------------------------------------------------------------------------
DESC = [
"Chapter 1 Descriptions",
"Chapter 2 Descriptions",
"Chapter 3 Descriptions",
"Chapter 4 Descriptions",
"Chapter 5 Descriptions",
"Chapter 6 Descriptions",
"Chapter 7 Descriptions",
"Chapter 8 Descriptions",
"Chapter 9 Descriptions",
"Chapter 10 Descriptions",
] #Do Not Remove
#------------------------------------------------------------------------------
# Starting Map for each Chapter
#
# Starting top down from Chapter 1 to Chapter 10
#------------------------------------------------------------------------------
MAP = [
,
,
,
,
,
,
,
,
,
,
] #Do Not Remove
#------------------------------------------------------------------------------
# Starting Actors for each Chapter
# Starting top down from Chapter 1 to Chapter 10
#------------------------------------------------------------------------------
ACTORS = [
,
,
,
,
,
,
,
,
,
,
] #Do Not Remove
#------------------------------------------------------------------------------
# Reset Actor's Level? true/false
# Automatic set to true if previous chapter load file = nil
#------------------------------------------------------------------------------
RESET = false
#------------------------------------------------------------------------------
# Data Loading for each Chapter
# This loads the data of the previous chapters during chapter selection
# So set up the file for each chapter accordingly
# Starting top down from Chapter 1 to Chapter 10
# nil = No load file
#------------------------------------------------------------------------------
LOAD_FILE = [
nil,
"Chapter1_Cleared.rvdata2",
"Chapter2_Cleared.rvdata2",
"Chapter3_Cleared.rvdata2",
"Chapter4_Cleared.rvdata2",
"Chapter5_Cleared.rvdata2",
"Chapter6_Cleared.rvdata2",
"Chapter7_Cleared.rvdata2",
"Chapter8_Cleared.rvdata2",
"Chapter9_Cleared.rvdata2",
] #Do Not Remove
#------------------------------------------------------------------------------
# Save Data's Name
#------------------------------------------------------------------------------
SAVE_FILE = [
"Chapter1_Cleared.rvdata2",
"Chapter2_Cleared.rvdata2",
"Chapter3_Cleared.rvdata2",
"Chapter4_Cleared.rvdata2",
"Chapter5_Cleared.rvdata2",
"Chapter6_Cleared.rvdata2",
"Chapter7_Cleared.rvdata2",
"Chapter8_Cleared.rvdata2",
"Chapter9_Cleared.rvdata2",
"Chapter10_Cleared.rvdata2",
] #Do Not Remove
#==============================================================================
# END OF SETTINGS AREA
# !!EDIT BEYOND THIS LINE AT YOUR OWN RISK!!
#==============================================================================
end
module DataManager
class <<self
alias meow_god create_game_objects
alias meow_load extract_save_contents
alias meow_save make_save_contents
end
def self.make_save_contents
meowdata = meow_save
meowdata[:chapter] = $game_chapter
meowdata
end
def self.extract_save_contents(contents)
meow_load(contents)
$game_chapter = contents[:chapter]
end
def self.make_save_party
contents = {}
contents[:actors] = $game_actors
contents[:party] = $game_party
contents[:player] = $game_player
contents
end
def self.extract_party(contents)
$game_actors =contents[:actors]
$game_party = contents[:party]
$game_player = contents[:player]
end
def self.save_chapter(chapter)
filename = MF_CHAPTER::SAVE_FILE
File.open(filename, "wb") do |file|
$game_system.on_before_save
Marshal.dump(make_save_party, file)
end
return true
end
def self.load_chapter(chapter)
filename = MF_CHAPTER::LOAD_FILE
File.open(filename, "rb") do |file|
extract_party(Marshal.load(file))
end
return true
end
def self.create_game_objects
meow_god
$game_chapter = Game_Chapter.new
end
def self.setup_chapter
chapter = $game_chapter.id
load_chapter(chapter) if MF_CHAPTER::LOAD_FILE != nil
$game_party.setup_members(chapter)
$game_map.setup(MF_CHAPTER::MAP)
$game_player.moveto(MF_CHAPTER::MAP, MF_CHAPTER::MAP)
$game_player.refresh
Graphics.frame_count = 0
end
end
class Game_Party < Game_Unit
def setup_members(n)
if MF_CHAPTER::LOAD_FILE[$game_chapter.id] != nil
@actors.each do |m|
$game_actors.setup(m) if MF_CHAPTER::RESET == true
$game_actors.hp = $game_actors.mhp
$game_actors.mp = $game_actors.mmp
end
end
@actors = []
@meowparty = MF_CHAPTER::ACTORS
@meowparty.each do |meow|
$game_party.add_actor(meow)
end
end
end
class Game_Chapter
attr_accessor :id
def initialize
@id = 0
end
def set(n)
@id = n
end
end
class Game_Interpreter
def chapter_cleared
DataManager.save_chapter($game_chapter.id)
end
end
class Window_Chapter < Window_Base
def initialize
super(0, 0, Graphics.width, Graphics.height)
self.opacity = 0
draw_horz_line(Graphics.height - 100)
draw_horz_line(Graphics.height - 36)
draw_horz_line(68); draw_horz_line(69)
draw_horz_line(8); draw_horz_line(7)
draw_title
end
def window_width
Graphics.width
end
def window_height
Graphics.height
end
def draw_horz_line(y)
line_y = y + line_height / 2 - 1
contents.fill_rect(0, line_y, contents_width, 2, line_color)
end
def line_color
color = normal_color
color.alpha = 48
color
end
def draw_title
contents.font.size = 64
contents.font.bold = true
draw_text((Graphics.width/2) - (320/2), 18, 320, 68, MF_CHAPTER::TITLE)
contents.font.size = Font.default_size
contents.font.bold = false
end
end
class Window_ChapterSelect < Window_Command
def initialize
super(0,0)
update_placement
self.opacity = 0
create_help_window
end
def window_width
return 180
end
def window_height
fitting_height(6)
end
def update_placement
self.x = (Graphics.width - width) / 2
self.y = ((Graphics.height - height) / 2) - 12
end
def create_help_window
@help_window = Window_Help.new
@help_window.y = Graphics.height - @help_window.height + 4
@help_window.opacity = 0
end
def make_command_list
add_command(MF_CHAPTER::NAME, :ch1)
add_command(MF_CHAPTER::NAME, :ch2, File.exist?(MF_CHAPTER::SAVE_FILE))if MF_CHAPTER::MAXCHAPTER >= 2
add_command(MF_CHAPTER::NAME, :ch3, File.exist?(MF_CHAPTER::SAVE_FILE)) if MF_CHAPTER::MAXCHAPTER >= 3
add_command(MF_CHAPTER::NAME, :ch4, File.exist?(MF_CHAPTER::SAVE_FILE)) if MF_CHAPTER::MAXCHAPTER >= 4
add_command(MF_CHAPTER::NAME, :ch5, File.exist?(MF_CHAPTER::SAVE_FILE)) if MF_CHAPTER::MAXCHAPTER >= 5
add_command(MF_CHAPTER::NAME, :ch6, File.exist?(MF_CHAPTER::SAVE_FILE)) if MF_CHAPTER::MAXCHAPTER >= 6
add_command(MF_CHAPTER::NAME, :ch7, File.exist?(MF_CHAPTER::SAVE_FILE)) if MF_CHAPTER::MAXCHAPTER >= 7
add_command(MF_CHAPTER::NAME, :ch8, File.exist?(MF_CHAPTER::SAVE_FILE)) if MF_CHAPTER::MAXCHAPTER >= 8
add_command(MF_CHAPTER::NAME, :ch9, File.exist?(MF_CHAPTER::SAVE_FILE)) if MF_CHAPTER::MAXCHAPTER >= 9
add_command(MF_CHAPTER::NAME, :ch10, File.exist?(MF_CHAPTER::SAVE_FILE)) if MF_CHAPTER::MAXCHAPTER >= 10
end
def process_cursor_move
super
if @index <= 1
@help_window.set_text(MF_CHAPTER::DESC[@index])
else
if File.exist?(MF_CHAPTER::SAVE_FILE[@index-1])
text = MF_CHAPTER::DESC[@index]
else
text = "???"
end
@help_window.set_text(text)
end
end
end
class Scene_Title < Scene_Base
def command_new_game
SceneManager.call(Scene_Chapter)
end
end
class Scene_Chapter < Scene_Base
def start
super
create_background2
create_back_window
create_command_window
end
def create_background2
@spritech = Sprite.new
@spritech.bitmap = Cache.title1(MF_CHAPTER::BACKGROUND)
@spritech.tone.set(0, 0, 0, 180)
end
def terminate
super
@spritech.bitmap.dispose if @spritech
@spritech.dispose if @spritech
end
def create_back_window
@back_window = Window_Chapter.new
end
def create_command_window
@command_window = Window_ChapterSelect.new
@command_window.set_handler(:ch1, method(:chapter))
@command_window.set_handler(:ch2, method(:chapter))
@command_window.set_handler(:ch3, method(:chapter))
@command_window.set_handler(:ch4, method(:chapter))
@command_window.set_handler(:ch5, method(:chapter))
@command_window.set_handler(:ch6, method(:chapter))
@command_window.set_handler(:ch7, method(:chapter))
@command_window.set_handler(:ch8, method(:chapter))
@command_window.set_handler(:ch9, method(:chapter))
@command_window.set_handler(:ch10, method(:chapter))
@command_window.set_handler(:cancel, method(:return_scene))
end
def chapter
DataManager.create_game_objects
case @command_window.current_symbol
when :ch1; $game_chapter.set(0)
when :ch2; $game_chapter.set(1)
when :ch3; $game_chapter.set(2)
when :ch4; $game_chapter.set(3)
when :ch5; $game_chapter.set(4)
when :ch6; $game_chapter.set(5)
when :ch7; $game_chapter.set(6)
when :ch8; $game_chapter.set(7)
when :ch9; $game_chapter.set(8)
when :ch10; $game_chapter.set(9)
end
DataManager.setup_chapter
fadeout_all
$game_map.autoplay
SceneManager.goto(Scene_Map)
end
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/
页:
[1]