#==============================================================================
# ■ 【VX Ace】章节选择 - By 哇哈哈哇哈哈(Ver 1.03)
#------------------------------------------------------------------------------
# 简介:通过章节进行传送。
# 适用范围:大部分游戏。
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ※ 基本信息(Basic Information):
# * 适用:RPGVXAce(RGSS3)
# * 难度:★★★
# * 版本:1.03
# * 编写日期:2014/8/25
# * 上手度:中等
# * 兼容性:中等
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#------------------------------------------------------------------------------
# ※ 使用方法、注意事项及更新内容 ※
#------------------------------------------------------------------------------
# ● 使用方法:
# 放入脚本Main之上,为了减少冲突请将脚本尽量往下放置。
# 地图中使用该脚本:local
# 如果章节需要条件开启,请将Value_C所设置的变量序号设置到相应的数值。
# 例如:开启第二章,将3号变量赋值为2。
# 如有疑问请在脚本发布贴内说明。
# 请将章节开启后输入事件脚本saver
#------------------------------------------------------------------------------
# ● 注意事项:
# 1、请查看该脚本是否用于RMVA上。
# 2、由于脚本未经多次测试,兼容性未知。
# 3、如有BUG请及时反馈。
#------------------------------------------------------------------------------
# ● 版本更新:
# * 1.03 12.15
# 1、新增加章节补充说明,提高脚本实用性和灵活性;
# 2、改善多处细节,即使不使用基础脚本也可以运行。
# * 1.02 11.30
# 1、再次修改脚本,取消大部分全局变量;
# 2、增强脚本兼容性。
# 3、加强细节修正。
# * 1.01 9.20
# 1、简化语句,修改项位置修改至更容易修改的地方;
# 2、更改章节更新的脚本及位置,使操作更简单。
# * 1.00 8.26
# 初版发布,脚本制作完成。
#==============================================================================
$wahaha_script = {} if $wahaha_script.nil?
$wahaha_script["local_choose"] = 1.03
module Wahaha
# 支持此脚本运行的变量序号。
Value_C = 3
# 章节设置。
# 其格式为[名称,地图序号,X坐标,Y坐标]。
Name1 = ["Fleid",1,15,12,"World"]
Name2 = ["Darkspace",2,10,"Castle"]
Name3 = ["MagicCastle",3,21,16,"Plain"]
Name4 = ["Memory",4,13,15,"Crystal"]
Name5 = ["Final",5,17,11,"Demoncastle"]
# 位于界面右旁的说明。
Story = ("今天我们所讲的就有这些,你需\n要进行不断的传送才可以成为兄\n贵!!!")
# 在标题画面中是否自动开启章节选择,如果不需要请改为false.
NewStart = true
# 进入章节选择的背景界面,需要放入游戏根目录/Graphics/Title1文件夹里。
# 你可以自定义设置。
Background = "Plain"
# 第一章是否默认开启?如果不是请改为false.
Normal_One = true
end
#==============================================================================
# ■ Script
#------------------------------------------------------------------------------
# ※ 注意:除注释区内制定修改的脚本以外请勿随意更改,否则会发生脚本错误。
#==============================================================================
#==============================================================================
# ■ Scene_Title
#------------------------------------------------------------------------------
# 标题画面
#==============================================================================
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
alias wahaha_orginial_20141031 start
def start
wahaha_orginial_20141031
Wahaha_Save.newdoc_save unless FileTest.exist?("System/Saver_Wahaha.rvdata2")
Wahaha_Save.newdoc_load if FileTest.exist?("System/Saver_Wahaha.rvdata2")
end
end
#==============================================================================
# ■ Game_Interpreter
#------------------------------------------------------------------------------
# 事件指令的解释器。
# 本类在 Game_Map、Game_Troop、Game_Event 类的内部使用。
#==============================================================================
class Game_Interpreter
def saver
Wahaha_Save.newdoc_save
end
def local
SceneManager.call(Scene_Localer)
end
end
#==============================================================================
# ■ WahahaSave
#------------------------------------------------------------------------------
# 变量储存的设置。
#==============================================================================
module Wahaha_Save
#=============================================================================
# * 将游戏变量储存到一个文件内。
#=============================================================================
def self.newdoc_save
file = File.open("System/Saver_Wahaha.rvdata2","wb")
Marshal.dump($game_variables, file)
file.close
end
def self.newdoc_load
file = File.open("System/Saver_Wahaha.rvdata2","rb")
$game_variables = Marshal.load(file)
file.close
end
end
module Check_Locals
def self.filexist?(kao)
$game_variables[Wahaha::Value_C] >= kao
end
end
#==============================================================================
# ■ Scene_Title
#------------------------------------------------------------------------------
# 标题画面。
#==============================================================================
class Scene_Title < Scene_Base
alias a start
def start
a
Wahaha_Save.newdoc_load
end
alias old_command_new_game command_new_game
def command_new_game
if Wahaha::NewStart
close_command_window
SceneManager.call(Scene_Localer)
else
old_command_new_game
end
end
end
#==============================================================================
# ■ Window_Localer
#------------------------------------------------------------------------------
# 传送画面的窗口。
#==============================================================================
class Window_Localer < Window_Command
include Wahaha
def initialize
super(0, 0)
update_placement
select_symbol(:one) if checker1
select_symbol(:two) if checker2
select_symbol(:thr) if checker3
select_symbol(:fou) if checker4
select_symbol(:fiv) if checker5
self.openness = 0
open
end
def window_width
return 160
end
def update_placement
self.x = 0
self.y = 50
end
def make_command_list
add_command(Name1[0], :one,checker1)
add_command(Name2[0], :two,checker2)
add_command(Name3[0], :thr,checker3)
add_command(Name4[0], :fou,checker4)
add_command(Name5[0], :fiv,checker5)
end
def checker1
Check_Locals.filexist?(1)
end
def checker2
Check_Locals.filexist?(2)
end
def checker3
Check_Locals.filexist?(3)
end
def checker4
Check_Locals.filexist?(4)
end
def checker5
Check_Locals.filexist?(5)
end
end
class Window_Localersyst <Window_Selectable
def initialize
super(0, 0, Graphics.width, 50)
draw_text_ex(4, 1, "★-☆-★-☆-★-☆章节选择★-☆-★-☆-★-☆")
activate
end
end
class Window_Localertext < Window_Selectable
def initialize
super(160, 50, Graphics.width - 160, Graphics.height - 50)
draw_text_ex(4, 0, Wahaha::Story)
activate
end
end
#==============================================================================
# ■ Scene_Localer
#------------------------------------------------------------------------------
# 传送画面。
#==============================================================================
class Scene_Localer < Scene_Base
include Wahaha
def start
super
Graphics.freeze
onesa
create_command_window
create_command_window2
new_background
end
def transition_speed
return 20
end
def terminate
super
SceneManager.snapshot_for_background
end
def onesa
$game_variables[Value_C] = 1 if Normal_One && $game_variables[Value_C] == 0
end
def new_background
@background_sprite = Sprite.new
@background_sprite.bitmap = Cache.title1(Background)
@background_sprite.color.set(16, 16, 16, 128)
end
def create_command_window
@command_window = Window_Localer.new
@command_window.set_handler(:one, method(:one1))
@command_window.set_handler(:two, method(:two2))
@command_window.set_handler(:thr, method(:thr3))
@command_window.set_handler(:fou, method(:fou4))
@command_window.set_handler(:fiv, method(:fiv5))
@command_window.set_handler(:cancel, method(:return_scene))
end
def create_command_window2
@story_window = Window_Localertext.new
@story_window.set_handler(:cancel, method(:return_scene))
@story2_window = Window_Localersyst.new
@story2_window.set_handler(:cancel, method(:return_scene))
end
def close_command_window
@command_window.close
update until @command_window.close?
end
def same
close_command_window
DataManager.setup_new_game
fadeout_all
end
def one1
same
$game_map.setup(Name1[1])
$game_player.moveto(Name1[2],Name1[3])
$game_map.autoplay
SceneManager.goto(Scene_Map)
end
def two2
same
$game_map.setup(Name2[1])
$game_player.moveto(Name2[2],Name2[3])
$game_map.autoplay
SceneManager.goto(Scene_Map)
end
def thr3
same
$game_map.setup(Name3[1])
$game_player.moveto(Name3[2],Name3[3])
$game_map.autoplay
SceneManager.goto(Scene_Map)
end
def fou4
same
$game_map.setup(Name4[1])
$game_player.moveto(Name4[2],Name4[3])
$game_map.autoplay
SceneManager.goto(Scene_Map)
end
def fiv5
same
$game_map.setup(Name5[1])
$game_player.moveto(Name5[2],Name5[3])
$game_map.autoplay
SceneManager.goto(Scene_Map)
end
end
#==============================================================================
# ■ 脚本结束
#------------------------------------------------------------------------------
# ※ The End of Scripts 2014/8/26 10:04
#==============================================================================