Project1
标题:
在线等中,严重问题!脚本错误弹出
[打印本页]
作者:
plqws
时间:
2009-9-5 13:59
标题:
在线等中,严重问题!脚本错误弹出
本帖最后由 plqws 于 2009-9-5 15:05 编辑
不知道怎么搞的,好好的只要按下打开存档就会显示scene_title的236行错误,下面是wrong number of arguments(3 for 0) ,什么东西啊?
我把scene_title都复制过来吧!
#==============================================================================
# ■ Scene_Title
#------------------------------------------------------------------------------
# 处理标题画面的类。
#==============================================================================
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
if $BTEST # 战斗测试的情况下
battle_test # 开始战斗测试处理
else # 普通游戏的情况下
super # 原来的主处理
end
end
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
load_database # 载入数据库
create_game_objects # 生成游戏对象
check_continue # 判断继续是否有效
create_title_graphic # 生成标题画面图像
create_command_window # 生成指令窗口
play_title_music # 播放标题画面音乐
end
#--------------------------------------------------------------------------
# ● 执行渐变
#--------------------------------------------------------------------------
def perform_transition
Graphics.transition(20, "Graphics/System/BattleStart")
end
#--------------------------------------------------------------------------
# ● 开始後处理
#--------------------------------------------------------------------------
def post_start
super
open_command_window
end
#--------------------------------------------------------------------------
# ● 结束前处理
#--------------------------------------------------------------------------
def pre_terminate
super
close_command_window
end
#--------------------------------------------------------------------------
# ● 结束处理
#--------------------------------------------------------------------------
def terminate
super
dispose_command_window
snapshot_for_background
dispose_title_graphic
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
@command_window.update
if Input.trigger?(Input::C)
case @command_window.index
when 0 #New game
command_new_game
when 1 # Continue
command_continue
when 2 # Shutdown
command_shutdown
when 3 #显示图片
command_picture
end
end
end
#--------------------------------------------------------------------------
# ● 载入数据库
#--------------------------------------------------------------------------
def load_database
$data_actors = load_data("Data/Actors.rvdata")
$data_classes = load_data("Data/Classes.rvdata")
$data_skills = load_data("Data/Skills.rvdata")
$data_items = load_data("Data/Items.rvdata")
$data_weapons = load_data("Data/Weapons.rvdata")
$data_armors = load_data("Data/Armors.rvdata")
$data_enemies = load_data("Data/Enemies.rvdata")
$data_troops = load_data("Data/Troops.rvdata")
$data_states = load_data("Data/States.rvdata")
$data_animations = load_data("Data/Animations.rvdata")
$data_common_events = load_data("Data/CommonEvents.rvdata")
$data_system = load_data("Data/System.rvdata")
$data_areas = load_data("Data/Areas.rvdata")
end
#--------------------------------------------------------------------------
# ● 载入战斗测试数据库
#--------------------------------------------------------------------------
def load_bt_database
$data_actors = load_data("Data/BT_Actors.rvdata")
$data_classes = load_data("Data/BT_Classes.rvdata")
$data_skills = load_data("Data/BT_Skills.rvdata")
$data_items = load_data("Data/BT_Items.rvdata")
$data_weapons = load_data("Data/BT_Weapons.rvdata")
$data_armors = load_data("Data/BT_Armors.rvdata")
$data_enemies = load_data("Data/BT_Enemies.rvdata")
$data_troops = load_data("Data/BT_Troops.rvdata")
$data_states = load_data("Data/BT_States.rvdata")
$data_animations = load_data("Data/BT_Animations.rvdata")
$data_common_events = load_data("Data/BT_CommonEvents.rvdata")
$data_system = load_data("Data/BT_System.rvdata")
end
#--------------------------------------------------------------------------
# ● 生成各种游戏对象
#--------------------------------------------------------------------------
def create_game_objects
$game_temp = Game_Temp.new
$game_message = Game_Message.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
end
#--------------------------------------------------------------------------
# ● 判断继续的有效性
#--------------------------------------------------------------------------
def check_continue
@continue_enabled = (Dir.glob('Save/Save*.sve').size > 0)
end
#--------------------------------------------------------------------------
# ● 生成标题图形
#--------------------------------------------------------------------------
def create_title_graphic
@sprite = Sprite.new
@sprite.bitmap = Cache.system("Title")
end
#--------------------------------------------------------------------------
# ● 释放标题图形
#--------------------------------------------------------------------------
def dispose_title_graphic
@sprite.bitmap.dispose
@sprite.dispose
end
#--------------------------------------------------------------------------
# ● 生成命令窗口
#--------------------------------------------------------------------------
def create_command_window
s1 = Vocab::new_game
s2 = Vocab::continue
s3 = Vocab::shutdown
s4 = "作者简介"
@command_window = Window_Command.new(172, [s1, s2, s3, s4])
@command_window.x = (544 - @command_window.width) / 2
@command_window.y = 288
if @continue_enabled # 如果「继续」有效
@command_window.index = 1 # 将光标移至「继续游戏」
else # 否则则将「继续游戏」半透明化
@command_window.draw_item(1, false)
end
@command_window.openness = 0
@command_window.open
end
#--------------------------------------------------------------------------
# ● 释放命令窗口
#--------------------------------------------------------------------------
def dispose_command_window
@command_window.dispose
end
#--------------------------------------------------------------------------
# ● 开启命令窗口
#--------------------------------------------------------------------------
def open_command_window
@command_window.open
begin
@command_window.update
Graphics.update
end until @command_window.openness == 255
end
#--------------------------------------------------------------------------
# ● 关闭命令窗口
#--------------------------------------------------------------------------
def close_command_window
@command_window.close
begin
@command_window.update
Graphics.update
end until @command_window.openness == 0
end
#--------------------------------------------------------------------------
# ● 播放标题音乐
#--------------------------------------------------------------------------
def play_title_music
$data_system.title_bgm.play
RPG::BGS.stop
RPG::ME.stop
end
#--------------------------------------------------------------------------
# ● 检查主角初期位置是否存在
#--------------------------------------------------------------------------
def confirm_player_location
if $data_system.start_map_id == 0
print "主角初始位置未设定。"
exit
end
end
#--------------------------------------------------------------------------
# ● 命令:新游戏
#--------------------------------------------------------------------------
def command_new_game
confirm_player_location
Sound.play_decision
$game_party.setup_starting_members # 起始队伍
$game_map.setup($data_system.start_map_id) # 起始位置
$game_player.moveto($data_system.start_x, $data_system.start_y)
$game_player.refresh
$scene = Scene_Map.new
RPG::BGM.fade(1500)
close_command_window
Graphics.fadeout(60)
Graphics.wait(40)
Graphics.frame_count = 0
RPG::BGM.stop
$game_map.autoplay
end
#--------------------------------------------------------------------------
# ● 命令:继续游戏
#--------------------------------------------------------------------------
def command_continue
if @continue_enabled
Sound.play_decision
$scene = Scene_File.new(false, true, false)
else
Sound.play_buzzer
end
end
#--------------------------------------------------------------------------
# ● 命令:离开游戏
#--------------------------------------------------------------------------
def command_shutdown
Sound.play_decision
RPG::BGM.fade(800)
RPG::BGS.fade(800)
RPG::ME.fade(800)
$scene = nil
end
#--------------------------------------------------------------------------
# ● 生成实变量 @a @b
#--------------------------------------------------------------------------
attr_accessor :a
attr_accessor :b
#--------------------------------------------------------------------------
# ● 初始化实变量 @a @b
#--------------------------------------------------------------------------
def initialize(a = 0, b = 0)
@a = a
@b = b
end
#--------------------------------------------------------------------------
# ● 生成图片方法
#--------------------------------------------------------------------------
def creat_a
case @a
when 0
@b = Sprite.new
@b.bitmap = Bitmap.new("Graphics/Pictures/作者简介1")
@a += 1
when 1
@b = Sprite.new
@b.bitmap = Bitmap.new("Graphics/Pictures/作者简介2")
@a += 1
when 2
@b = Sprite.new
@b.bitmap = Bitmap.new("Graphics/Pictures/作者简介3")
@a += 1
when 3
@b = Sprite.new
@b.bitmap = Bitmap.new("Graphics/Pictures/作者简介4")
@a += 1
end
end
#------------------------------------------------------------------
# ● 命令:显示图片
#--------------------------------------------------------------------------
def command_picture
Sound.play_decision
close_command_window
Graphics.fadeout(60)
@a %= 4
creat_a
Graphics.fadein(30)
loop do
Graphics.update
Input.update
if Input.trigger?(Input::LEFT)
Sound.play_cursor
b.dispose
@a += 2
@a %= 4
creat_a
end
if Input.trigger?(Input::RIGHT)
Sound.play_cursor
b.dispose
@a += 4
@a %= 4
creat_a
end
break if Input.trigger?(Input::B)
end
Sound.play_cancel
Graphics.fadeout(60)
@b.dispose
Graphics.fadein(30)
open_command_window
end
#--------------------------------------------------------------------------
# ● 战斗测试
#--------------------------------------------------------------------------
def battle_test
load_bt_database # 载入战斗测试数据库
create_game_objects # 生成个各种游戏对象
Graphics.frame_count = 0 # 初始化游戏时间
$game_party.setup_battle_test_members
$game_troop.setup($data_system.test_troop_id)
$game_troop.can_escape = true
$game_system.battle_bgm.play
snapshot_for_background
$scene = Scene_Battle.new
end
end
复制代码
帮帮我这只白色的鸟![line]1[/line]
请在标题处写明自己的问题。
凌辰留
作者:
plqws
时间:
2009-9-5 14:23
经过研究,可能是S..._File的问题,所以我把它也发上来!
#==============================================================================
# ■ Scene_File
#------------------------------------------------------------------------------
# 存档画面及读档画面的类。
#==============================================================================
class Scene_File < Scene_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# saving : 存档标志(false则为读档)
# from_title : 标志:是由标题画面的「继续游戏」调用的
# from_event : 标志:是由事件「呼叫存档画面」命令调用的
#--------------------------------------------------------------------------
def initialize(saving, from_title, from_event)
@saving = saving
@from_title = from_title
@from_event = from_event
end
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
create_menu_background
@help_window = Window_Help.new
create_savefile_windows
if @saving
@index = $game_temp.last_file_index
@help_window.set_text(Vocab::SaveMessage)
else
@index = self.latest_file_index
@help_window.set_text(Vocab::LoadMessage)
end
@savefile_windows[@index].selected = true
end
#--------------------------------------------------------------------------
# ● 结束处理
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@help_window.dispose
dispose_item_windows
end
#--------------------------------------------------------------------------
# ● 回到原画面
#--------------------------------------------------------------------------
def return_scene
if @from_title
$scene = Scene_Title.new
elsif @from_event
$scene = Scene_Map.new
else
$scene = Scene_Menu.new(4)
end
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
update_menu_background
@help_window.update
update_savefile_windows
update_savefile_selection
end
#--------------------------------------------------------------------------
# ● 生成存档窗口
#--------------------------------------------------------------------------
def create_savefile_windows
@savefile_windows = []
for i in 0..3
@savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
end
@item_max = 4
end
#--------------------------------------------------------------------------
# ● 释放存档窗口
#--------------------------------------------------------------------------
def dispose_item_windows
for window in @savefile_windows
window.dispose
end
end
#--------------------------------------------------------------------------
# ● 更新存档窗口
#--------------------------------------------------------------------------
def update_savefile_windows
for window in @savefile_windows
window.update
end
end
#--------------------------------------------------------------------------
# ● 更新存档文件选择
#--------------------------------------------------------------------------
def update_savefile_selection
if Input.trigger?(Input::C)
determine_savefile
elsif Input.trigger?(Input::B)
Sound.play_cancel
return_scene
else
last_index = @index
if Input.repeat?(Input::DOWN)
cursor_down(Input.trigger?(Input::DOWN))
end
if Input.repeat?(Input::UP)
cursor_up(Input.trigger?(Input::UP))
end
if @index != last_index
Sound.play_cursor
@savefile_windows[last_index].selected = false
@savefile_windows[@index].selected = true
end
end
end
#--------------------------------------------------------------------------
# ● 确认存档文件
#--------------------------------------------------------------------------
def determine_savefile
if @saving
Sound.play_save
do_save
else
if @savefile_windows[@index].file_exist
Sound.play_load
do_load
else
Sound.play_buzzer
return
end
end
$game_temp.last_file_index = @index
end
#--------------------------------------------------------------------------
# ● 光标下移
# wrap : 允许循环
#--------------------------------------------------------------------------
def cursor_down(wrap)
if @index < @item_max - 1 or wrap
@index = (@index + 1) % @item_max
end
end
#--------------------------------------------------------------------------
# ● 光标上移
# wrap : 允许循环
#--------------------------------------------------------------------------
def cursor_up(wrap)
if @index > 0 or wrap
@index = (@index - 1 + @item_max) % @item_max
end
end
#--------------------------------------------------------------------------
# ● 生成文件名称
# file_index : 存档位置(0~3)
#--------------------------------------------------------------------------
def make_filename(file_index)
return "Save/Save#{file_index + 1}.sve"
if Dir.glob('Save').size == 0
Dir.mkdir('./Save')
end
end
#--------------------------------------------------------------------------
# ● 选择最近存档的文件
#--------------------------------------------------------------------------
def latest_file_index
index = 0
latest_time = Time.at(0)
for i in 0...@savefile_windows.size
if @savefile_windows[i].time_stamp > latest_time
latest_time = @savefile_windows[i].time_stamp
index = i
end
end
return index
end
#--------------------------------------------------------------------------
# ● 执行存档
#--------------------------------------------------------------------------
def do_save
file = File.open(@savefile_windows[@index].filename, "wb")
write_save_data(file)
file.close
return_scene
end
#--------------------------------------------------------------------------
# ● 执行读档
#--------------------------------------------------------------------------
def do_load
file = File.open(@savefile_windows[@index].filename, "rb")
read_save_data(file)
file.close
$scene = Scene_Map.new
RPG::BGM.fade(1500)
Graphics.fadeout(60)
Graphics.wait(40)
@last_bgm.play
@last_bgs.play
end
#--------------------------------------------------------------------------
# ● 写入存档数据
# file : 写入存档对象(已开启)
#--------------------------------------------------------------------------
def write_save_data(file)
characters = []
for actor in $game_party.members
characters.push([actor.character_name, actor.character_index])
end
$game_system.save_count += 1
$game_system.version_id = $data_system.version_id
@last_bgm = RPG::BGM::last
@last_bgs = RPG::BGS::last
Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)
Marshal.dump(@last_bgm, file)
Marshal.dump(@last_bgs, file)
Marshal.dump($game_system, file)
Marshal.dump($game_message, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
end
#--------------------------------------------------------------------------
# ● 读出存档数据
# file : 读出存档对象(已开启)
#--------------------------------------------------------------------------
def read_save_data(file)
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
@last_bgm = Marshal.load(file)
@last_bgs = Marshal.load(file)
$game_system = Marshal.load(file)
$game_message = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
if $game_system.version_id != $data_system.version_id
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
end
end
复制代码
作者:
八云紫
时间:
2009-9-5 14:54
看脚本没啥错的呀, 怎么会出现 参数个数 错误??
作者:
plqws
时间:
2009-9-5 15:05
我知道了,是沉影不器的新菜单和沉影不器的随机属性冲突,气死我了!
看来他的东西的BUG还挺多的!
作者:
new1984
时间:
2009-9-5 19:56
我知道了,是沉影不器的新菜单和沉影不器的随机属性冲突,气死我了!
看来他的东西的BUG还挺多的!
plqws 发表于 2009-9-5 15:05
脚本冲突不等于BUG吧。。。。。。
作者:
天堂之役
时间:
2009-9-5 20:58
= = 我擦 用别人的脚本 不用这么理直气壮的怪别人吧= = 脚本冲突是你自己的事 你怪人家沉影个球啊
LZ的话让我这外人都不爽
作者:
Eienshinken
时间:
2009-9-5 23:03
z找找相对的 scene的initialize后面的初始化参数看看咯.
这里是没有的, 你场景那里用了 3个哦..
作者:
plqws
时间:
2009-9-6 19:50
5#:我不是说他的这个脚本冲突,我是说他的脚本的东西不能放到商店里!
6#:素质,没理解就算了,!
作者:
小幽的马甲
时间:
2009-9-6 20:05
啊呜,LZ您真的理解脚本冲突是怎么回事么……
作者:
plqws
时间:
2009-9-6 21:17
……我的描述能力极差,理解能力也一样!
两回事,两回事,两回事,两回事!!谢谢!!!!
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1