Project1
标题:
改选择项的问题
[打印本页]
作者:
木葬枫
时间:
2008-9-22 06:03
标题:
改选择项的问题
#==============================================================================
# ■ 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)
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 # Boss Rush
command_new_game
$game_switches[1] = true
when 3 # 小游戏
command_new_game
$game_switches[2] = true
when 4 # Shutdown
command_shutdown
end
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*.rvdata').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 = "Boss Rush"
s4 = "小游戏"
s5 = Vocab::shutdown
@command_window = Window_Command.new(172, [s1, s2, s3, s4, s5])
@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
#--------------------------------------------------------------------------
# ● 战斗测试
#--------------------------------------------------------------------------
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,#dddddd[/LINE]
就这样改,提示最后一行出错·····
问下,改这个会和其他什么常用的脚本冲突吗? [LINE]1,#dddddd[/LINE]
此贴于 2008-10-13 22:57:35 被版主八云紫提醒,请楼主看到后对本贴做出回应。
[LINE]1,#dddddd[/LINE]
版务信息:本贴由楼主自主结贴~
作者:
雪流星
时间:
2008-9-22 06:24
最後一行出错
大部分都是因为少了(或多了)end
检查一下
作者:
fuckme
时间:
2008-9-22 06:24
#==============================================================================
# ■ 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)
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 # Boss Rush
command_new_game
$game_switches[1] = true
when 3 # 小游戏
command_new_game
$game_switches[2] = true
when 4 # Shutdown
command_shutdown
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*.rvdata').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 = "Boss Rush"
s4 = "小游戏"
s5 = Vocab::shutdown
@command_window = Window_Command.new(172, [s1, s2, s3, s4, s5])
@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
#--------------------------------------------------------------------------
# ● 战斗测试
#--------------------------------------------------------------------------
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
复制代码
改成这个好了,你多加了格END。
一般不会有冲突
作者:
雪流星
时间:
2008-9-22 06:31
LS的ID不雅
已进行拆楼处理
作者:
八云紫
时间:
2008-9-22 06:42
#--------------------------------------------------------------------------
# ● 载入数据库
#--------------------------------------------------------------------------
这个之前多了一个 end
另外, 脚本请使用脚本框,这样看很麻烦的。 [LINE]1,#dddddd[/LINE]
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
作者:
木葬枫
时间:
2008-9-22 07:07
已经好了……可以显示了……但是把它复制到别的工程时就好像什么改动都没有(原来是在新建的默认工程里改的)……还是显示那普通的三项………
请问为什么?脚本冲突?
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1