赞 | 13 |
VIP | 118 |
好人卡 | 28 |
积分 | 12 |
经验 | 35779 |
最后登录 | 2017-7-6 |
在线时间 | 1564 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 1185
- 在线时间
- 1564 小时
- 注册时间
- 2008-7-30
- 帖子
- 4418
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 DeathKing 于 2011-7-7 16:01 编辑
绪言
这个就是我早些时候在水区公布的东西了,考虑到配置的复杂性,推荐有一定的脚本知识的用户使用。
就我个人来说,我觉得这个脚本除了配置复杂一点,其他部分堪称完美,而且作者当初编写的时候,把Configuration都放在一个模块了,包括语言支持什么的,我觉得挺不错的。
另外,本脚本原作者Leongon([email protected] ),发布在 http://www.rpgrevolution.com/forums/index.php?showtopic=43001 。按照原作者的意愿,您在传播此脚本的时候,在遵循FSL协议的基础上,还需要保留这个链接:www.rpgrevolution.com
ToDo
- 试图寻找一种新的、简便的配置方法;
- 做个针对中文游戏的美化;
下载
相关工程:
[1.1]LeongonSkillTree.rar
(530.49 KB, 下载次数: 2259)
相关文档:稍后
相关实现:wangswz也写过类似脚本,看这里:http://rpg.blue/thread-156223-1-1.html
在Fibrary中浏览: http://rpg.blue/fsl/rgss2/LeongonSkillTree/index.html
截图
这个是作者范例工程中提供的两个配置。
这个是我的配置,用了塞娜尔史诗(天坑 = =b)中的技能图标。做得很简陋。
脚本- #===============================================================================
- # ■ [VX]技能树脚本
- # [VX]LeongonSkillTree
- #-------------------------------------------------------------------------------
- # 本脚本原作者Leongon([email protected] ),发布在引用网址[1]中。
- # 本脚本中文翻译者为DeathKing([email protected]),并提供相关支持。
- #
- # 按照原作者的意愿,您在传播此脚本的时候,在遵循FSL协议的基础上,还需要保留
- # 这个链接:www.rpgrevolution.com
- #
- #
- # * 命令列表
- # - ST_command::show(mode, actor, exit)..............直接打开技能树界面;
- # - ST_command::reward(mode, actor, quantity)..........给予角色技能点数;
- # - ST_command::reward_party(quantity).................给予队伍技能点数;
- # - ST_command::reset(mode, actor).......................重置角色技能树;
- # - ST_command::reset_party..............................重置队伍技能树;
- #
- # * 参数列表
- # 请注意与命令列表中的命令相对应
- # - mode 0 / :position - 按照角色在队伍中的位置(序号)索引;
- # 1 / :name - 按照角色的名称索引;
- # 2 / :id - 按照角色数据库中id号;
- # - actor 角色的位置(序号),名字或数据库id;
- # 该值得意义由 mode 参数决定。
- # - exit true - 退出时返回到地图;
- # false[默认] - 退出时返回到菜单;
- # - quantity 指定给予的点数,忽略则给予1点;
- #
- # * 设置技能树的相关步骤
- # ① 在 ST_object 中配置 SkillObject
- # SkillObject 是技能对象,他描述了一个技能要求的前置技能以及技能
- # 相关属性的配置,你应该先配置他;
- #
- # ② 在 ST_object 中配置 ArrowObject
- # 【建议您在配置前查看一下Graphics\System\SkillTree.png的图像内容】
- # 【这将有助于您理解相关的设置。 】
- # ArrowObject 是箭头对象,他描述了使用的相关箭头。你可以认为他是
- # 一些图片,配置这些,是为了后面的技能树布局;
- #
- # ③ 在 ST_tree_build 中配置技能树布局
- # ST_tree_build 中的数据描述了技能树的布局,请注意,这些布局是手
- # 动的、人为的生成的,所以配置起来有些麻烦;
- #
- # ④ 在 ST_class_assign 中配置职业分配
- # ST_class_assign 中的数据决定了哪些职业拥有什么样的技能树,请注
- # 意,每个职业最多支持3个技能树;
- #
- # * 注意事项
- # ① 请检查数据库中对应技能有对应的设置;
- # ② 如果启用了 ST_imageback ,还需要确认存在对应图像文件;
- # ③ 请注意语法格式,不要删除或缺少必要的符号(通常导致 SyntaxError);
- #
- #-------------------------------------------------------------------------------
- # 更新作者: Leongon DeathKing
- # 许可协议: FSL
- # 引用网址: http://www.rpgrevolution.com/forums/index.php?showtopic=43001
- # http://rpg.blue/fsl/rgss2/LeogonSKillTree/index.html
- #-------------------------------------------------------------------------------
- # - 1.1.0707 By DeathKing
- # * 对 mode 添加了符号支持;
- #
- # - 1.0.0519 By Leongon
- # * 初版;
- #
- #===============================================================================
- $fscript = {} if $fscript == nil
- $fscript["LeongonSkillTree"] = "1.1.0707"
- #-------------------------------------------------------------------------------
- # ▼ 通用配置模块
- #-------------------------------------------------------------------------------
- module FSL
- module LeongonSkillTree
-
- # 当从技能树退出时停留的菜单选项的索引
- ST_menu_pos = 2
- # 英雄等级要求是否随技能升级而提高
- # 例如,1级的火焰需要英雄2级,而当这个值为true时,
- # 2级的火焰就需要英雄3级。
- ST_scale_mode = true
- # 每次等级提升时是否增加技能点
- ST_level_up_point = true
- # 给予技能点的最低等级
- ST_first_skill_point = 2
- # 加点是否需要确认
- ST_confirm_popup = true
- # 确认加点文字
- ST_voc_q = "确认加点"
- # 确认文字
- ST_voc_ok = "确定"
- # 取消文字
- ST_voc_cancel = "取消"
- # 如果角色没有技能树,是否显示警告
- ST_notalents_popup = true
- # 警告中是否包含角色的名字
- ST_notalents_popAN = true
- # 警告的前置文字
- ST_voc_noSTpop_pre = "错误!"
- # 警告文字
- ST_voc_noSTpop_pos = "没有有效的技能树。"
- # 继续文字
- ST_voc_noSTpop = "确认"
-
- # 菜单选项中天赋树的名字
- ST_menu = "天赋"
- # Skill maxed.
- ST_voc_max = "Maxed"
- # 未习得技能文字
- ST_voc_unl = "未习得"
- # 当前阶段技能描述文字
- ST_voc_now = "当前阶段:"
- # 下一阶段技能描述文字
- ST_voc_nex = "下一阶段:"
- # 当前可用技能点数
- ST_voc_cur = "技能点数:"
- # 前置技能文字
- ST_voc_req = "前置技能:"
- # 英雄等级文字
- ST_voc_lvl = "英雄等级:"
- # 等级需求量词(单数)
- ST_voc_one = " 级 "
- # 等级许留量词(复数)
- ST_voc_many = " 级 "
-
- # (0-31) 当可用技能点数为0时的颜色
- ST_zero_sp_color = 10
- # (0-31) 被选中的技能的颜色
- ST_skillname_color = 14
- # (0-255) 无效的箭头对象的透明度
- ST_arrow_disabled = 118
- # (0-255) 无效的技能对象的透明度
- ST_skill_disabled = 138
- # (true-false) 在图标下方显示技能等级
- ST_show_obj_lvl = true
- # (0-360) 箭头对象的色相,可以用于调整箭头对象的颜色
- ST_arrow_hue = 155
- # (0-255) 技能图像背景的透明度
- # 当这个选项被置为 false 的时候,停用显示自定义技能背景图像的功能
- # 图像必须是 206x348 规格,且放在 Graphics/System 目录下
- # 且按照技能树对象的名称命名(参考下方的 "TREE_NAME" 设置)
- # 例如,ARMS技能树的图像名必须是 ARMS.png
- ST_imageback = 240
- # (ID) 决定界面布局的游戏变量
- # 可以尝试修改对应的游戏变量的值来查看布局。
- ST_windows_var = 6
- # (0-2) 技能树名称选定光标
- # 0 :闪烁光标
- # 1 :固定光标(不闪烁)
- # 2 :仅仅高亮技能树名称,无光标
- ST_tree_selection = 0
- # (0-31) 技能树名称高亮的颜色
- ST_treeselection_color = 14
- ST_arrow = [ # 不要删去此处的中括号,否则程序会出错!
- #---------------------------------------------------------------------------
- # * 箭头图像列表 *
- #
- # 你不需要更改这个,除非你更改了 SkillTree.png 中箭头图像的顺序
- #---------------------------------------------------------------------------
- # "GraphicName",
- "A_l_st", # 左向箭头,起始
- "A_r_st", # 右向箭头,起始
- "A_ver_st", # 垂直箭头,起始
- "A_ver", # 垂直箭头,中部
- "A_hor", # 水平箭头
- "A_ver_end", # 垂直箭头,终止
- "A_l_end", # 左向箭头,终止
- "A_r_end", # 右向箭头,终止
- "A_ver_w_diag_r", # 垂直,右分支
- "A_ver_w_diag_l", # 垂直,左分支
- "A_diag_r_st", # 右下对角线,起始
- "A_diag_r_abo_cor", # 右下对角线,下方填充小块
- "A_diag_r_bel_cor", # 右下对角线,上方填充小块
- "A_diag_r", # 右下对角线,中部
- "A_diag_r_end", # 右下对角线,终止
- "A_diag_l_st", # 左下对角线,起始
- "A_diag_l_abo_cor", # 左下对角线,下方填充小块
- "A_diag_l_bel_cor", # 左下对角线,上方填充小块
- "A_diag_l", # 左下对角线,中部
- "A_diag_l_end", # 左下对角线,终止
- ] # 不要删去此处的中括号,否则程序会出错!
- ST_object = { # 不要删去此处的大括号,否则程序会出错!
- #------------------------------------------------------------------------------#
- # * 建立箭头对象列表 * #
- # #
- # 不幸的是,你需要手动建立这些箭头对象。 #
- #------------------------------------------------------------------------------#
- # #
- # "ArrowObject" - 箭头对象的名称; #
- # "arrow_object" - 标识符,固定使用 arrow_object ; #
- # "arrow" - 箭头的图像名; #
- # "dadskill" - 父节点名称,参考技能对象列表中的 SkillObject 项; #
- #------------------------------------------------------------------------------#
- # "ArrowObject" => ["arrow_object", "arrow", "dadskill"],
- "MF_1_1" => ["arrow_object", "A_ver_st", "MF_1"],
- "MF_1_2" => ["arrow_object", "A_ver_end", "MF_1"],
- "MF_2_1" => ["arrow_object", "A_diag_l_st", "MF_2"],
- "MF_2_2" => ["arrow_object", "A_diag_l_end", "MF_2"],
- "MF_2_3" => ["arrow_object", "A_diag_l_abo_cor", "MF_2"],
- "MF_2_4" => ["arrow_object", "A_diag_l_bel_cor", "MF_2"],
- "MF_4_1" => ["arrow_object", "A_ver_st", "MF_4"],
- "MF_4_2" => ["arrow_object", "A_ver_end", "MF_4"],
- "WA_1_1" => ["arrow_object", "A_ver_st", "WA_1"],
- "WA_1_2" => ["arrow_object", "A_ver_end", "WA_1"],
-
- "BOM_2_1" => ["arrow_object", "A_ver_st" ,"BOM_2"],
- "BOM_2_2" => ["arrow_object", "A_ver_end", "BOM_2"],
- "BOM_3_1" => ["arrow_object", "A_ver_st", "BOM_3"],
- "BOM_3_2" => ["arrow_object", "A_ver_end", "BOM_3"],
- "BOM_2_a" => ["arrow_object", "A_diag_l_st", "BOM_2"],
- "BOM_2_b" => ["arrow_object", "A_diag_l_bel_cor", "BOM_2"],
- "BOM_2_c" => ["arrow_object", "A_diag_l_abo_cor", "BOM_2"],
- "BOM_2_d" => ["arrow_object", "A_diag_l_end", "BOM_2"],
-
- # #
- #------------------------------------------------------------------------------#
- #------------------------------------------------------------------------------#
- # * 建立技能对象列表 * #
- # #
- # 很不幸的是,你需要手动建立这些对象。 #
- #------------------------------------------------------------------------------#
- # #
- # "SkillObject" - 技能对象的名称; #
- # reqlvl - 技能需要的英雄等级; #
- # treepts - 需要在此技能树中消耗多少技能点数才能开启本技能; #
- # "dad" - "mom" - 需要的前置技能(父前置技能和母前置技能); #
- # maxlvl - 技能最大等级; #
- # childreqlvl - 至少需要多少点技能点才能激活子技能; #
- # idlvl... - 每一个技能等级对应的技能id号; #
- # -----------------------------------------------------------------------------#
- # "SkillObject" => [reqlvl, treepts, "dad", "mom", maxlvl, childreqlvl, idlvl1, idlvl2,...],
- "MF_1" => [1, 0, nil, nil, 5, 1, 1, 2, 3, 4, 5],
- "MF_2" => [5, 0, nil, nil, 3, 1, 6, 7, 8],
- "MF_3" => [10, 0, "MF_1", "MF_2", 5, 0, 9, 10, 11, 12, 13],
- "MF_4" => [1, 0, nil, nil, 5, 5, 14, 15, 16, 17, 18],
- "MF_5" => [10, 0, "MF_4", nil, 5, 5, 19, 20, 21, 22, 23],
- "WA_1" => [1, 0, nil, nil, 3, 3, 24, 25, 26],
- "WA_2" => [1, 0, "WA_1", nil, 5, 0, 27, 28, 29, 30, 31],
-
- "BOM_1" => [1,0,nil,nil,3,1,51,52,53],
- "BOM_2" => [3,0,nil,nil,3,1,54,55,56],
- "BOM_3" => [8,3,"BOM_2",nil,4,2,57,58,59,60],
- "BOM_4" => [13,0,"BOM_3",nil,5,3,61,62,63,64,65],
- "BOM_5" => [10,0,"BOM_2",nil,5,5,66,67,68,69,70],
-
- } # 不要删去此处的大括号,否则程序会出错!
- ST_tree_build = { # 不要删去此处的大括号,否则程序会出错!
- #------------------------------------------------------------------------------#
- # * 技能树布局设定 * #
- # #
- # 很不辛,你要手动设定这些对象。 #
- # #
- # 每行有7个元素,第1、4、7个元素应该为技能对象或箭头对象,但第2、3、5、6必须为 #
- # 箭头对象或者nil。 #
- # #
- # 技能树的高度(列)没有被限定,但是一定要确保每行只有7个元素。 #
- #------------------------------------------------------------------------------#
- # #
- # "TREE_NAME" - 技能树对象的名称 #
- # "obj..." - 技能对象或者箭头对象的名称,如果为空请置为nil #
- # -----------------------------------------------------------------------------#
- # "TREE_NAME" => [ obj 1, obj 2, obj 3, obj 4, obj 5, obj 6, obj 7],
- "MAGE_FROST" => ["MF_1" , nil, nil, "MF_2", nil, nil, "MF_4",
- "MF_1_1","MF_2_3","MF_2_1", nil, nil, nil,"MF_4_1",
- "MF_1_2","MF_2_2","MF_2_4", nil, nil, nil,"MF_4_2",
- "MF_3" , nil, nil, nil, nil, nil, "MF_5"],
-
- "ARMS" => ["WA_1" , nil, nil, nil, nil, nil, nil,
- "WA_1_1", nil, nil, nil, nil, nil, nil,
- "WA_1_2", nil, nil, nil, nil, nil, nil,
- "WA_2" ],
-
- "BOM" => ["BOM_1", nil, nil, "BOM_2", nil, nil, nil,
- nil, "BOM_2_c", "BOM_2_a", "BOM_2_1", nil, nil, nil,
- nil, "BOM_2_d", "BOM_2_b", "BOM_2_2", nil, nil, nil,
- "BOM_5", nil, nil, "BOM_3", nil, nil, nil,
- nil, nil, nil, "BOM_3_1", nil, nil, nil,
- nil, nil, nil, "BOM_3_2", nil, nil, nil,
- nil, nil, nil, "BOM_4"],
-
- # 设置的时候请注意数组对象的方括号!
- # 设置的时候请注意哈希对象中的每个键-值使用逗号分隔!
- } # 不要删去此处的大括号,否则程序会出错!
- ST_class_assign = { # 不要删去此处的大括号,否则程序会出错!
- #------------------------------------------------------------------------------#
- # * 技能树职业分配 * #
- # #
- # 在这里为每个职业设置技能树,最大支持3个技能树;没有的话,请置对应位置为nil。 #
- #------------------------------------------------------------------------------#
- # #
- # ClassID - 拥有此技能树的职业id; #
- # "TREE..." - 技能树对象,参考上方的 "TREE_NAME" 设置; #
- # "Display..." - 技能树显示时使用的名称; #
- #------------------------------------------------------------------------------#
- # ClassID => ["TREE_1", "TREE_2", "TREE_3", "Display 1", "Display 2", "Display 3"],
- 1 => ["MAGE_FROST", "ARMS", nil, "寒冰之力", "战争意志", nil],
- 2 => ["BOM",nil,nil,"奥术基础",nil,nil],
-
- } # 不要删去此处的大括号,否则程序会出错!
- end
- end
- # 重命名命名空间
- ST_setup = FSL::LeongonSkillTree
- #==============================================================================
- # ■ Game_Actor
- #------------------------------------------------------------------------------
- # 处理角色的类。本类在 Game_Actors 类 ($game_actors) 的内部使用、
- # Game_Party 类请参考 ($game_party) 。
- #==============================================================================
- class Game_Actor < Game_Battler
- include ST_setup
- alias skill_tree_initialize initialize
- def initialize(actor_id)
- skill_tree_initialize(actor_id)
- @last_tree_id = 0
- @tree_skills = []
- @tree_points = [0,0,0]
- end
- alias skill_tree_setup setup
- def setup(actor_id)
- skill_tree_setup(actor_id)
- if ST_first_skill_point <= @level and ST_level_up_point
- @base_st_points = (@level - ST_first_skill_point) +1
- else
- @base_st_points = 0
- end
- @st_points = @base_st_points
- end
- def tree_points
- treepts = @tree_points[@last_tree_id]
- return treepts
- end
- def st_points
- return @st_points
- end
- def reset_skill_trees
- while !@tree_skills.empty?
- for skill in @tree_skills
- forget_tree_skill(skill)
- end
- end
- @st_points = @base_st_points
- @tree_points = [0,0,0]
- end
- def learn_tree_skill(skill_id)
- @tree_skills.push(skill_id)
- learn_skill(skill_id)
- @st_points -= 1
- @tree_points[@last_tree_id] += 1
- end
- def forget_tree_skill(skill_id)
- @tree_skills.delete(skill_id)
- forget_skill(skill_id)
- end
- alias skill_tree_level_up level_up
- def level_up
- skill_tree_level_up
- if ST_first_skill_point <= @level and ST_level_up_point
- @st_points += 1
- @base_st_points += 1
- end
- end
- alias skill_tree_level_down level_down
- def level_down
- skill_tree_level_down
- unless ST_first_skill_point < @level or ST_level_up_point == false
- @st_points -= 1
- @base_st_points -= 1
- end
- end
- def tree_skills
- return @tree_skills
- end
- def last_tree_id(t_id)
- @last_tree_id = t_id
- end
- def get_last_tree_id
- return @last_tree_id
- end
- def reward_st_points(amount)
- @st_points += amount
- @base_st_points += amount
- end
- end
- #==============================================================================
- # ■ Window_SkillTree_Main
- #==============================================================================
- class Window_SkillTree_Main < Window_Selectable
- include ST_setup
- def initialize(actor, tree)
- case $game_variables[ST_windows_var]
- when 2,3
- super(338, 68, 206, 348)
- when 4,5
- super(0, 0, 206, 348)
- when 6,7
- super(338, 0, 206, 348)
- else
- super(0, 68, 206, 348)
- end
- @spacing = 0
- @actor = actor
- @column_max = 7
- @class_tree_assign = ST_class_assign[@actor.class_id]
- @tree_name = @class_tree_assign[tree]
- for data in ST_tree_build[@tree_name]
- if data != nil and ST_object.include?(data)
- object = ST_object[data]
- unless object[0] == "arrow_object"
- self.index = ST_tree_build[@tree_name].index(data)
- break
- end
- end
- end
- $sk_lvl = 0
- $sk_max_lvl = 0
- if ST_imageback != false
- self.back_opacity = 0
- end
- refresh
- end
- def st_enabled?(index)
- req_lvl_data = @treedata_reqlvl[index]
- req_lvl_data += object_lvl(index) if ST_scale_mode
- if @actor.level >= req_lvl_data and
- @treedata_child_allow.include?(@treedata_reqskillobj_a[index]) and
- @treedata_child_allow.include?(@treedata_reqskillobj_b[index]) and
- @treedata_reqtreepts[index] <= @actor.tree_points
- return true
- else
- return false
- end
- end
- def at_enabled?(index)
- if @treedata_child_allow.include?(@treedata_reqskillobj_a[index])
- return true
- else
- return false
- end
- end
- def object_lvl(index)
- skill_allids = @treedata_alllvlids[index]
- for k in skill_allids
- if @actor.tree_skills.include?(k)
- lvl = skill_allids.index(k)
- return lvl +1
- end
- end
- return 0
- end
- def object_max_lvl(index)
- return @treedata_maxlvl[index]
- end
- def object_dad_req(indx)
- required_object = []
- if get_skill_next_level(indx) == "maxed"
- required_object = [0,0,0,0,0,0]
- return required_object
- end
- obj_name_a = @treedata_reqskillobj_a[indx]
- obj_name_b = @treedata_reqskillobj_b[indx]
- if obj_name_a == nil
- required_object.push(obj_name_a)
- required_object.push(obj_name_a)
- required_object.push(obj_name_b)
- required_object.push(obj_name_b)
- else
- obj_data_a = ST_object[obj_name_a]
- obj_id_a = obj_data_a[6]
- name_a = $data_skills[obj_id_a].name
- required_object.push(name_a)
- obj_lvl_req_a = obj_data_a[5]
- required_object.push(obj_lvl_req_a)
- if obj_name_b == nil
- required_object.push(obj_name_b)
- required_object.push(obj_name_b)
- else
- obj_data_b = ST_object[obj_name_b]
- obj_id_b = obj_data_b[6]
- name_b = $data_skills[obj_id_b].name
- required_object.push(name_b)
- obj_lvl_req_b = obj_data_b[5]
- required_object.push(obj_lvl_req_b)
- end
- end
- obj_actor_req_lvl = @treedata_reqlvl[indx]
- obj_actor_req_lvl += object_lvl(indx) if ST_scale_mode
- obj_actor_reqtreepts = @treedata_reqtreepts[indx]
- required_object.push(obj_actor_req_lvl)
- required_object.push(obj_actor_reqtreepts)
- return required_object
- end
- def get_skill_actual_level(data_index)
- skill_allids = @treedata_alllvlids[data_index]
- for k in skill_allids
- if @actor.tree_skills.include?(k)
- return k
- end
- end
- return "not learned"
- end
- def get_skill_next_level(data_index)
- skill_allids = @treedata_alllvlids[data_index]
- for k in skill_allids
- if @actor.tree_skills.include?(k)
- sk_index = skill_allids.index(k)
- sk_index += 1
- if skill_allids[sk_index] == nil
- return "maxed"
- end
- return skill_allids[sk_index]
- end
- end
- return skill_allids[0]
- end
- def get_skill_child_req(object_name, data_index)
- actual_lvl = nil
- alllvlids_data = []
- alllvlids_data = @treedata_alllvlids[data_index]
- for k in alllvlids_data
- if @actor.tree_skills.include?(k)
- actual_lvl = alllvlids_data.index(k)
- actual_lvl += 1
- end
- end
- actual_lvl = 0 if actual_lvl == nil
- skill_object_name = ST_object[object_name]
- return true if actual_lvl >= skill_object_name[5]
- return false
- end
- def build_tree_indexed_data
- @treedata_arrowindex = []
- @treedata_reqlvl = []
- @treedata_reqtreepts = []
- @treedata_reqskillobj_a = []
- @treedata_reqskillobj_b = []
- @treedata_maxlvl = []
- @treedata_child_allow = []
- @treedata_alllvlids = []
- countt = 0
- tree_build = ST_tree_build[@tree_name]
- for l in tree_build
- object_data = []
- object_data = ST_object[l]
- if l == nil
- @treedata_arrowindex.push(nil)
- @treedata_reqlvl.push(nil)
- @treedata_reqtreepts.push(nil)
- @treedata_reqskillobj_a.push(nil)
- @treedata_reqskillobj_b.push(nil)
- @treedata_maxlvl.push(nil)
- @treedata_child_allow.push(nil)
- @treedata_alllvlids.push(nil)
- elsif object_data[0] == "arrow_object"
- arrow_index = object_data[1]
- @treedata_arrowindex.push(ST_arrow.index(arrow_index))
- @treedata_reqlvl.push(nil)
- @treedata_reqtreepts.push(nil)
- @treedata_reqskillobj_a.push(object_data[2])
- @treedata_reqskillobj_b.push(nil)
- @treedata_maxlvl.push(nil)
- @treedata_child_allow.push(nil)
- @treedata_alllvlids.push(nil)
- else
- @treedata_arrowindex.push(nil)
- @treedata_reqlvl.push(object_data[0])
- @treedata_reqtreepts.push(object_data[1])
- @treedata_reqskillobj_a.push(object_data[2])
- @treedata_reqskillobj_b.push(object_data[3])
- @treedata_maxlvl.push(object_data[4])
- index_lvls_plus = 0
- index_lvls_plus = object_data[4]
- index_lvls_plus += 6
- all_lvl_ids = []
- for k in 6...index_lvls_plus
- all_lvl_ids.push(object_data[k])
- end
- @treedata_alllvlids.push(all_lvl_ids)
- @treedata_child_allow.push(l) if get_skill_child_req(l, countt)
- end
- countt += 1
- end
- end
- def refresh
- @data = []
- build_tree_indexed_data
- count = 0
- tree_build = ST_tree_build[@tree_name]
- for j in tree_build
- if j == nil
- data_skill = nil
- elsif @treedata_arrowindex[count] != nil
- data_skill = "arrow"
- elsif get_skill_next_level(count) == "maxed"
- data_skill = $data_skills[get_skill_actual_level(count)]
- else
- data_skill = $data_skills[get_skill_next_level(count)]
- end
- @data.push(data_skill)
- count += 1
- end
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- draw_item(i)
- end
- end
- def draw_item(index)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- object = @data[index]
- if object != nil and object != "arrow"
- rect.width -= 4
- enabled = st_enabled?(index)
- icon = object.icon_index
- draw_icon(icon, rect.x, rect.y, enabled)
- if ST_show_obj_lvl
- save_size_font = self.contents.font.size
- self.contents.font.size = 12
- self.contents.draw_text(rect.x+12, rect.y+13, 12, 12, object_lvl(index), 2)
- self.contents.font.size = save_size_font
- end
- elsif object != nil
- rect.width -= 4
- enabled = at_enabled?(index)
- arrow = @treedata_arrowindex[index]
- draw_arrow(arrow, rect.x, rect.y, enabled)
- end
- end
- def draw_icon(icon_index, x, y, enabled = true)
- bitmap = Cache.system("Iconset")
- rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
- self.contents.blt(x, y, bitmap, rect, enabled ? 255 : ST_skill_disabled)
- end
- def draw_arrow(index, x, y, enabled = true)
- bitmap = Cache.load_bitmap("Graphics/System/", "SkillTree", ST_arrow_hue)
- rect = Rect.new(index % 10 * 24, index / 10 * 24, 24, 24)
- self.contents.blt(x, y, bitmap, rect, enabled ? 255 : ST_arrow_disabled)
- end
- def skill
- return @data[self.index]
- end
- def update_help
- if skill == nil or skill == "arrow"
- text_a = ""
- elsif get_skill_actual_level(@index) == "not learned"
- text_a = ST_voc_unl
- else
- actual = $data_skills[get_skill_actual_level(@index)]
- text_a = ST_voc_now + actual.description
- cost_a = actual.mp_cost
- end
- if skill == nil or skill == "arrow"
- text_b = ""
- elsif $sk_lvl == $sk_max_lvl
- text_b = ST_voc_max
- else
- text_b = ST_voc_nex + skill.description
- cost_b = skill.mp_cost
- end
- @help_window.set_text(text_a, text_b, cost_a, cost_b)
- end
- def cursor_down(wrap = false)
- if (@index < @item_max - @column_max) or (wrap and @column_max == 1)
- @index = (@index + (@column_max*3)) % @item_max unless
- @data[(@index + (@column_max*3)) % @item_max] == nil or
- @data[(@index + (@column_max*3)) % @item_max] == "arrow"
- $sk_tree_data_refresh = true
- end
- end
- def cursor_up(wrap = false)
- if (@index >= @column_max) or (wrap and @column_max == 1)
- @index = (@index - (@column_max*3) + @item_max) % @item_max unless
- @data[(@index - (@column_max*3) + @item_max) % @item_max] == nil or
- @data[(@index - (@column_max*3) + @item_max) % @item_max] == "arrow"
- $sk_tree_data_refresh = true
- end
- end
- def cursor_right(wrap = false)
- actual_index = @index +1
- for i in actual_index...@item_max
- unless @data[i] == nil or @data[i] == "arrow"
- @index = (i)
- $sk_tree_data_refresh = true
- break
- end
- end
- end
- def cursor_left(wrap = false)
- actual_index = @index -1
- for i in 0..actual_index
- unless @data[actual_index-i] == nil or @data[actual_index-i] == "arrow"
- @index = (actual_index-i)
- $sk_tree_data_refresh = true
- break
- end
- end
- end
- end
- #==============================================================================
- # ■ Window_SkillTree_Data
- #==============================================================================
- class Window_SkillTree_Data < Window_Base
- include ST_setup
- def initialize(actor, tree)
- case $game_variables[ST_windows_var]
- when 1
- super(206, 68, 338, 292)
- when 2
- super(0, 124, 338, 292)
- when 3
- super(0, 68, 338, 292)
- when 4
- super(206, 56, 338, 292)
- when 5
- super(206, 0, 338, 292)
- when 6
- super(0, 56, 338, 292)
- when 7
- super(0, 0, 338, 292)
- else
- super(206, 124, 338, 292)
- end
- @actor = actor
- @tree = tree
- refresh
- end
- def refresh
- self.contents.clear
- draw_actor_face(@actor, 0, 0)
- draw_actor_name(@actor, 120, 0)
- draw_actor_level(@actor, 248, 0)
- draw_actor_class(@actor, 120, 24)
- self.contents.draw_text(0, 130, 304, WLH, $sk_lvl.to_s + "/" +
- $sk_max_lvl.to_s)
- self.contents.font.color = text_color(ST_skillname_color)
- self.contents.draw_text(0, 106, 304, WLH, $sk_name)
- self.contents.font.color = system_color
- self.contents.draw_text(120, 72, 184, WLH, ST_voc_cur)
- self.contents.font.color = normal_color
- self.contents.font.color = text_color(ST_zero_sp_color) if
- @actor.st_points < 1
- self.contents.draw_text(120, 72, 184, WLH, @actor.st_points, 2)
- self.contents.font.color = normal_color
- if $sk_req_data[0] == 0 and $sk_req_data[1] == 0 and $sk_req_data[2] == 0 and
- $sk_req_data[3] == 0 and $sk_req_data[4] == 0 and $sk_req_data[5] == 0
- self.contents.draw_text(0, 153, 304, WLH, ST_voc_max, 1)
- else
- self.contents.draw_text(0, 153, 304, WLH, ST_voc_req, 1)
- end
- self.contents.font.size = 18
- plus = 177
- unless $sk_req_data[4] == 0
- self.contents.draw_text(0, plus, 304, WLH, ST_voc_lvl + $sk_req_data[4].to_s)
- plus += 20
- end
- unless $sk_req_data[5] == 0
- display_name = ST_class_assign[@actor.class_id]
- $sk_req_data[5] == 1 ? points = ST_voc_one : points = ST_voc_many
- self.contents.draw_text(0, plus, 304, WLH, $sk_req_data[5].to_s + points +
- display_name[@tree + 3])
- plus += 20
- end
- unless $sk_req_data[0] == nil or $sk_req_data[1] == nil or $sk_req_data[1] == 0
- $sk_req_data[1] == 1 ? points = ST_voc_one : points = ST_voc_many
- self.contents.draw_text(0, plus, 304, WLH, $sk_req_data[1].to_s +
- points + $sk_req_data[0].to_s)
- plus += 20
- end
- unless $sk_req_data[2] == nil or $sk_req_data[3] == nil or $sk_req_data[1] == 0
- $sk_req_data[3] == 1 ? points = ST_voc_one : points = ST_voc_many
- self.contents.draw_text(0, plus, 304, WLH, $sk_req_data[3].to_s +
- points + $sk_req_data[2].to_s)
- end
- self.contents.font.size = 20
- end
- end
- class Window_SkillTree_Help < Window_Base
- def initialize
- case $game_variables[ST_setup::ST_windows_var]
- when 4,5,6,7
- super(0, 348, 544, 68)
- else
- super(0, 0, 544, 68)
- end
- end
- def set_text(text_a, text_b, cost_a = nil, cost_b = nil)
- self.contents.clear
- self.contents.font.size = 16
- self.contents.font.color = normal_color
- self.contents.draw_text(0, 0, self.width - 86, 16, text_a)
- self.contents.draw_text(0, 18, self.width - 86, 16, text_b)
- self.contents.draw_text(0, 0, self.width - 32, 16, "(" + cost_a.to_s + " " +
- Vocab::mp + ")", 2) unless cost_a == nil
- self.contents.draw_text(0, 18, self.width - 32, 16, "(" + cost_b.to_s + " " +
- Vocab::mp + ")", 2) unless cost_b == nil
- end
- end
- #==============================================================================
- # ■ Window_Tree_Selection
- #==============================================================================
- class Window_Tree_Selection < Window_Selectable
- def initialize(actor, tree)
- case $game_variables[ST_setup::ST_windows_var]
- when 1
- super(206, 360, 338, 56)
- when 2
- super(0, 68, 338, 56)
- when 3
- super(0, 360, 338, 56)
- when 4
- super(206, 0, 338, 56)
- when 5
- super(206, 292, 338, 56)
- when 6
- super(0, 0, 338, 56)
- when 7
- super(0, 292, 338, 56)
- else
- super(206, 68, 338, 56)
- end
- @actor = actor
- @column_max = 3
- self.index = tree
- refresh
- end
- def refresh
- @data = []
- display_name = ST_setup::ST_class_assign[@actor.class_id]
- for name in 0..2
- @data.push(display_name[name + 3])
- end
- create_contents
- for i in 0..2
- draw_item(i)
- end
- end
- def draw_item(index)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- tree = @data[index]
- if tree != nil
- if @index == index and ST_setup::ST_tree_selection == 2
- self.contents.font.color = text_color(ST_setup::ST_treeselection_color)
- else
- self.contents.font.color = normal_color
- end
- self.contents.draw_text(rect, tree, 1)
- end
- end
- def cursor_down(wrap = false)
- end
- def cursor_up(wrap = false)
- end
- def cursor_right(wrap = false)
- end
- def cursor_left(wrap = false)
- end
- def update_cursor
- return if ST_setup::ST_tree_selection == 2
- if @index < 0 # If the cursor position is less than 0
- self.cursor_rect.empty # Empty cursor
- else # If the cursor position is 0 or more
- row = @index / @column_max # Get current row
- if row < top_row # If before the currently displayed
- self.top_row = row # Scroll up
- end
- if row > bottom_row # If after the currently displayed
- self.bottom_row = row # Scroll down
- end
- rect = item_rect(@index) # Get rectangle of selected item
- rect.y -= self.oy # Match rectangle to scroll position
- self.cursor_rect = rect # Refresh cursor rectangle
- end
- end
- end
- #==============================================================================
- # ■ Window_NoSkillTree
- #==============================================================================
- class Scene_NoSkillTree < Scene_Base
- def initialize(actor_index, return_to_map = false)
- @actor_index = actor_index
- @return_to_map = return_to_map
- end
- def update_notree_warn
- if Input.trigger?(Input::B)
- Sound.play_cancel
- if @return_to_map
- $scene = Scene_Map.new
- else
- $scene = Scene_Menu.new(ST_setup::ST_menu_pos)
- end
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- if @return_to_map
- $scene = Scene_Map.new
- else
- $scene = Scene_Menu.new(ST_setup::ST_menu_pos)
- end
- end
- end
- def start
- unless ST_setup::ST_notalents_popup
- Sound.play_cancel
- if @return_to_map
- $scene = Scene_Map.new
- else
- $scene = Scene_Menu.new(ST_setup::ST_menu_pos)
- end
- terminate
- return
- end
- super
- create_menu_background
- @actor = $game_party.members[@actor_index]
- @notree_window = Window_Command.new(200, [ST_setup::ST_voc_noSTpop], 1)
- @notree_window.viewport = @viewport
- @notree_window.x = Graphics.width / 2 - @notree_window.width / 2
- @notree_window.y = Graphics.height / 2 - 20
- @notree_window_head = Window_Base.new(0, @notree_window.y - @notree_window.height,
- Graphics.width, @notree_window.height)
- @notree_window_head.create_contents
- if ST_setup::ST_notalents_popAN
- @notree_window_head.contents.draw_text(0, 0, @notree_window_head.contents.width,
- @notree_window_head.contents.height, ST_setup::ST_voc_noSTpop_pre + @actor.name +
- ST_setup::ST_voc_noSTpop_pos, 1)
- else
- @notree_window_head.contents.draw_text(0, 0, @notree_window_head.contents.width,
- @notree_window_head.contents.height, ST_setup::ST_voc_noSTpop_pre +
- ST_setup::ST_voc_noSTpop_pos, 1)
- end
- update_notree_warn
- end
- def update
- super
- update_menu_background
- @notree_window.update if ST_setup::ST_notalents_popup
- update_notree_warn
- end
- def terminate
- super
- if ST_setup::ST_notalents_popup
- @notree_window.dispose
- @notree_window_head.dispose
- end
- end
- end
- #==============================================================================
- # ■ Scene_SkillTree
- #==============================================================================
- class Scene_SkillTree < Scene_Base
- def initialize(actor_index, return_to_map = false)
- @actor_index = actor_index
- @return_to_map = return_to_map
- $sk_name = ""
- $sk_req_data = []
- $sk_tree_data_refresh = false
- end
- def start
- @actor = $game_party.members[@actor_index]
- unless ST_setup::ST_class_assign.include?(@actor.class_id)
- $scene = Scene_NoSkillTree.new(@actor_index, @return_to_map)
- terminate
- return
- end
- super
- create_menu_background
- @tree_index = @actor.get_last_tree_id
- @viewport = Viewport.new(0, 0, 544, 416)
- if ST_setup::ST_imageback != false
- tree_name = ST_setup::ST_class_assign[@actor.class_id]
- @back_img = Sprite.new
- @back_img.bitmap = Bitmap.new("Graphics/System/" + tree_name[@tree_index])
- @back_img.opacity = ST_setup::ST_imageback
- @back_img.viewport = @viewport
- end
- @help_window = Window_SkillTree_Help.new
- @help_window.viewport = @viewport
- @skilltree_window = Window_SkillTree_Main.new(@actor, @tree_index)
- @skilltree_window.viewport = @viewport
- @skilltree_window.help_window = @help_window
- @skilltree_window_data = Window_SkillTree_Data.new(@actor, @tree_index)
- @skilltree_window_data.viewport = @viewport
- @skilltree_window_tree = Window_Tree_Selection.new(@actor, @tree_index)
- @skilltree_window_tree.viewport = @viewport
- if ST_setup::ST_imageback != false
- @back_img.x = @skilltree_window.x
- @back_img.y = @skilltree_window.y
- end
- if ST_setup::ST_confirm_popup
- @confirm_window = Window_Command.new(200, [ST_setup::ST_voc_ok,
- ST_setup::ST_voc_cancel], 2)
- @confirm_window.viewport = @viewport
- @confirm_window.x = Graphics.width / 2 - @confirm_window.width / 2
- @confirm_window.y = Graphics.height / 2 - 20
- @confirm_window.active = false
- @confirm_window.visible = false
- @confirm_window_head = Window_Base.new(@confirm_window.x,
- @confirm_window.y - @confirm_window.height, @confirm_window.width, @confirm_window.height)
- @confirm_window_head.create_contents
- @confirm_window_head.contents.draw_text(0, 0, @confirm_window_head.contents.width,
- @confirm_window_head.contents.height, ST_setup::ST_voc_q, 1)
- @confirm_window_head.visible = false
- end
- actualize_data_window
- end
- def terminate
- super
- if ST_setup::ST_class_assign.include?(@actor.class_id)
- dispose_menu_background
- @help_window.dispose
- @skilltree_window.dispose
- @skilltree_window_data.dispose
- @skilltree_window_tree.dispose
- @back_img.dispose if ST_setup::ST_imageback != false
- @confirm_window.dispose if ST_setup::ST_confirm_popup
- @confirm_window_head.dispose if ST_setup::ST_confirm_popup
- end
- end
- def next_tree
- class_tree_assign = ST_setup::ST_class_assign[@actor.class_id]
- for i in 1...3
- @tree_index += i
- @tree_index %= 3
- tree_name = class_tree_assign[@tree_index]
- break if tree_name != nil
- end
- @actor.last_tree_id(@tree_index)
- $scene = Scene_SkillTree.new(@actor_index, @return_to_map)
- end
- def prev_tree
- class_tree_assign = ST_setup::ST_class_assign[@actor.class_id]
- for i in 1...3
- @tree_index -= i
- @tree_index %= 3
- tree_name = class_tree_assign[@tree_index]
- break if tree_name != nil
- end
- @actor.last_tree_id(@tree_index)
- $scene = Scene_SkillTree.new(@actor_index, @return_to_map)
- end
- def update
- return unless ST_setup::ST_class_assign.include?(@actor.class_id)
- super
- update_menu_background
- if @skilltree_window.active
- @skilltree_window.update
- @skilltree_window_tree.update unless ST_setup::ST_tree_selection == 1
- @back_img.update if ST_setup::ST_imageback != false
- update_skilltree_selection
- elsif @confirm_window.active
- @confirm_window.update
- update_confirm_selection
- end
- if $sk_tree_data_refresh != false
- actualize_data_window
- $sk_tree_data_refresh = false
- end
- end
- def update_skilltree_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- if @return_to_map
- $scene = Scene_Map.new
- else
- $scene = Scene_Menu.new(ST_setup::ST_menu_pos)
- end
- elsif Input.trigger?(Input::R)
- Sound.play_cursor
- next_tree
- elsif Input.trigger?(Input::L)
- Sound.play_cursor
- prev_tree
- elsif Input.trigger?(Input::C)
- actual_st_index = @skilltree_window.index
- if @skill != nil
- @actor.last_skill_id = @skill
- end
- if @skilltree_window.st_enabled?(actual_st_index) and
- @actor.st_points > 0 and
- @skilltree_window.get_skill_next_level(actual_st_index) != "maxed" and
- ST_setup::ST_confirm_popup == false
- Sound.play_decision
- do_skill_up
- elsif @skilltree_window.st_enabled?(actual_st_index) and
- @actor.st_points > 0 and
- @skilltree_window.get_skill_next_level(actual_st_index) != "maxed" and
- ST_setup::ST_confirm_popup
- Sound.play_decision
- start_confirm_selection
- else
- Sound.play_buzzer
- end
- end
- end
- def actualize_data_window
- actual_st_index = @skilltree_window.index
- sk_id = @skilltree_window.skill
- $sk_name = sk_id.name
- $sk_lvl = @skilltree_window.object_lvl(actual_st_index)
- $sk_max_lvl = @skilltree_window.object_max_lvl(actual_st_index)
- $sk_req_data = @skilltree_window.object_dad_req(actual_st_index)
- @skilltree_window_data.refresh
- @skilltree_window_tree.refresh
- end
- def start_confirm_selection
- @skilltree_window.active = false
- @skilltree_window_tree.active = false
- @confirm_window.visible = true
- @confirm_window.active = true
- @confirm_window_head.visible = true
- end
- def end_confirm_selection
- @skilltree_window.active = true
- @skilltree_window_tree.active = true
- @confirm_window.visible = false
- @confirm_window.active = false
- @confirm_window_head.visible = false
- @confirm_window.index = 0
- end
- def update_confirm_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- end_confirm_selection
- elsif Input.trigger?(Input::C)
- if @confirm_window.index == 0
- if @skill != nil
- @actor.last_skill_id = @skill
- end
- Sound.play_decision
- do_skill_up
- else
- Sound.play_cancel
- end
- end_confirm_selection
- end
- end
- def do_skill_up
- @skill = @skilltree_window.skill
- actual_st_index = @skilltree_window.index
- actual_skill = @skilltree_window.get_skill_actual_level(actual_st_index)
- @actor.forget_tree_skill(actual_skill) unless actual_skill == "not learned"
- @actor.learn_tree_skill(@skill.id)
- @skilltree_window.refresh
- actualize_data_window
- end
- end
- module ST_command
-
- WAYS = { :position=>0, :name=>1, :id=>2 }
-
- def self.show(way, dude, to_map = false)
- way = WAYS[way] if way.is_a? Symbol
- case way
- when 0
- $scene = Scene_SkillTree.new(dude, to_map)
- when 1
- for actor in $game_party.members
- if actor.name == dude
- $scene = Scene_SkillTree.new(actor.index, to_map)
- end
- end
- when 2
- if $game_party.members.include?($game_actors[dude])
- $scene = Scene_SkillTree.new($game_actors[dude].index, to_map)
- end
- end
- end
- def self.reward(way, dude, amount = 1)
- way = WAYS[way] if way.is_a? Symbol
- case way
- when 0
- $game_party.members[dude].reward_st_points(amount)
- when 1
- for actor in $game_party.members
- if actor.name == dude
- actor.reward_st_points(amount)
- end
- end
- when 2
- if $game_party.members.include?($game_actors[dude])
- $game_actors[dude].reward_st_points(amount)
- end
- end
- end
- def self.reward_party(amount = 1)
- for member in $game_party.members
- member.reward_st_points(amount)
- end
- end
- def self.reset(way, dude)
- way = WAYS[way] if way.is_a? Symbol
- case way
- when 0
- $game_party.members[dude].reset_skill_trees
- when 1
- for actor in $game_party.members
- if actor.name == dude
- actor.reset_skill_trees
- end
- end
- when 2
- if $game_party.members.include?($game_actors[dude])
- $game_actors[dude].reset_skill_trees
- end
- end
- end
- def self.reset_party
- for member in $game_party.members
- member.reset_skill_trees
- end
- end
- end
复制代码 |
评分
-
查看全部评分
|