Project1
标题:
脚本错误求解决
[打印本页]
作者:
1010746759
时间:
2013-10-27 16:38
标题:
脚本错误求解决
本帖最后由 铃仙·优昙华院·因幡 于 2013-10-27 18:07 编辑
#==============================================================================
# ■ Scene_Title
#------------------------------------------------------------------------------
# 处理标题画面的类。
#==============================================================================
class Scene_Title2 < Scene_Base
#--------------------------------------------------------------------------
# ● 住处理
#--------------------------------------------------------------------------
def main_start
super
_load_data_
Mess_Text.visible = true
# 生成系统对像
$game_system = Game_System.new
# 生成标题图形
[url=home.php?mod=space&uid=114926]@sprite[/url] = Sprite.new
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
# 生成命令窗口
s1 = " "
s2 = " "
s3 = " "
@command_window = Window_Command.new(170, [s1, s2, s3])
@command_window.opacity = 0
@command_window.x = 525 - @command_window.width / 2
@command_window.y = 270
@windows.push(@command_window)
@sprites.push(@sprite)
# 判定继续的有效性
# 存档文件一个也不存在的时候也调查
# 有効为 @continue_enabled 为 true、無効为 false
@continue_enabled = false
for i in 0..3
if FileTest.exist?("Save/Save#{i+1}.rxdata")
@continue_enabled = true
end
end
# 继续为有效的情况下、光标停止在继续上
# 无效的情况下、继续的文字显示为灰色
if @continue_enabled
@command_window.index = 1
else
@command_window.disable_item(1)
end
# 演奏标题 BGM
$game_system.bgm_play($data_system.title_bgm)
# 停止演奏 ME、BGS
Audio.me_stop
Audio.bgs_stop
super
end
def _load_data_
# 载入数据库
$data_actors = load_data("Data/Actors.rxdata")
$data_classes = load_data("Data/Classes.rxdata")
$data_skills = load_data("Data/Skills.rxdata")
$data_items = load_data("Data/Items.rxdata")
$data_weapons = load_data("Data/Weapons.rxdata")
$data_armors = load_data("Data/Armors.rxdata")
$data_enemies = load_data("Data/Enemies.rxdata")
$data_troops = load_data("Data/Troops.rxdata")
$data_states = load_data("Data/States.rxdata")
$data_animations = load_data("Data/Animations.rxdata")
$data_tilesets = load_data("Data/Tilesets.rxdata")
$data_common_events = load_data("Data/CommonEvents.rxdata")
$data_system = load_data("Data/System.rxdata")
$qianzui_weapons = load_data("Data/Weapons1.rxdata")
$qianzui_armors = load_data("Data/Armors1.rxdata")
$data_skills.each{|skill|
next if skill.nil?
skill.exp = 0
skill.level = 0
}
$data_weapons.each{|weapon|
next if weapon.nil? or weapon.name == ""
weapon.rang = weapon.name.split(/,/)[1].nil? ? 0 : weapon.name.split(/,/)[1].to_i
weapon.time = weapon.name.split(/,/)[2].nil? ? 20 : weapon.name.split(/,/)[2].to_i
weapon.name = weapon.name.split(/,/)[0]
}
$qianzui_weapons.each{|weapon|
next if weapon.nil? or weapon.name == ""
weapon.rang = weapon.name.split(/,/)[1].nil? ? 0 : weapon.name.split(/,/)[1].to_i
weapon.time = weapon.name.split(/,/)[2].nil? ? 0 : weapon.name.split(/,/)[2].to_i
weapon.name = weapon.name.split(/,/)[0]
}
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 命令窗口的光标位置的分支
case @command_window.index
when 0 # 新游戏
command_new_game
when 1 # 继续
command_continue
when 2 # 退出
command_shutdown
end
end
end
#--------------------------------------------------------------------------
# ● 命令 : 新游戏
#--------------------------------------------------------------------------
def command_new_game
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 停止 BGM
Audio.bgm_stop
# 重置测量游戏时间用的画面计数器
Graphics.frame_count = 0
# 生成各种游戏对像
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_skills = Game_Skills.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
# 设置初期同伴位置
$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
# 执行地图设置的 BGM 与 BGS 的自动切换
$game_map.autoplay
# 刷新地图 (执行并行事件)
$game_map.update
# 切换地图画面
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# ● 命令 : 继续
#--------------------------------------------------------------------------
def command_continue
# 继续无效的情况下
unless @continue_enabled
# 演奏无效 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到读档画面
$scene = Scene_Load.new
end
#--------------------------------------------------------------------------
# ● 命令 : 退出
#--------------------------------------------------------------------------
def command_shutdown
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# BGM、BGS、ME 的淡入淡出
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
# 退出
$scene = nil
end
end
复制代码
就是这个脚本,第六行出错,求解决。
作者:
铃仙·优昙华院·因幡
时间:
2013-10-27 17:43
无图无真相. 就这样一个脚本, 谁都不知道有什么错.
一个脚本本身没有错误, 如果脚本冲突的话, 也许就有错了. 所以.....
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1