赞 | 2 |
VIP | 0 |
好人卡 | 0 |
积分 | 5 |
经验 | 270 |
最后登录 | 2020-7-16 |
在线时间 | 33 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 453
- 在线时间
- 33 小时
- 注册时间
- 2017-10-4
- 帖子
- 38
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
脚本如下:
#=============================================================================== #★ RGSS3 技能树(设定) Verα2.00(角色设定型) by ヒール #------------------------------------------------------------------------------- # 一个技能树系统,可以链式学习新技能。 # 通过消耗SP来学习新技能。 #------------------------------------------------------------------------------- #以下为有关角色SP的脚本: #$game_variables[x] = $game_actors[角色ID].skill_point (设定x号变量用于存储某 # 角色的SP值) #$game_actors[角色ID].skill_point += 10(增加某角色10点SP) # #你也可以根据队伍id改变角色的SP值: # #$game_party.members[队伍id].skill_point #※队伍id=0 则为队长角色,id=1为队长后第一位角色,2为队长后第二位角色 # # SceneManager.call(Scene_Skilltree) # 显示技能树画面 #------------------------------------------------------------------------------- #Ver1.01 同角色の別技能树の技能の習得が他の技能树の技能の習得を #可能にしていた不具合を修正しました。 #------------------------------------------------------------------------------- #Ver2.00 大幅に改修し、自在な形の技能树の作成が可能になりました。 #ただし、以前の设定は流用できません。 #また、習得条件にレベルの设定が出来るようになりました。 #=============================================================================== module Hi_ru_Skilltree SKILL_LEARN_ME = 'Audio/ME/Item' #学习技能成功时的ME SKILL_LEARN_VOLUME = 100 #ME的音量 SKILL_LEARN_PITCH = 110 #ME的音调 LEVEL_COLOR = 10 #需要等级的数字颜色 TREE =[] TREE[10] = nil #0号角色无技能树 #技能树指令的开关id #开关开启时,会在菜单中显示"技能树"的指令 MENU_SWITCH = 10 #技能树指令的文本。 MENU_COMMAND = "技能树" #有关技能树的变量。 #默认使用变量为10、11、12号变量。 VARIABLES = 10 #角色ID CURRENT = 11 #各种技能信息 TREE_ID = 12 #技能树ID #默认的SP初始值 SP_DEFAULT = 1000 #默认升级时获得的SP SP_LEVELUP = 5 #以下为每个角色的技能树设定。 #设定前请仔细阅读"技能树Ver2.00設定方法・注意.txt"和参考图片 #技能树的全部可用位置为:9行×6列,共54个. #设定的行号必须小于或等于8,纵号小于或等于5。 #一个位置只能放置一个技能,否则无法成功运作。 #前提技能方向的设定:0 无条件, 2,4,6,8 为↓←→↑(小键盘的方向) #当角色等级大于需要等级时,不会显示需要等级的数字。 #无需要等级时请设定为0。 #TREE[角色ID] = [ #[技能树id,横号,纵号,前提技能方向,学会技能id,消耗SP,需要等级], #] # #1号角色的设定 TREE[1] =[ [ 0, 0, 0, 0, 10, 5, 0], [ 0, 1, 0, 4, 16, 10, 3], [ 0, 2, 0, 4, 17, 12, 0], [ 0, 3, 0, 4, 18, 14, 0], [ 0, 4, 0, 4, 19, 16, 0], [ 0, 5, 0, 4, 20, 18, 0], [ 0, 6, 0, 4, 21, 20, 0], [ 0, 7, 0, 4, 22, 24, 0], [ 0, 8, 0, 4, 23, 28, 0], #不一定非要空行,只是为了看起来更方便。 [ 0, 0, 1, 8, 11, 6, 2], [ 0, 1, 1, 4, 24, 8, 0], [ 0, 2, 1, 4, 25, 10, 0], [ 0, 3, 1, 4, 26, 14, 0], [ 0, 4, 1, 4, 27, 18, 0], [ 0, 5, 1, 8, 61, 16, 0], [ 0, 6, 1, 4, 62, 16, 0], [ 0, 7, 1, 4, 54, 10, 0], [ 0, 8, 1, 4, 48, 10, 0], [ 0, 0, 2, 8, 12, 7, 3], [ 0, 1, 2, 4, 28, 10, 0], [ 0, 2, 2, 4, 29, 13, 0], [ 0, 3, 2, 4, 30, 16, 0], [ 0, 4, 2, 8, 31, 20, 0], [ 0, 5, 2, 8, 60, 16, 0], [ 0, 6, 2, 4, 63, 16, 0], [ 0, 7, 2, 4, 55, 13, 0], [ 0, 8, 2, 4, 49, 13, 0], [ 0, 0, 3, 8, 13, 8, 6], [ 0, 1, 3, 0, 32, 10, 0], [ 0, 2, 3, 4, 33, 13, 0], [ 0, 3, 3, 4, 34, 16, 0], [ 0, 4, 3, 4, 35, 20, 0], [ 0, 5, 3, 4, 58, 16, 0], [ 0, 6, 3, 4, 59, 16, 0], [ 0, 7, 3, 8, 56, 16, 0], [ 0, 8, 3, 4, 50, 16, 0], [ 0, 0, 4, 8, 14, 9, 10], [ 0, 1, 4, 4, 36, 10, 0], [ 0, 2, 4, 4, 37, 13, 0], [ 0, 3, 4, 4, 38, 16, 0],[ 0, 4, 4, 4, 39, 20, 0], #一行放两个也是ok的。 [ 0, 5, 4, 4, 52, 16, 0], [ 0, 6, 4, 4, 53, 20, 0], [ 0, 7, 4, 4, 57, 16, 0], [ 0, 8, 4, 8, 51, 20, 0], [ 0, 0, 5, 6, 15, 15, 15], [ 0, 1, 5, 6, 40, 10, 0], [ 0, 2, 5, 6, 41, 13, 0], [ 0, 3, 5, 6, 42, 16, 0], [ 0, 4, 5, 8, 43, 20, 0], [ 0, 5, 5, 4, 44, 25, 0], [ 0, 6, 5, 4, 45, 30, 0], [ 0, 7, 5, 4, 46, 35, 0], [ 0, 8, 5, 4, 47, 40,135], #不一定非要空行,只是为了看起来更方便。 [ 1, 0, 0, 0, 64, 5, 0], #下面为第二个技能树的设定。 [ 1, 1, 0, 4, 65, 6, 0], [ 1, 2, 0, 4, 66, 7, 0], [ 1, 3, 0, 4, 67, 8, 0], [ 1, 4, 0, 4, 68, 9, 0], [ 1, 5, 0, 4, 69, 15, 0], [ 2, 0, 0, 2, 63, 16, 0], [ 2, 0, 1, 0, 126, 15, 0], ] #2号角色的设定 TREE[2] =[ [ 0, 0, 0, 0, 10, 5, 0], [ 0, 1, 0, 4, 86, 10, 0], [ 0, 2, 0, 4, 87, 12, 0], [ 0, 3, 0, 4, 88, 14, 0], [ 0, 4, 0, 4, 89, 16, 0], [ 0, 5, 0, 4, 90, 18, 0], [ 0, 6, 0, 4, 91, 20, 0], [ 0, 7, 0, 4, 92, 24, 0], [ 0, 8, 0, 4, 93, 28, 0], [ 0, 0, 1, 8, 81, 6, 0], [ 0, 1, 1, 4, 94, 8, 0], [ 0, 2, 1, 4, 95, 10, 0], [ 0, 3, 1, 4, 96, 14, 0], [ 0, 4, 1, 4, 97, 18, 0], [ 0, 5, 1, 4, 82, 7, 0], [ 0, 6, 1, 4, 83, 8, 0], [ 0, 7, 1, 4, 84, 9, 0], [ 0, 8, 1, 8, 85, 15, 0], [ 0, 0, 2, 8, 98, 10, 0], [ 0, 1, 2, 4, 99, 13, 0], [ 0, 2, 2, 4, 100, 16, 0], [ 0, 3, 2, 4, 101, 20, 0], [ 0, 4, 2, 4, 102, 10, 0], [ 0, 5, 2, 4, 103, 13, 0], [ 0, 6, 2, 4, 104, 16, 0], [ 0, 7, 2, 4, 105, 20, 0], [ 0, 8, 2, 8, 106, 10, 0], [ 0, 0, 3, 8, 107, 13, 0], [ 0, 1, 3, 4, 108, 16, 0], [ 0, 2, 3, 4, 109, 20, 0], [ 0, 3, 3, 4, 110, 10, 0], [ 0, 4, 3, 4, 111, 13, 0], [ 0, 5, 3, 4, 112, 16, 0], [ 0, 6, 3, 4, 113, 20, 0], [ 0, 7, 3, 4, 114, 25, 0], [ 0, 8, 3, 8, 115, 30, 0], [ 0, 0, 4, 8, 116, 35, 0], [ 0, 1, 4, 4, 117, 40, 0], [ 0, 2, 4, 4, 118, 10, 0], [ 0, 3, 4, 4, 119, 13, 0], [ 0, 4, 4, 4, 120, 16, 0], [ 0, 5, 4, 4, 121, 20, 0], [ 0, 6, 4, 4, 122, 16, 0], [ 0, 7, 4, 4, 123, 20, 0], [ 0, 8, 4, 4, 124, 10, 0], ] #设定结束。 end
#===============================================================================
#★ RGSS3 技能树(设定) Verα2.00(角色设定型) by ヒール
#-------------------------------------------------------------------------------
# 一个技能树系统,可以链式学习新技能。
# 通过消耗SP来学习新技能。
#-------------------------------------------------------------------------------
#以下为有关角色SP的脚本:
#$game_variables[x] = $game_actors[角色ID].skill_point (设定x号变量用于存储某
# 角色的SP值)
#$game_actors[角色ID].skill_point += 10(增加某角色10点SP)
#
#你也可以根据队伍id改变角色的SP值:
#
#$game_party.members[队伍id].skill_point
#※队伍id=0 则为队长角色,id=1为队长后第一位角色,2为队长后第二位角色
#
# SceneManager.call(Scene_Skilltree)
# 显示技能树画面
#-------------------------------------------------------------------------------
#Ver1.01 同角色の別技能树の技能の習得が他の技能树の技能の習得を
#可能にしていた不具合を修正しました。
#-------------------------------------------------------------------------------
#Ver2.00 大幅に改修し、自在な形の技能树の作成が可能になりました。
#ただし、以前の设定は流用できません。
#また、習得条件にレベルの设定が出来るようになりました。
#===============================================================================
module Hi_ru_Skilltree
SKILL_LEARN_ME = 'Audio/ME/Item' #学习技能成功时的ME
SKILL_LEARN_VOLUME = 100 #ME的音量
SKILL_LEARN_PITCH = 110 #ME的音调
LEVEL_COLOR = 10 #需要等级的数字颜色
TREE =[]
TREE[10] = nil #0号角色无技能树
#技能树指令的开关id
#开关开启时,会在菜单中显示"技能树"的指令
MENU_SWITCH = 10
#技能树指令的文本。
MENU_COMMAND = "技能树"
#有关技能树的变量。
#默认使用变量为10、11、12号变量。
VARIABLES = 10 #角色ID
CURRENT = 11 #各种技能信息
TREE_ID = 12 #技能树ID
#默认的SP初始值
SP_DEFAULT = 1000
#默认升级时获得的SP
SP_LEVELUP = 5
#以下为每个角色的技能树设定。
#设定前请仔细阅读"技能树Ver2.00設定方法・注意.txt"和参考图片
#技能树的全部可用位置为:9行×6列,共54个.
#设定的行号必须小于或等于8,纵号小于或等于5。
#一个位置只能放置一个技能,否则无法成功运作。
#前提技能方向的设定:0 无条件, 2,4,6,8 为↓←→↑(小键盘的方向)
#当角色等级大于需要等级时,不会显示需要等级的数字。
#无需要等级时请设定为0。
#TREE[角色ID] = [
#[技能树id,横号,纵号,前提技能方向,学会技能id,消耗SP,需要等级],
#]
#
#1号角色的设定
TREE[1] =[
[ 0, 0, 0, 0, 10, 5, 0],
[ 0, 1, 0, 4, 16, 10, 3],
[ 0, 2, 0, 4, 17, 12, 0],
[ 0, 3, 0, 4, 18, 14, 0],
[ 0, 4, 0, 4, 19, 16, 0],
[ 0, 5, 0, 4, 20, 18, 0],
[ 0, 6, 0, 4, 21, 20, 0],
[ 0, 7, 0, 4, 22, 24, 0],
[ 0, 8, 0, 4, 23, 28, 0],
#不一定非要空行,只是为了看起来更方便。
[ 0, 0, 1, 8, 11, 6, 2],
[ 0, 1, 1, 4, 24, 8, 0],
[ 0, 2, 1, 4, 25, 10, 0],
[ 0, 3, 1, 4, 26, 14, 0],
[ 0, 4, 1, 4, 27, 18, 0],
[ 0, 5, 1, 8, 61, 16, 0],
[ 0, 6, 1, 4, 62, 16, 0],
[ 0, 7, 1, 4, 54, 10, 0],
[ 0, 8, 1, 4, 48, 10, 0],
[ 0, 0, 2, 8, 12, 7, 3],
[ 0, 1, 2, 4, 28, 10, 0],
[ 0, 2, 2, 4, 29, 13, 0],
[ 0, 3, 2, 4, 30, 16, 0],
[ 0, 4, 2, 8, 31, 20, 0],
[ 0, 5, 2, 8, 60, 16, 0],
[ 0, 6, 2, 4, 63, 16, 0],
[ 0, 7, 2, 4, 55, 13, 0],
[ 0, 8, 2, 4, 49, 13, 0],
[ 0, 0, 3, 8, 13, 8, 6],
[ 0, 1, 3, 0, 32, 10, 0],
[ 0, 2, 3, 4, 33, 13, 0],
[ 0, 3, 3, 4, 34, 16, 0],
[ 0, 4, 3, 4, 35, 20, 0],
[ 0, 5, 3, 4, 58, 16, 0],
[ 0, 6, 3, 4, 59, 16, 0],
[ 0, 7, 3, 8, 56, 16, 0],
[ 0, 8, 3, 4, 50, 16, 0],
[ 0, 0, 4, 8, 14, 9, 10],
[ 0, 1, 4, 4, 36, 10, 0],
[ 0, 2, 4, 4, 37, 13, 0],
[ 0, 3, 4, 4, 38, 16, 0],[ 0, 4, 4, 4, 39, 20, 0], #一行放两个也是ok的。
[ 0, 5, 4, 4, 52, 16, 0],
[ 0, 6, 4, 4, 53, 20, 0],
[ 0, 7, 4, 4, 57, 16, 0],
[ 0, 8, 4, 8, 51, 20, 0],
[ 0, 0, 5, 6, 15, 15, 15],
[ 0, 1, 5, 6, 40, 10, 0],
[ 0, 2, 5, 6, 41, 13, 0],
[ 0, 3, 5, 6, 42, 16, 0],
[ 0, 4, 5, 8, 43, 20, 0],
[ 0, 5, 5, 4, 44, 25, 0],
[ 0, 6, 5, 4, 45, 30, 0],
[ 0, 7, 5, 4, 46, 35, 0],
[ 0, 8, 5, 4, 47, 40,135],
#不一定非要空行,只是为了看起来更方便。
[ 1, 0, 0, 0, 64, 5, 0], #下面为第二个技能树的设定。
[ 1, 1, 0, 4, 65, 6, 0],
[ 1, 2, 0, 4, 66, 7, 0],
[ 1, 3, 0, 4, 67, 8, 0],
[ 1, 4, 0, 4, 68, 9, 0],
[ 1, 5, 0, 4, 69, 15, 0],
[ 2, 0, 0, 2, 63, 16, 0],
[ 2, 0, 1, 0, 126, 15, 0],
]
#2号角色的设定
TREE[2] =[
[ 0, 0, 0, 0, 10, 5, 0],
[ 0, 1, 0, 4, 86, 10, 0],
[ 0, 2, 0, 4, 87, 12, 0],
[ 0, 3, 0, 4, 88, 14, 0],
[ 0, 4, 0, 4, 89, 16, 0],
[ 0, 5, 0, 4, 90, 18, 0],
[ 0, 6, 0, 4, 91, 20, 0],
[ 0, 7, 0, 4, 92, 24, 0],
[ 0, 8, 0, 4, 93, 28, 0],
[ 0, 0, 1, 8, 81, 6, 0],
[ 0, 1, 1, 4, 94, 8, 0],
[ 0, 2, 1, 4, 95, 10, 0],
[ 0, 3, 1, 4, 96, 14, 0],
[ 0, 4, 1, 4, 97, 18, 0],
[ 0, 5, 1, 4, 82, 7, 0],
[ 0, 6, 1, 4, 83, 8, 0],
[ 0, 7, 1, 4, 84, 9, 0],
[ 0, 8, 1, 8, 85, 15, 0],
[ 0, 0, 2, 8, 98, 10, 0],
[ 0, 1, 2, 4, 99, 13, 0],
[ 0, 2, 2, 4, 100, 16, 0],
[ 0, 3, 2, 4, 101, 20, 0],
[ 0, 4, 2, 4, 102, 10, 0],
[ 0, 5, 2, 4, 103, 13, 0],
[ 0, 6, 2, 4, 104, 16, 0],
[ 0, 7, 2, 4, 105, 20, 0],
[ 0, 8, 2, 8, 106, 10, 0],
[ 0, 0, 3, 8, 107, 13, 0],
[ 0, 1, 3, 4, 108, 16, 0],
[ 0, 2, 3, 4, 109, 20, 0],
[ 0, 3, 3, 4, 110, 10, 0],
[ 0, 4, 3, 4, 111, 13, 0],
[ 0, 5, 3, 4, 112, 16, 0],
[ 0, 6, 3, 4, 113, 20, 0],
[ 0, 7, 3, 4, 114, 25, 0],
[ 0, 8, 3, 8, 115, 30, 0],
[ 0, 0, 4, 8, 116, 35, 0],
[ 0, 1, 4, 4, 117, 40, 0],
[ 0, 2, 4, 4, 118, 10, 0],
[ 0, 3, 4, 4, 119, 13, 0],
[ 0, 4, 4, 4, 120, 16, 0],
[ 0, 5, 4, 4, 121, 20, 0],
[ 0, 6, 4, 4, 122, 16, 0],
[ 0, 7, 4, 4, 123, 20, 0],
[ 0, 8, 4, 4, 124, 10, 0],
]
#设定结束。
end
#=============================================================================== #★ RGSS3 技能树(本体) Verα2.00(角色設定型) by ヒール #------------------------------------------------------------------------------- # 请将本脚本放在"技能树ーα2.00(设定)"之下。 # 无需改变此脚本。(可以设定用语) #============================================================================== # ■ Game_Actor [class] #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ○ モジュールの設定 #-------------------------------------------------------------------------- include Hi_ru_Skilltree #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :skill_point #-------------------------------------------------------------------------- # ● セットアップ [エイリアス] # actor_id : アクター ID #-------------------------------------------------------------------------- alias setup_skill_point setup def setup(actor_id) setup_skill_point(actor_id) setup_skillpoint end #-------------------------------------------------------------------------- # ○ SPのセットアップ #-------------------------------------------------------------------------- def setup_skillpoint @skill_point = SP_DEFAULT end #-------------------------------------------------------------------------- # ● レベルアップ #-------------------------------------------------------------------------- alias level_up_skill_point level_up def level_up level_up_skill_point @skill_point += SP_LEVELUP end end #=============================================================================== # ■ Scene_Skill_tree #=============================================================================== class Scene_Skilltree < Scene_MenuBase include Hi_ru_Skilltree #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super $game_variables[VARIABLES] = $game_party.members[0].actor.id #先頭のアクターで開始 $game_variables[TREE_ID] = 0 create_help_window create_task_window #create_learn_window スキル習得ウインドウのみ直前で生成 create_info_window create_tree_window window_setting end #-------------------------------------------------------------------------- # ● ヘルプウィンドウの作成 #-------------------------------------------------------------------------- def create_help_window @help_window = Window_Help.new @help_window.viewport = @viewport end #-------------------------------------------------------------------------- # ● スキル習得ウインドウの作成 #-------------------------------------------------------------------------- def create_learn_window wx = Graphics.width / 2 - 180 wy = Graphics.height / 2 - 60 @learn_window = Window_Skill_learn.new(wx, wy) @learn_window.unselect @learn_window.deactivate @learn_window.z += 100 @learn_window.hide @learn_window.set_handler(:ok, method(:learn_ok)) end #-------------------------------------------------------------------------- # ● タスクウィンドウの作成 #-------------------------------------------------------------------------- def create_task_window wx = (Graphics.width - 180)/2 wy = 64 @task_window = Window_Skillpoint_Task.new(wx, wy) @task_window.unselect @task_window.deactivate @task_window.z += 100 @task_window.hide @task_window.set_handler(:cancel, method(:task_cancel)) @task_window.set_handler(:ok, method(:task_ok)) end #-------------------------------------------------------------------------- # ● インフォメーションウインドウの作成 #-------------------------------------------------------------------------- def create_info_window @info_window = Window_info.new(0,Graphics.height-72,Graphics.width,72) end #-------------------------------------------------------------------------- # ● ツリーウインドウの作成 #-------------------------------------------------------------------------- def create_tree_window @tree_window = Window_tree.new(0,72,200) @tree_window.set_handler(:cancel, method(:tree_cancel)) @tree_window.set_handler(:ok, method(:call_task)) @tree_window.set_handler(:pageup, method(:treeq_downpage)) @tree_window.set_handler(:pagedown, method(:treew_nextpage)) @tree_window.set_handler(:treeup, method(:tree_up)) @tree_window.set_handler(:treedown, method(:tree_down)) end #-------------------------------------------------------------------------- # ● ウィンドウのセット #-------------------------------------------------------------------------- def window_setting @tree_window.help_window = @help_window @tree_window.info_window = @info_window @info_window.current_ext = @tree_window.current_ext end #-------------------------------------------------------------------------- # ● スキル選択ウインドウ[キャンセル] #-------------------------------------------------------------------------- def tree_cancel return_scene end #-------------------------------------------------------------------------- # ● タスクウィンドウ呼び出し #-------------------------------------------------------------------------- def call_task @tree_window.deactivate @task_window.show @task_window.activate @task_window.refresh @task_window.select(0) end #-------------------------------------------------------------------------- # ● アクターの切り替え #-------------------------------------------------------------------------- def treeq_downpage $game_variables[TREE_ID] = 0 chara_current = $game_variables[VARIABLES] loopx = $game_party.members.size - 1 for i in 0..loopx if chara_current == $game_party.members[i].actor.id unless i == 0 chara_next = $game_party.members[i-1].actor.id else chara_next = $game_party.members[loopx].actor.id end break end end $game_variables[VARIABLES] = chara_next @help_window.refresh @info_window.refresh @tree_window.refresh @tree_window.select(0) end #-------------------------------------------------------------------------- # ● アクターの切り替え #-------------------------------------------------------------------------- def treew_nextpage $game_variables[TREE_ID] = 0 chara_current = $game_variables[VARIABLES] loopx = $game_party.members.size - 1 for i in 0..loopx if chara_current == $game_party.members[i].actor.id unless i == loopx chara_next = $game_party.members[i+1].actor.id else chara_next = $game_party.members[0].actor.id end break end end $game_variables[VARIABLES] = chara_next @help_window.refresh @info_window.refresh @tree_window.refresh @tree_window.select(0) end #-------------------------------------------------------------------------- # ● ツリーの切り替え #-------------------------------------------------------------------------- def tree_up @help_window.refresh @info_window.refresh @tree_window.refresh @tree_window.select(0) end #-------------------------------------------------------------------------- # ● ツリーの切り替え #-------------------------------------------------------------------------- def tree_down @help_window.refresh @info_window.refresh @tree_window.refresh @tree_window.select(0) end #-------------------------------------------------------------------------- # ● タスクウィンドウの消去 #-------------------------------------------------------------------------- def close_task @task_window.hide @task_window.deactivate end #-------------------------------------------------------------------------- # ● スキル習得ウィンドウ呼び出し #-------------------------------------------------------------------------- def call_learn @learn_window.show @learn_window.activate @learn_window.refresh @learn_window.select(0) end #-------------------------------------------------------------------------- # ● スキル習得ウィンドウの消去 #-------------------------------------------------------------------------- def close_learn @learn_window.hide @learn_window.deactivate end #-------------------------------------------------------------------------- # ● スキル習得ウィンドウ[決定] #-------------------------------------------------------------------------- def learn_ok case @learn_window.index when 0 close_learn @tree_window.activate @help_window.refresh @info_window.refresh @tree_window.refresh end end #-------------------------------------------------------------------------- # ● タスクウィンドウ[習得する] #-------------------------------------------------------------------------- def task_ok case @task_window.index when 0 $game_actors[$game_variables[VARIABLES]].learn_skill($game_variables[CURRENT][0]) $game_actors[$game_variables[VARIABLES]].skill_point -= $game_variables[CURRENT][1] close_task @help_window.refresh @info_window.refresh @tree_window.refresh create_learn_window call_learn when 1 close_task @tree_window.activate @help_window.refresh @info_window.refresh @tree_window.refresh end end #-------------------------------------------------------------------------- # ● タスクウィンドウ[キャンセル] #-------------------------------------------------------------------------- def task_cancel close_task @tree_window.activate @help_window.refresh @tree_window.refresh @tree_window.refresh end end #============================================================================== # ■ Window_tree #------------------------------------------------------------------------------ # メイン部分のウインドウです。 #============================================================================== class Window_tree< Window_Command include Hi_ru_Skilltree attr_accessor :info_window #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x,y,height) @window_height = 292 super(x,y) end #-------------------------------------------------------------------------- # ● 桁数の取得 #-------------------------------------------------------------------------- def col_max return 9 end #-------------------------------------------------------------------------- # ● 横に項目が並ぶときの空白の幅を取得 #-------------------------------------------------------------------------- def spacing return 28 end #-------------------------------------------------------------------------- # ● 項目の幅を取得 #-------------------------------------------------------------------------- def item_width 26 end #-------------------------------------------------------------------------- # ● 項目の高さを取得 #-------------------------------------------------------------------------- def item_height 26 end #-------------------------------------------------------------------------- # ● ウィンドウ幅の取得 #-------------------------------------------------------------------------- def window_width Graphics.width end #-------------------------------------------------------------------------- # ● ウィンドウ高さの取得 #-------------------------------------------------------------------------- def window_height Graphics.height - 144 end #-------------------------------------------------------------------------- # ● カーソルの更新 #-------------------------------------------------------------------------- def update_cursor #カーソル描画フラグ @flag_cursor = 1 if @cursor_all cursor_rect.set(0, 0, contents.width, row_max * item_height) self.top_row = 0 elsif @index < 0 cursor_rect.empty else ensure_cursor_visible cursor_rect.set(item_rect(@index)) end #カーソル描画フラグ @flag_cursor = 0 end #-------------------------------------------------------------------------- # ● 項目を描画する矩形の取得 #-------------------------------------------------------------------------- def item_rect(index) if @flag_cursor == 1 draw_x = 0 else draw_x = 40 end rect = Rect.new rect.width = item_width - draw_x rect.height = item_height rect.x = index % col_max * (item_width + spacing) + draw_x + 48 rect.y = index / col_max * (item_height + spacing/2 +1) rect end #-------------------------------------------------------------------------- # ● 項目の描画 #-------------------------------------------------------------------------- def draw_item(index) change_color(normal_color, command_enabled?(index)) draw_text(item_rect_for_text(index), command_name(index), alignment) end #-------------------------------------------------------------------------- # ● コマンドリストの作成 #-------------------------------------------------------------------------- def make_command_list a = $game_variables[VARIABLES] loopx = TREE[a].size - 1 check = [] exts = [] for j in (0..loopx) next if TREE[a][j][0] != $game_variables[TREE_ID] branch = TREE[a][j][1] order = TREE[a][j][2] before = TREE[a][j][3] ext = [TREE[a][j][4],TREE[a][j][5],branch,order,before,TREE[a][j][6]] calculate = 9 * order + branch + 1 check[calculate] = true if branch <= 8 exts[calculate] = ext end for i in (1..54) add_command("", :ok, check[i],exts[i]) end end #-------------------------------------------------------------------------- # ● 決定やキャンセルなどのハンドリング処理 #-------------------------------------------------------------------------- def process_handling return unless open? && active return process_ok if ok_enabled? && Input.trigger?(:C) return process_cancel if cancel_enabled? && Input.trigger?(:B) return process_pagedown if handle?(:pagedown) && Input.trigger?(:R) return process_pageup if handle?(:pageup) && Input.trigger?(:L) return process_treeup if Input.trigger?(:Y) return process_treedown if Input.trigger?(:Z) end #-------------------------------------------------------------------------- # ● カーソル位置の設定 #-------------------------------------------------------------------------- def index=(index) @index = index update_cursor call_update_help @info_window.current_ext = current_ext if @info_window end #-------------------------------------------------------------------------- # ● カーソルを下に移動 #-------------------------------------------------------------------------- def cursor_down(wrap = false) if index < item_max - col_max || (wrap && col_max == 1) select((index + col_max) % item_max) for c in 1..100 if current_item_enabled? break end select((index + col_max) % item_max) end end end #-------------------------------------------------------------------------- # ● カーソルを上に移動 #-------------------------------------------------------------------------- def cursor_up(wrap = false) if index >= col_max || (wrap && col_max == 1) select((index - col_max + item_max) % item_max) for c in 1..100 if current_item_enabled? break end select((index - col_max + item_max) % item_max) end end end #-------------------------------------------------------------------------- # ● カーソルを右に移動 #-------------------------------------------------------------------------- def cursor_right(wrap = false) if col_max >= 2 && (index < item_max - 1 || (wrap && horizontal?)) select((index + 1) % item_max) for c in 1..100 if current_item_enabled? break end select((index + 1) % item_max) end end end #-------------------------------------------------------------------------- # ● カーソルを左に移動 #-------------------------------------------------------------------------- def cursor_left(wrap = false) if col_max >= 2 && (index > 0 || (wrap && horizontal?)) select((index - 1 + item_max) % item_max) for c in 1..100 if current_item_enabled? break end select((index - 1 + item_max) % item_max) end end end #-------------------------------------------------------------------------- # ● L ボタン(PageUp)が押されたときの処理 #-------------------------------------------------------------------------- def process_pageup Sound.play_cursor Input.update call_handler(:pageup) end #-------------------------------------------------------------------------- # ● R ボタン(PageDown)が押されたときの処理 #-------------------------------------------------------------------------- def process_pagedown Sound.play_cursor Input.update call_handler(:pagedown) end #-------------------------------------------------------------------------- # ● Y ボタン(TreeUp)が押されたときの処理 #-------------------------------------------------------------------------- def process_treeup a = $game_variables[VARIABLES] loopx = TREE[a].size - 1 tree_next = 0 for i in (0..loopx) tree_next = TREE[a][i][0] if tree_next < TREE[a][i][0] end unless $game_variables[TREE_ID] == 0 $game_variables[TREE_ID] -= 1 else $game_variables[TREE_ID] = tree_next end Sound.play_cursor Input.update call_handler(:treeup) end #-------------------------------------------------------------------------- # ● Z ボタン(TreeDown)が押されたときの処理 #-------------------------------------------------------------------------- def process_treedown a = $game_variables[VARIABLES] loopx = TREE[a].size - 1 tree_next = 0 for i in (0..loopx) tree_next = TREE[a][i][0] if tree_next < TREE[a][i][0] end unless $game_variables[TREE_ID] == tree_next $game_variables[TREE_ID] += 1 else $game_variables[TREE_ID] = 0 end Sound.play_cursor Input.update call_handler(:treedown) end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh clear_command_list make_command_list create_contents super draw_icon_bar end #-------------------------------------------------------------------------- # ● 各種描画 #-------------------------------------------------------------------------- def draw_icon_bar a = $game_variables[VARIABLES] loopx = TREE[a].size - 1 d = $game_actors[a].level self.contents.font.size = 16 for i in (0..loopx) next if TREE[a][i][0] != $game_variables[TREE_ID] branch = TREE[a][i][1] * 54 order = TREE[a][i][2] * 41 skill_id = TREE[a][i][4] icon_index = $data_skills[skill_id].icon_index if $game_actors[a].skill_learn?($data_skills[skill_id]) learn = true else learn = false end change_color(text_color(LEVEL_COLOR)) draw_text(branch+40,order-2, 30, 24,TREE[a][i][6]) if d < TREE[a][i][6] && TREE[a][i][6] >= 1 && TREE[a][i][6] <10 draw_text(branch+34,order-2, 30, 24,TREE[a][i][6]) if d < TREE[a][i][6] && TREE[a][i][6] >= 10 && TREE[a][i][6] <100 draw_text(branch+28,order-2, 30, 24,TREE[a][i][6]) if d < TREE[a][i][6] && TREE[a][i][6] >= 100 draw_icon(icon_index,48+branch,order,learn) end change_color(normal_color) for i in (0..loopx) next if TREE[a][i][0] != $game_variables[TREE_ID] #現在のツリー以外を無視 branch = TREE[a][i][1] order = TREE[a][i][2] before = TREE[a][i][3] if before == 2 || before == 8 for j in (0..loopx) next if TREE[a][j][0] != $game_variables[TREE_ID] #現在のツリー以外を無視 next if branch != TREE[a][j][1] next if order != (TREE[a][j][2] - 1) && before == 2 next if order != (TREE[a][j][2] + 1) && before == 8 skill_id = TREE[a][j][4] if $game_actors[a].skill_learn?($data_skills[skill_id]) colors = hp_gauge_color1 else colors = text_color(8) end contents.fill_rect(58+branch*54,27+(order-1)*41,3,12,colors) if before == 8 contents.fill_rect(58+branch*54,27+order*41,3,12,colors) if before == 2 end elsif before == 4 || before == 6 for j in (0..loopx) next if TREE[a][j][0] != $game_variables[TREE_ID] next if branch != (TREE[a][j][1] - 1) && before == 6 next if branch != (TREE[a][j][1] + 1) && before == 4 next if order != TREE[a][j][2] skill_id = TREE[a][j][4] if $game_actors[a].skill_learn?($data_skills[skill_id]) colors = hp_gauge_color1 else colors = text_color(8) end contents.fill_rect(22+branch*54,15+order*41,24,3,colors) if before == 4 contents.fill_rect(22+(branch+1)*54,15+order*41,24,3,colors) if before == 6 end end end chr = $game_actors[a] draw_character(chr.character_name, chr.character_index, 16, 32) end #-------------------------------------------------------------------------- # ● ヘルプウィンドウ更新メソッドの呼び出し #-------------------------------------------------------------------------- def call_update_help update_help if active && @help_window end #-------------------------------------------------------------------------- # ● ヘルプウィンドウの更新 #-------------------------------------------------------------------------- def update_help @help_window.clear @help_window.set_item($data_skills[current_ext[0]]) unless current_ext == nil end end #============================================================================== # ■ Window_info #============================================================================== class Window_info < Window_Base include Hi_ru_Skilltree attr_accessor :current_ext #-------------------------------------------------------------------------- # ● 現在情報の設定 #-------------------------------------------------------------------------- def current_ext=(current_ext) return if @current_ext == current_ext @current_ext = current_ext refresh end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh contents.clear unless current_ext == nil change_color(normal_color) @stype_id = $data_skills[current_ext[0]].stype_id draw_text(0,0, 54, 24," #{$data_system.skill_types[@stype_id]}:") draw_text(54,0, 180, 24, $data_skills[current_ext[0]].name) $game_variables[CURRENT] = [] $game_variables[CURRENT] = [current_ext[0],current_ext[1],current_ext[2],current_ext[3],current_ext[4],current_ext[5]] change_color(mp_cost_color) draw_text(260,0, Graphics.width, 24, $data_skills[current_ext[0]].mp_cost) change_color(normal_color) draw_text(288,0, Graphics.width, 24, "/") change_color(tp_cost_color) draw_text(300,0, Graphics.width, 24, $data_skills[current_ext[0]].tp_cost) change_color(normal_color) draw_text(348,0,Graphics.width, 24,"SP:") self.contents.font.size = 24 sizex = 27 sizex = 18 if current_ext[1] >= 10 sizex = 9 if current_ext[1] >= 100 sizex = 0 if current_ext[1] >= 1000 draw_text(390+sizex,0,48, 24, current_ext[1]) self.contents.font.size = 28 draw_text(430,0,Graphics.width, 24, "/") draw_text(440,0,Graphics.width, 24, $game_actors[$game_variables[VARIABLES]].skill_point) self.contents.font.size = 24 draw_text(0,24,Graphics.width,24," Q,W键:切换角色 S,D键:切换技能树") end end end #============================================================================== # ■ Window_Skillpoint_Task #------------------------------------------------------------------------------ # スキルの習得に関する選択肢を表示するウィンドウです。 #============================================================================== class Window_Skillpoint_Task < Window_Command include Hi_ru_Skilltree #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y) super(x, y) end #-------------------------------------------------------------------------- # ● ウィンドウ幅の取得 #-------------------------------------------------------------------------- def window_width return 240 end #-------------------------------------------------------------------------- # ● 決定ボタンが押されたときの処理 #-------------------------------------------------------------------------- def process_ok if current_item_enabled? Input.update deactivate call_ok_handler else Sound.play_buzzer end end #-------------------------------------------------------------------------- # ● コマンドリストの作成 #-------------------------------------------------------------------------- def make_command_list a = $game_variables[VARIABLES] loopx = TREE[a].size - 1 can = false branch = $game_variables[CURRENT][2] order = $game_variables[CURRENT][3] before = $game_variables[CURRENT][4] if before == 2 || before == 8 for j in (0..loopx) next if TREE[a][j][0] != $game_variables[TREE_ID] #現在のツリー以外を無視 next if branch != TREE[a][j][1] next if order != (TREE[a][j][2] - 1) && before == 2 next if order != (TREE[a][j][2] + 1) && before == 8 skill_id = TREE[a][j][4] if $game_actors[a].skill_learn?($data_skills[skill_id]) can = true end end end if before == 4 || before == 6 for j in (0..loopx) next if TREE[a][j][0] != $game_variables[TREE_ID] #現在のツリー以外を無視 next if branch != (TREE[a][j][1] - 1) && before == 6 next if branch != (TREE[a][j][1] + 1) && before == 4 next if order != TREE[a][j][2] skill_id = TREE[a][j][4] if $game_actors[a].skill_learn?($data_skills[skill_id]) can = true end end end can = true if before == 0 if can == true unless $game_actors[$game_variables[VARIABLES]].skill_learn?($data_skills[$game_variables[CURRENT][0]]) if $game_variables[CURRENT][5] > $game_actors[a].level add_command("等级不足", :ok, false, 1) elsif $game_actors[$game_variables[VARIABLES]].skill_point >= $game_variables[CURRENT][1] add_command("学习该技能!", :ok, true, 1) else add_command("技能点不足", :ok, false, 1) end else add_command("已经学会该技能了", :ok, false, 1) end else add_command("需要前提技能", :ok, false, 1) end add_command("取消", :ok, true, 2) end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh clear_command_list make_command_list create_contents self.height = window_height select(0) super end end class Window_Skill_learn < Window_Command include Hi_ru_Skilltree #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y) super(x, y) end #-------------------------------------------------------------------------- # ● ウィンドウ幅の取得 #-------------------------------------------------------------------------- def window_width 360 end #-------------------------------------------------------------------------- # ● ウィンドウ高さの取得 #-------------------------------------------------------------------------- def window_height 72 end #-------------------------------------------------------------------------- # ● 項目の幅を取得 #-------------------------------------------------------------------------- def item_width 1 end #-------------------------------------------------------------------------- # ● 項目の高さを取得 #-------------------------------------------------------------------------- def item_height 1 end #-------------------------------------------------------------------------- # ● コマンドリストの作成 #-------------------------------------------------------------------------- def make_command_list add_command("", :ok, true, 1) #エラー回避 end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh clear_command_list make_command_list create_contents self.height = window_height select(0) super draw_learn Audio.me_stop Audio.me_play(SKILL_LEARN_ME, SKILL_LEARN_VOLUME, SKILL_LEARN_PITCH) end #-------------------------------------------------------------------------- # ● 各種描画 #-------------------------------------------------------------------------- def draw_learn icon_index = $data_skills[$game_variables[CURRENT][0]].icon_index draw_icon(icon_index,0,0,true) draw_text(32,0,320,24,$data_skills[$game_variables[CURRENT][0]].name + " 已被学会!") draw_text(80,24,200,24,"SP") draw_text(120,24,48,24,$game_actors[$game_variables[VARIABLES]].skill_point + $game_variables[CURRENT][1]) draw_text(160,24,24,24,"→") draw_text(190,24,48,24,$game_actors[$game_variables[VARIABLES]].skill_point) end end #============================================================================== # ■ Scene_Menu #------------------------------------------------------------------------------ # メニュー画面の処理を行うクラスです。 #============================================================================== class Scene_Menu < Scene_MenuBase #-------------------------------------------------------------------------- # ● コマンドウィンドウの作成 #-------------------------------------------------------------------------- alias skilltree_create_command_window create_command_window def create_command_window skilltree_create_command_window @command_window.set_handler(:skill_tree_go, method(:command_skill_tree)) end #-------------------------------------------------------------------------- # ○ コマンド[スキルツリー] #-------------------------------------------------------------------------- def command_skill_tree SceneManager.call(Scene_Skilltree) end end #============================================================================== # ■ Window_MenuCommand #------------------------------------------------------------------------------ # メニュー画面で表示するコマンドウィンドウです。 #============================================================================== class Window_MenuCommand #-------------------------------------------------------------------------- # ● 独自コマンドの追加用 #-------------------------------------------------------------------------- alias skilltree_add_original_commands add_original_commands def add_original_commands skilltree_add_original_commands if $game_switches[Hi_ru_Skilltree::MENU_SWITCH] add_command(Hi_ru_Skilltree::MENU_COMMAND, :skill_tree_go, true) end end end
#===============================================================================
#★ RGSS3 技能树(本体) Verα2.00(角色設定型) by ヒール
#-------------------------------------------------------------------------------
# 请将本脚本放在"技能树ーα2.00(设定)"之下。
# 无需改变此脚本。(可以设定用语)
#==============================================================================
# ■ Game_Actor [class]
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ○ モジュールの設定
#--------------------------------------------------------------------------
include Hi_ru_Skilltree
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :skill_point
#--------------------------------------------------------------------------
# ● セットアップ [エイリアス]
# actor_id : アクター ID
#--------------------------------------------------------------------------
alias setup_skill_point setup
def setup(actor_id)
setup_skill_point(actor_id)
setup_skillpoint
end
#--------------------------------------------------------------------------
# ○ SPのセットアップ
#--------------------------------------------------------------------------
def setup_skillpoint
@skill_point = SP_DEFAULT
end
#--------------------------------------------------------------------------
# ● レベルアップ
#--------------------------------------------------------------------------
alias level_up_skill_point level_up
def level_up
level_up_skill_point
@skill_point += SP_LEVELUP
end
end
#===============================================================================
# ■ Scene_Skill_tree
#===============================================================================
class Scene_Skilltree < Scene_MenuBase
include Hi_ru_Skilltree
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
def start
super
$game_variables[VARIABLES] = $game_party.members[0].actor.id #先頭のアクターで開始
$game_variables[TREE_ID] = 0
create_help_window
create_task_window
#create_learn_window スキル習得ウインドウのみ直前で生成
create_info_window
create_tree_window
window_setting
end
#--------------------------------------------------------------------------
# ● ヘルプウィンドウの作成
#--------------------------------------------------------------------------
def create_help_window
@help_window = Window_Help.new
@help_window.viewport = @viewport
end
#--------------------------------------------------------------------------
# ● スキル習得ウインドウの作成
#--------------------------------------------------------------------------
def create_learn_window
wx = Graphics.width / 2 - 180
wy = Graphics.height / 2 - 60
@learn_window = Window_Skill_learn.new(wx, wy)
@learn_window.unselect
@learn_window.deactivate
@learn_window.z += 100
@learn_window.hide
@learn_window.set_handler(:ok, method(:learn_ok))
end
#--------------------------------------------------------------------------
# ● タスクウィンドウの作成
#--------------------------------------------------------------------------
def create_task_window
wx = (Graphics.width - 180)/2
wy = 64
@task_window = Window_Skillpoint_Task.new(wx, wy)
@task_window.unselect
@task_window.deactivate
@task_window.z += 100
@task_window.hide
@task_window.set_handler(:cancel, method(:task_cancel))
@task_window.set_handler(:ok, method(:task_ok))
end
#--------------------------------------------------------------------------
# ● インフォメーションウインドウの作成
#--------------------------------------------------------------------------
def create_info_window
@info_window = Window_info.new(0,Graphics.height-72,Graphics.width,72)
end
#--------------------------------------------------------------------------
# ● ツリーウインドウの作成
#--------------------------------------------------------------------------
def create_tree_window
@tree_window = Window_tree.new(0,72,200)
@tree_window.set_handler(:cancel, method(:tree_cancel))
@tree_window.set_handler(:ok, method(:call_task))
@tree_window.set_handler(:pageup, method(:treeq_downpage))
@tree_window.set_handler(:pagedown, method(:treew_nextpage))
@tree_window.set_handler(:treeup, method(:tree_up))
@tree_window.set_handler(:treedown, method(:tree_down))
end
#--------------------------------------------------------------------------
# ● ウィンドウのセット
#--------------------------------------------------------------------------
def window_setting
@tree_window.help_window = @help_window
@tree_window.info_window = @info_window
@info_window.current_ext = @tree_window.current_ext
end
#--------------------------------------------------------------------------
# ● スキル選択ウインドウ[キャンセル]
#--------------------------------------------------------------------------
def tree_cancel
return_scene
end
#--------------------------------------------------------------------------
# ● タスクウィンドウ呼び出し
#--------------------------------------------------------------------------
def call_task
@tree_window.deactivate
@task_window.show
@task_window.activate
@task_window.refresh
@task_window.select(0)
end
#--------------------------------------------------------------------------
# ● アクターの切り替え
#--------------------------------------------------------------------------
def treeq_downpage
$game_variables[TREE_ID] = 0
chara_current = $game_variables[VARIABLES]
loopx = $game_party.members.size - 1
for i in 0..loopx
if chara_current == $game_party.members[i].actor.id
unless i == 0
chara_next = $game_party.members[i-1].actor.id
else
chara_next = $game_party.members[loopx].actor.id
end
break
end
end
$game_variables[VARIABLES] = chara_next
@help_window.refresh
@info_window.refresh
@tree_window.refresh
@tree_window.select(0)
end
#--------------------------------------------------------------------------
# ● アクターの切り替え
#--------------------------------------------------------------------------
def treew_nextpage
$game_variables[TREE_ID] = 0
chara_current = $game_variables[VARIABLES]
loopx = $game_party.members.size - 1
for i in 0..loopx
if chara_current == $game_party.members[i].actor.id
unless i == loopx
chara_next = $game_party.members[i+1].actor.id
else
chara_next = $game_party.members[0].actor.id
end
break
end
end
$game_variables[VARIABLES] = chara_next
@help_window.refresh
@info_window.refresh
@tree_window.refresh
@tree_window.select(0)
end
#--------------------------------------------------------------------------
# ● ツリーの切り替え
#--------------------------------------------------------------------------
def tree_up
@help_window.refresh
@info_window.refresh
@tree_window.refresh
@tree_window.select(0)
end
#--------------------------------------------------------------------------
# ● ツリーの切り替え
#--------------------------------------------------------------------------
def tree_down
@help_window.refresh
@info_window.refresh
@tree_window.refresh
@tree_window.select(0)
end
#--------------------------------------------------------------------------
# ● タスクウィンドウの消去
#--------------------------------------------------------------------------
def close_task
@task_window.hide
@task_window.deactivate
end
#--------------------------------------------------------------------------
# ● スキル習得ウィンドウ呼び出し
#--------------------------------------------------------------------------
def call_learn
@learn_window.show
@learn_window.activate
@learn_window.refresh
@learn_window.select(0)
end
#--------------------------------------------------------------------------
# ● スキル習得ウィンドウの消去
#--------------------------------------------------------------------------
def close_learn
@learn_window.hide
@learn_window.deactivate
end
#--------------------------------------------------------------------------
# ● スキル習得ウィンドウ[決定]
#--------------------------------------------------------------------------
def learn_ok
case @learn_window.index
when 0
close_learn
@tree_window.activate
@help_window.refresh
@info_window.refresh
@tree_window.refresh
end
end
#--------------------------------------------------------------------------
# ● タスクウィンドウ[習得する]
#--------------------------------------------------------------------------
def task_ok
case @task_window.index
when 0
$game_actors[$game_variables[VARIABLES]].learn_skill($game_variables[CURRENT][0])
$game_actors[$game_variables[VARIABLES]].skill_point -= $game_variables[CURRENT][1]
close_task
@help_window.refresh
@info_window.refresh
@tree_window.refresh
create_learn_window
call_learn
when 1
close_task
@tree_window.activate
@help_window.refresh
@info_window.refresh
@tree_window.refresh
end
end
#--------------------------------------------------------------------------
# ● タスクウィンドウ[キャンセル]
#--------------------------------------------------------------------------
def task_cancel
close_task
@tree_window.activate
@help_window.refresh
@tree_window.refresh
@tree_window.refresh
end
end
#==============================================================================
# ■ Window_tree
#------------------------------------------------------------------------------
# メイン部分のウインドウです。
#==============================================================================
class Window_tree< Window_Command
include Hi_ru_Skilltree
attr_accessor :info_window
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x,y,height)
@window_height = 292
super(x,y)
end
#--------------------------------------------------------------------------
# ● 桁数の取得
#--------------------------------------------------------------------------
def col_max
return 9
end
#--------------------------------------------------------------------------
# ● 横に項目が並ぶときの空白の幅を取得
#--------------------------------------------------------------------------
def spacing
return 28
end
#--------------------------------------------------------------------------
# ● 項目の幅を取得
#--------------------------------------------------------------------------
def item_width
26
end
#--------------------------------------------------------------------------
# ● 項目の高さを取得
#--------------------------------------------------------------------------
def item_height
26
end
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
Graphics.width
end
#--------------------------------------------------------------------------
# ● ウィンドウ高さの取得
#--------------------------------------------------------------------------
def window_height
Graphics.height - 144
end
#--------------------------------------------------------------------------
# ● カーソルの更新
#--------------------------------------------------------------------------
def update_cursor
#カーソル描画フラグ
@flag_cursor = 1
if @cursor_all
cursor_rect.set(0, 0, contents.width, row_max * item_height)
self.top_row = 0
elsif @index < 0
cursor_rect.empty
else
ensure_cursor_visible
cursor_rect.set(item_rect(@index))
end
#カーソル描画フラグ
@flag_cursor = 0
end
#--------------------------------------------------------------------------
# ● 項目を描画する矩形の取得
#--------------------------------------------------------------------------
def item_rect(index)
if @flag_cursor == 1
draw_x = 0
else
draw_x = 40
end
rect = Rect.new
rect.width = item_width - draw_x
rect.height = item_height
rect.x = index % col_max * (item_width + spacing) + draw_x + 48
rect.y = index / col_max * (item_height + spacing/2 +1)
rect
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
change_color(normal_color, command_enabled?(index))
draw_text(item_rect_for_text(index), command_name(index), alignment)
end
#--------------------------------------------------------------------------
# ● コマンドリストの作成
#--------------------------------------------------------------------------
def make_command_list
a = $game_variables[VARIABLES]
loopx = TREE[a].size - 1
check = []
exts = []
for j in (0..loopx)
next if TREE[a][j][0] != $game_variables[TREE_ID]
branch = TREE[a][j][1]
order = TREE[a][j][2]
before = TREE[a][j][3]
ext = [TREE[a][j][4],TREE[a][j][5],branch,order,before,TREE[a][j][6]]
calculate = 9 * order + branch + 1
check[calculate] = true if branch <= 8
exts[calculate] = ext
end
for i in (1..54)
add_command("", :ok, check[i],exts[i])
end
end
#--------------------------------------------------------------------------
# ● 決定やキャンセルなどのハンドリング処理
#--------------------------------------------------------------------------
def process_handling
return unless open? && active
return process_ok if ok_enabled? && Input.trigger?(:C)
return process_cancel if cancel_enabled? && Input.trigger?(:B)
return process_pagedown if handle?(:pagedown) && Input.trigger?(:R)
return process_pageup if handle?(:pageup) && Input.trigger?(:L)
return process_treeup if Input.trigger?(:Y)
return process_treedown if Input.trigger?(:Z)
end
#--------------------------------------------------------------------------
# ● カーソル位置の設定
#--------------------------------------------------------------------------
def index=(index)
@index = index
update_cursor
call_update_help
@info_window.current_ext = current_ext if @info_window
end
#--------------------------------------------------------------------------
# ● カーソルを下に移動
#--------------------------------------------------------------------------
def cursor_down(wrap = false)
if index < item_max - col_max || (wrap && col_max == 1)
select((index + col_max) % item_max)
for c in 1..100
if current_item_enabled?
break
end
select((index + col_max) % item_max)
end
end
end
#--------------------------------------------------------------------------
# ● カーソルを上に移動
#--------------------------------------------------------------------------
def cursor_up(wrap = false)
if index >= col_max || (wrap && col_max == 1)
select((index - col_max + item_max) % item_max)
for c in 1..100
if current_item_enabled?
break
end
select((index - col_max + item_max) % item_max)
end
end
end
#--------------------------------------------------------------------------
# ● カーソルを右に移動
#--------------------------------------------------------------------------
def cursor_right(wrap = false)
if col_max >= 2 && (index < item_max - 1 || (wrap && horizontal?))
select((index + 1) % item_max)
for c in 1..100
if current_item_enabled?
break
end
select((index + 1) % item_max)
end
end
end
#--------------------------------------------------------------------------
# ● カーソルを左に移動
#--------------------------------------------------------------------------
def cursor_left(wrap = false)
if col_max >= 2 && (index > 0 || (wrap && horizontal?))
select((index - 1 + item_max) % item_max)
for c in 1..100
if current_item_enabled?
break
end
select((index - 1 + item_max) % item_max)
end
end
end
#--------------------------------------------------------------------------
# ● L ボタン(PageUp)が押されたときの処理
#--------------------------------------------------------------------------
def process_pageup
Sound.play_cursor
Input.update
call_handler(:pageup)
end
#--------------------------------------------------------------------------
# ● R ボタン(PageDown)が押されたときの処理
#--------------------------------------------------------------------------
def process_pagedown
Sound.play_cursor
Input.update
call_handler(:pagedown)
end
#--------------------------------------------------------------------------
# ● Y ボタン(TreeUp)が押されたときの処理
#--------------------------------------------------------------------------
def process_treeup
a = $game_variables[VARIABLES]
loopx = TREE[a].size - 1
tree_next = 0
for i in (0..loopx)
tree_next = TREE[a][i][0] if tree_next < TREE[a][i][0]
end
unless $game_variables[TREE_ID] == 0
$game_variables[TREE_ID] -= 1
else
$game_variables[TREE_ID] = tree_next
end
Sound.play_cursor
Input.update
call_handler(:treeup)
end
#--------------------------------------------------------------------------
# ● Z ボタン(TreeDown)が押されたときの処理
#--------------------------------------------------------------------------
def process_treedown
a = $game_variables[VARIABLES]
loopx = TREE[a].size - 1
tree_next = 0
for i in (0..loopx)
tree_next = TREE[a][i][0] if tree_next < TREE[a][i][0]
end
unless $game_variables[TREE_ID] == tree_next
$game_variables[TREE_ID] += 1
else
$game_variables[TREE_ID] = 0
end
Sound.play_cursor
Input.update
call_handler(:treedown)
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
clear_command_list
make_command_list
create_contents
super
draw_icon_bar
end
#--------------------------------------------------------------------------
# ● 各種描画
#--------------------------------------------------------------------------
def draw_icon_bar
a = $game_variables[VARIABLES]
loopx = TREE[a].size - 1
d = $game_actors[a].level
self.contents.font.size = 16
for i in (0..loopx)
next if TREE[a][i][0] != $game_variables[TREE_ID]
branch = TREE[a][i][1] * 54
order = TREE[a][i][2] * 41
skill_id = TREE[a][i][4]
icon_index = $data_skills[skill_id].icon_index
if $game_actors[a].skill_learn?($data_skills[skill_id])
learn = true
else
learn = false
end
change_color(text_color(LEVEL_COLOR))
draw_text(branch+40,order-2, 30, 24,TREE[a][i][6]) if d < TREE[a][i][6] && TREE[a][i][6] >= 1 && TREE[a][i][6] <10
draw_text(branch+34,order-2, 30, 24,TREE[a][i][6]) if d < TREE[a][i][6] && TREE[a][i][6] >= 10 && TREE[a][i][6] <100
draw_text(branch+28,order-2, 30, 24,TREE[a][i][6]) if d < TREE[a][i][6] && TREE[a][i][6] >= 100
draw_icon(icon_index,48+branch,order,learn)
end
change_color(normal_color)
for i in (0..loopx)
next if TREE[a][i][0] != $game_variables[TREE_ID] #現在のツリー以外を無視
branch = TREE[a][i][1]
order = TREE[a][i][2]
before = TREE[a][i][3]
if before == 2 || before == 8
for j in (0..loopx)
next if TREE[a][j][0] != $game_variables[TREE_ID] #現在のツリー以外を無視
next if branch != TREE[a][j][1]
next if order != (TREE[a][j][2] - 1) && before == 2
next if order != (TREE[a][j][2] + 1) && before == 8
skill_id = TREE[a][j][4]
if $game_actors[a].skill_learn?($data_skills[skill_id])
colors = hp_gauge_color1
else
colors = text_color(8)
end
contents.fill_rect(58+branch*54,27+(order-1)*41,3,12,colors) if before == 8
contents.fill_rect(58+branch*54,27+order*41,3,12,colors) if before == 2
end
elsif before == 4 || before == 6
for j in (0..loopx)
next if TREE[a][j][0] != $game_variables[TREE_ID]
next if branch != (TREE[a][j][1] - 1) && before == 6
next if branch != (TREE[a][j][1] + 1) && before == 4
next if order != TREE[a][j][2]
skill_id = TREE[a][j][4]
if $game_actors[a].skill_learn?($data_skills[skill_id])
colors = hp_gauge_color1
else
colors = text_color(8)
end
contents.fill_rect(22+branch*54,15+order*41,24,3,colors) if before == 4
contents.fill_rect(22+(branch+1)*54,15+order*41,24,3,colors) if before == 6
end
end
end
chr = $game_actors[a]
draw_character(chr.character_name, chr.character_index, 16, 32)
end
#--------------------------------------------------------------------------
# ● ヘルプウィンドウ更新メソッドの呼び出し
#--------------------------------------------------------------------------
def call_update_help
update_help if active && @help_window
end
#--------------------------------------------------------------------------
# ● ヘルプウィンドウの更新
#--------------------------------------------------------------------------
def update_help
@help_window.clear
@help_window.set_item($data_skills[current_ext[0]]) unless current_ext == nil
end
end
#==============================================================================
# ■ Window_info
#==============================================================================
class Window_info < Window_Base
include Hi_ru_Skilltree
attr_accessor :current_ext
#--------------------------------------------------------------------------
# ● 現在情報の設定
#--------------------------------------------------------------------------
def current_ext=(current_ext)
return if @current_ext == current_ext
@current_ext = current_ext
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
unless current_ext == nil
change_color(normal_color)
@stype_id = $data_skills[current_ext[0]].stype_id
draw_text(0,0, 54, 24," #{$data_system.skill_types[@stype_id]}:")
draw_text(54,0, 180, 24, $data_skills[current_ext[0]].name)
$game_variables[CURRENT] = []
$game_variables[CURRENT] = [current_ext[0],current_ext[1],current_ext[2],current_ext[3],current_ext[4],current_ext[5]]
change_color(mp_cost_color)
draw_text(260,0, Graphics.width, 24, $data_skills[current_ext[0]].mp_cost)
change_color(normal_color)
draw_text(288,0, Graphics.width, 24, "/")
change_color(tp_cost_color)
draw_text(300,0, Graphics.width, 24, $data_skills[current_ext[0]].tp_cost)
change_color(normal_color)
draw_text(348,0,Graphics.width, 24,"SP:")
self.contents.font.size = 24
sizex = 27
sizex = 18 if current_ext[1] >= 10
sizex = 9 if current_ext[1] >= 100
sizex = 0 if current_ext[1] >= 1000
draw_text(390+sizex,0,48, 24, current_ext[1])
self.contents.font.size = 28
draw_text(430,0,Graphics.width, 24, "/")
draw_text(440,0,Graphics.width, 24, $game_actors[$game_variables[VARIABLES]].skill_point)
self.contents.font.size = 24
draw_text(0,24,Graphics.width,24," Q,W键:切换角色 S,D键:切换技能树")
end
end
end
#==============================================================================
# ■ Window_Skillpoint_Task
#------------------------------------------------------------------------------
# スキルの習得に関する選択肢を表示するウィンドウです。
#==============================================================================
class Window_Skillpoint_Task < Window_Command
include Hi_ru_Skilltree
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y)
end
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
return 240
end
#--------------------------------------------------------------------------
# ● 決定ボタンが押されたときの処理
#--------------------------------------------------------------------------
def process_ok
if current_item_enabled?
Input.update
deactivate
call_ok_handler
else
Sound.play_buzzer
end
end
#--------------------------------------------------------------------------
# ● コマンドリストの作成
#--------------------------------------------------------------------------
def make_command_list
a = $game_variables[VARIABLES]
loopx = TREE[a].size - 1
can = false
branch = $game_variables[CURRENT][2]
order = $game_variables[CURRENT][3]
before = $game_variables[CURRENT][4]
if before == 2 || before == 8
for j in (0..loopx)
next if TREE[a][j][0] != $game_variables[TREE_ID] #現在のツリー以外を無視
next if branch != TREE[a][j][1]
next if order != (TREE[a][j][2] - 1) && before == 2
next if order != (TREE[a][j][2] + 1) && before == 8
skill_id = TREE[a][j][4]
if $game_actors[a].skill_learn?($data_skills[skill_id])
can = true
end
end
end
if before == 4 || before == 6
for j in (0..loopx)
next if TREE[a][j][0] != $game_variables[TREE_ID] #現在のツリー以外を無視
next if branch != (TREE[a][j][1] - 1) && before == 6
next if branch != (TREE[a][j][1] + 1) && before == 4
next if order != TREE[a][j][2]
skill_id = TREE[a][j][4]
if $game_actors[a].skill_learn?($data_skills[skill_id])
can = true
end
end
end
can = true if before == 0
if can == true
unless $game_actors[$game_variables[VARIABLES]].skill_learn?($data_skills[$game_variables[CURRENT][0]])
if $game_variables[CURRENT][5] > $game_actors[a].level
add_command("等级不足", :ok, false, 1)
elsif $game_actors[$game_variables[VARIABLES]].skill_point >= $game_variables[CURRENT][1]
add_command("学习该技能!", :ok, true, 1)
else
add_command("技能点不足", :ok, false, 1)
end
else
add_command("已经学会该技能了", :ok, false, 1)
end
else
add_command("需要前提技能", :ok, false, 1)
end
add_command("取消", :ok, true, 2)
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
clear_command_list
make_command_list
create_contents
self.height = window_height
select(0)
super
end
end
class Window_Skill_learn < Window_Command
include Hi_ru_Skilltree
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y)
end
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
360
end
#--------------------------------------------------------------------------
# ● ウィンドウ高さの取得
#--------------------------------------------------------------------------
def window_height
72
end
#--------------------------------------------------------------------------
# ● 項目の幅を取得
#--------------------------------------------------------------------------
def item_width
1
end
#--------------------------------------------------------------------------
# ● 項目の高さを取得
#--------------------------------------------------------------------------
def item_height
1
end
#--------------------------------------------------------------------------
# ● コマンドリストの作成
#--------------------------------------------------------------------------
def make_command_list
add_command("", :ok, true, 1) #エラー回避
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
clear_command_list
make_command_list
create_contents
self.height = window_height
select(0)
super
draw_learn
Audio.me_stop
Audio.me_play(SKILL_LEARN_ME, SKILL_LEARN_VOLUME, SKILL_LEARN_PITCH)
end
#--------------------------------------------------------------------------
# ● 各種描画
#--------------------------------------------------------------------------
def draw_learn
icon_index = $data_skills[$game_variables[CURRENT][0]].icon_index
draw_icon(icon_index,0,0,true)
draw_text(32,0,320,24,$data_skills[$game_variables[CURRENT][0]].name + " 已被学会!")
draw_text(80,24,200,24,"SP")
draw_text(120,24,48,24,$game_actors[$game_variables[VARIABLES]].skill_point + $game_variables[CURRENT][1])
draw_text(160,24,24,24,"→")
draw_text(190,24,48,24,$game_actors[$game_variables[VARIABLES]].skill_point)
end
end
#==============================================================================
# ■ Scene_Menu
#------------------------------------------------------------------------------
# メニュー画面の処理を行うクラスです。
#==============================================================================
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# ● コマンドウィンドウの作成
#--------------------------------------------------------------------------
alias skilltree_create_command_window create_command_window
def create_command_window
skilltree_create_command_window
@command_window.set_handler(:skill_tree_go, method(:command_skill_tree))
end
#--------------------------------------------------------------------------
# ○ コマンド[スキルツリー]
#--------------------------------------------------------------------------
def command_skill_tree
SceneManager.call(Scene_Skilltree)
end
end
#==============================================================================
# ■ Window_MenuCommand
#------------------------------------------------------------------------------
# メニュー画面で表示するコマンドウィンドウです。
#==============================================================================
class Window_MenuCommand
#--------------------------------------------------------------------------
# ● 独自コマンドの追加用
#--------------------------------------------------------------------------
alias skilltree_add_original_commands add_original_commands
def add_original_commands
skilltree_add_original_commands
if $game_switches[Hi_ru_Skilltree::MENU_SWITCH]
add_command(Hi_ru_Skilltree::MENU_COMMAND, :skill_tree_go, true)
end
end
end
设定了10号角色没有技能树
然后进游戏加入10号角色后打开技能树会显示
求助这是因为什么问题……
|
|