Project1
标题:
在菜单中添加了新项目,打开后再返回菜单的脚本应该怎么
[打印本页]
作者:
shinliwei
时间:
2010-12-10 14:01
标题:
在菜单中添加了新项目,打开后再返回菜单的脚本应该怎么
本帖最后由 shinliwei 于 2010-12-10 20:56 编辑
QQ截图未命名.jpg
(23.36 KB, 下载次数: 18)
下载附件
保存到相册
2010-12-10 13:55 上传
如图,我用了wangswz前辈的天赋技能树脚本,并且我把这项添加到菜单里了。
点击后选人物进入天赋界面,但是按范围时不回到菜单界面了,我看了下其他项目(如状态、装备)的脚本项,并按照样式进行修改,可是还是不返回菜单界面,因此特来请教诸位。
#==============================================================================
# ■ Scene_Skill_Tree
#------------------------------------------------------------------------------
# 天赋技能类
#==============================================================================
class Scene_Skill_Tree < Scene_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# index : 天赋树
#--------------------------------------------------------------------------
def initialize(actor_index = 0)
@actor = actor_index
end
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
create_menu_background
start_command
@skill_tree_window = Window_Skill_Tree.new(272, 0, 272, 328, $game_party.members[@actor])
@skill_tree_window.active = false
@skill_tree_window.visible = false
@skill_tree_window.index = 2 #??
@base_window = Window_Base.new(272, 0, 272, 328)
@skill_status_window = Window_skill_status.new
@skill_status_window.visible = false
@base_window2 = Window_Base.new(0, 328, 544, 88)
@skill_actor_window = Window_actor_Tree.new($game_party.members[@actor])
@skill_actor_window.active = true
@skill_data = Window_skill_data.new($game_party.members[@actor].id)
end
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start_command
s1 = FSL::ST::St_detailed[FSL::ST::St_class_id[$game_party.members[@actor].class_id][0]][1]
s2 = FSL::ST::St_detailed[FSL::ST::St_class_id[$game_party.members[@actor].class_id][1]][1]
s3 = FSL::ST::St_detailed[FSL::ST::St_class_id[$game_party.members[@actor].class_id][2]][1]
@command_window = Window_Command.new(272, [s1, s2, s3], 3)
@command_window.y = 88
@command_window.active = true
end
#--------------------------------------------------------------------------
# ● 结束处理
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@skill_tree_window.dispose
@base_window.dispose
@base_window2.dispose
@skill_data.dispose
@skill_status_window.dispose
@skill_actor_window.dispose
@command_window.dispose
end
#--------------------------------------------------------------------------
# ● 回到原画面
#--------------------------------------------------------------------------
def return_scene
$scene = Scene_Menu.new(4)
end
#--------------------------------------------------------------------------
# ● 切换至下一角色画面
#--------------------------------------------------------------------------
def next_actor
@actor_index += 1
@actor_index %= $game_party.members.size
$scene = Scene_Skill_Tree.new(@actor_index)
end
#--------------------------------------------------------------------------
# ● 切换至上一角色画面
#--------------------------------------------------------------------------
def prev_actor
@actor_index += $game_party.members.size - 1
@actor_index %= $game_party.members.size
$scene = Scene_Skill_Tree.new(@actor_index)
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
@skill_tree_window.update
@skill_actor_window.update
@skill_status_window.update
@base_window.update
@base_window2.update
@skill_data.update
@command_window.update
if @skill_actor_window.active
if @skill_tree_window.visible == false
if Input.trigger?(Input::R)
Sound.play_cursor
@actor += 1
@actor %= $game_party.members.size
$scene = Scene_Skill_Tree.new(@actor)
@skill_tree_window.ST_actor_data($game_party.members[@actor].id)
elsif Input.trigger?(Input::L)
Sound.play_cursor
@actor += $game_party.members.size - 1
@actor %= $game_party.members.size
$scene = Scene_Skill_Tree.new(@actor)
@skill_tree_window.ST_actor_data($game_party.members[@actor].id)
end
end
end
if @command_window.active
update_command_selection
elsif @skill_tree_window.active
update_skill_tree_selection
end
end
#--------------------------------------------------------------------------
# ● 更新命令窗口
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
case @command_window.index
when 0 # 第一天赋
Sound.play_decision
@command_window.active = false
@base_window.visible = false
@base_window2.visible = false
@skill_actor_window.active = false
@skill_tree_window.active = true
@skill_tree_window.visible = true
@skill_tree_window.index = FSL::ST::St_class_id[$game_party.members[@actor].class_id][0]
@skill_tree_window.ST_actor_data($game_party.members[@actor].id)
@skill_status_window.visible = true
@skill_status_window.skill = @skill_tree_window.STK
when 1 # 第二天赋
Sound.play_decision
@command_window.active = false
@base_window.visible = false
@base_window2.visible = false
@skill_actor_window.active = false
@skill_tree_window.active = true
@skill_tree_window.visible = true
@skill_tree_window.index = FSL::ST::St_class_id[$game_party.members[@actor].class_id][1]
@skill_tree_window.ST_actor_data($game_party.members[@actor].id)
@skill_status_window.visible = true
@skill_status_window.skill = @skill_tree_window.STK
when 2 # 第三天赋
Sound.play_decision
@command_window.active = false
@base_window.visible = false
@base_window2.visible = false
@skill_actor_window.active = false
@skill_tree_window.active = true
@skill_tree_window.visible = true
@skill_tree_window.index = FSL::ST::St_class_id[$game_party.members[@actor].class_id][2]
@skill_tree_window.ST_actor_data($game_party.members[@actor].id)
@skill_status_window.visible = true
@skill_status_window.skill = @skill_tree_window.STK
end
end
end
#--------------------------------------------------------------------------
# ● 更新天赋窗口
#--------------------------------------------------------------------------
def update_skill_tree_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@command_window.active = true
@base_window.visible = true
@base_window2.visible = true
@skill_actor_window.active = true
@skill_tree_window.active = false
@skill_tree_window.visible = false
@skill_status_window.visible = false
@skill_tree_window.ST_actor_data2
end
if Input.trigger?(Input::LEFT) || Input.trigger?(Input::RIGHT) || Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN) || Input.trigger?(Input::X)
@skill_status_window.skill = @skill_tree_window.STK
@skill_tree_window.ST_actor_data3
@skill_data.refresh
end
end
end
复制代码
作者:
Rion幻音
时间:
2010-12-10 14:48
本帖最后由 Rion幻音 于 2010-12-10 14:49 编辑
63行的
$scene = Scene_Menu.new(X)
复制代码
X可自行设定……
作者:
shinliwei
时间:
2010-12-10 15:16
回复
Rion幻音
的帖子
我设的是4啊,0—道具、1—技能、2—装备、3—状态、4—天赋。
作者:
fux2
时间:
2010-12-10 16:34
没有定义按B的方法,会继承父类的方法,在update_command_selection追加按下B的事件
作者:
shinliwei
时间:
2010-12-10 18:43
回复
fux2
的帖子
感谢您的指正!~~
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1