| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 5 |
| 经验 | |
| 最后登录 | 2021-7-3 |
| 在线时间 | 141 小时 |
- 梦石
- 0
- 星屑
- 518
- 在线时间
- 141 小时
- 注册时间
- 2016-12-17
- 回帖
- 33
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 RaidenInfinity 于 2017-1-5 18:20 编辑
我把以下脚本装上了,可是在菜单中找不到脚本介面,
是要修改或增加些什么才能在菜单中呼叫出介面吗?求指教,谢谢!
[fold=スキルツリー(設定)]
[pre lang="ruby"]
#===============================================================================
#★ RGSS3 スキルツリー(設定) Ver1.01 by ヒール
#-------------------------------------------------------------------------------
#スキルツリーによるスキル習得を実装するスクリプトです。
#新たなステータスSPを消費する事でスキルを習得できます。
#-------------------------------------------------------------------------------
#各アクターのSPは以下のような記述で参照・操作できます。
#$game_variables[x] = $game_actors[アクターID].skill_point (変数x番に代入)
#$game_actors[アクターID].skill_point += 10(SPを10増加)
#
#上記の$game_actors[アクターID].skill_pointではなく、下記の記述でもできます。
#※パーティ番号0で先頭のアクターになります。
#$game_party.members[パーティ番号].skill_point
#-------------------------------------------------------------------------------
#Ver1.01 同アクターの別ツリーのスキルの習得が他のツリーのスキルの習得を可能にしていた不具合を修正しました。
#===============================================================================
module Hi_ru_Skilltree
SKILL_LEARN_ME = 'Audio/ME/Item' #スキル習得時のME
SKILL_LEARN_VOLUME = 100 #MEの音量
SKILL_LEARN_PITCH = 110 #MEのピッチピッチ
TREE =[]
TREE[0] = nil #アクターID0は無い
#メニューコマンドに追加するためのスイッチの「スイッチ番号」です。
#このスイッチがONの時、メニューコマンドにスキルツリーコマンドが追加されます。
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
#これより下は各アクターの設定です。
#参考画像や参考テキストを見て、必要なように入力してください。
#ツリーのサイズは縦6×横9(計54)なので、
#「縦番号+追加縦番号」は5以下、横番号は8以下にしてください。
#1つの箇所に複数の設定を行わないでください。正常に動作しなくなります。
#TREE[アクターID] = [
#[ツリー番号,縦番号,横番号,追加縦番号,スキルID,消費SP],
#]
#
#アクターID1番の設定
TREE[1] =[
[ 0, 0, 0, 0, 10, 5],
[ 0, 1, 0, 0, 11, 6],
[ 0, 2, 0, 0, 12, 7],
[ 0, 3, 0, 0, 13, 8],
[ 0, 4, 0, 0, 14, 9],
[ 0, 5, 0, 0, 15, 15],
[ 0, 0, 1, 0, 16, 10],
[ 0, 0, 2, 0, 17, 12],
[ 0, 0, 3, 0, 18, 14],
[ 0, 0, 4, 0, 19, 16],
[ 0, 0, 5, 0, 20, 18],
[ 0, 0, 6, 0, 21, 20],
[ 0, 0, 7, 0, 22, 24],
[ 0, 0, 8, 0, 23, 28],
[ 0, 1, 1, 0, 24, 8],
[ 0, 1, 2, 0, 25, 10],
[ 0, 1, 3, 0, 26, 14],
[ 0, 1, 4, 0, 27, 18],
[ 0, 2, 1, 0, 28, 10],
[ 0, 2, 2, 0, 29, 13],
[ 0, 2, 3, 0, 30, 16],
[ 0, 2, 4, 0, 31, 20],
[ 0, 3, 1, 0, 32, 10],
[ 0, 3, 2, 0, 33, 13],
[ 0, 3, 3, 0, 34, 16],
[ 0, 3, 4, 0, 35, 20],
[ 0, 4, 1, 0, 36, 10],
[ 0, 4, 2, 0, 37, 13],
[ 0, 4, 3, 0, 38, 16],[ 0, 4, 4, 0, 39, 20], #一行に複数書いてもOKです。
[ 0, 5, 1, 0, 40, 10],
[ 0, 5, 2, 0, 41, 13],
[ 0, 5, 3, 0, 42, 16],
[ 0, 5, 4, 0, 43, 20],
[ 0, 5, 5, 0, 44, 25],
[ 0, 5, 6, 0, 45, 30],
[ 0, 5, 7, 0, 46, 35],
[ 0, 5, 8, 0, 47, 40],
[ 0, 0, 8, 1, 48, 10],
[ 0, 0, 8, 2, 49, 13],
[ 0, 0, 8, 3, 50, 16],
[ 0, 0, 8, 4, 51, 20],
[ 0, 4, 5, 0, 52, 16],
[ 0, 4, 6, 0, 53, 20],
[ 0, 0, 7, 1, 54, 10],
[ 0, 0, 7, 2, 55, 13],
[ 0, 0, 7, 3, 56, 16],
[ 0, 4, 7, 0, 57, 16],
[ 0, 3, 5, 0, 58, 16],
[ 0, 3, 6, 0, 59, 16],
[ 0, 2, 5, 0, 60, 16],
[ 0, 0, 5, 1, 61, 16],
[ 0, 0, 6, 1, 62, 16],
[ 0, 0, 6, 2, 63, 16],
#空白行は不要ですが、見やすいです。
[ 1, 0, 0, 0, 64, 5], #2つ目のツリーの設定です。
[ 1, 1, 0, 0, 65, 6],
[ 1, 2, 0, 0, 66, 7],
[ 1, 3, 0, 0, 67, 8],
[ 1, 4, 0, 0, 68, 9],
[ 1, 5, 0, 0, 69, 15],
[ 2, 1, 0, 0, 63, 16],
[ 2, 2, 0, 0, 126, 15],
]
#アクターID2番の設定
TREE[2] =[
[ 0, 0, 0, 0, 80, 5],
[ 0, 1, 0, 0, 81, 6],
[ 0, 2, 0, 0, 82, 7],
[ 0, 3, 0, 0, 83, 8],
[ 0, 4, 0, 0, 84, 9],
[ 0, 5, 0, 0, 85, 15],
[ 0, 0, 1, 0, 86, 10],
[ 0, 0, 2, 0, 87, 12],
[ 0, 0, 3, 0, 88, 14],
[ 0, 0, 4, 0, 89, 16],
[ 0, 0, 5, 0, 90, 18],
[ 0, 0, 6, 0, 91, 20],
[ 0, 0, 7, 0, 92, 24],
[ 0, 0, 8, 0, 93, 28],
[ 0, 1, 1, 0, 94, 8],
[ 0, 1, 2, 0, 95, 10],
[ 0, 1, 3, 0, 96, 14],
[ 0, 1, 4, 0, 97, 18],
[ 0, 2, 1, 0, 98, 10],
[ 0, 2, 2, 0, 99, 13],
[ 0, 2, 3, 0, 100, 16],
[ 0, 2, 4, 0, 101, 20],
[ 0, 3, 1, 0, 102, 10],
[ 0, 3, 2, 0, 103, 13],
[ 0, 3, 3, 0, 104, 16],
[ 0, 3, 4, 0, 105, 20],
[ 0, 4, 1, 0, 106, 10],
[ 0, 4, 2, 0, 107, 13],
[ 0, 4, 3, 0, 108, 16],
[ 0, 4, 4, 0, 109, 20],
[ 0, 5, 1, 0, 110, 10],
[ 0, 5, 2, 0, 111, 13],
[ 0, 5, 3, 0, 112, 16],
[ 0, 5, 4, 0, 113, 20],
[ 0, 5, 5, 0, 114, 25],
[ 0, 5, 6, 0, 115, 30],
[ 0, 5, 7, 0, 116, 35],
[ 0, 5, 8, 0, 117, 40],
[ 0, 0, 8, 1, 118, 10],
[ 0, 0, 8, 2, 119, 13],
[ 0, 0, 8, 3, 120, 16],
[ 0, 0, 8, 4, 121, 20],
[ 0, 4, 5, 0, 122, 16],
[ 0, 4, 6, 0, 123, 20],
[ 0, 0, 7, 1, 124, 10],
[ 0, 0, 7, 2, 125, 13],
]
#設定はここまでです。
end
[/pre]
[/fold]
[fold=スキルツリー(本体)]
[pre lang="ruby"]
#===============================================================================
#★ RGSS3 スキルツリー(本体) Ver1.01 by ヒール
#-------------------------------------------------------------------------------
#スキルツリー(設定)よりも下に設置してください。
#こちらには設定項目はありません。
#==============================================================================
# ■ 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.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.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)
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]
order = TREE[a][j][1]
branch1 = TREE[a][j][2]
branch2 = TREE[a][j][3]
ext = [TREE[a][j][4],TREE[a][j][5],order,branch1,branch2]
calculate = 9 * (order + branch2) + branch1 + 1
check[calculate] = true if branch1 <= 8
exts[calculate] = ext
end
for i in (1..54)
add_command("", :ok, check,exts)
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][0] if tree_next < TREE[a][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][0] if tree_next < TREE[a][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
for i in (0..loopx)
next if TREE[a][0] != $game_variables[TREE_ID]
order = TREE[a][1] * 40
branch1 = TREE[a][2] * 54
branch2 = TREE[a][3] * 40
skill_id = TREE[a][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
draw_icon(icon_index,48+branch1,order + branch2,learn)
end
for i in (0..loopx)
next if TREE[a][0] != $game_variables[TREE_ID]
order = TREE[a][1]
branch1 = TREE[a][2]
branch2 = TREE[a][3]
if branch2 != 0
for j in (0..loopx)
next if TREE[a][j][0] != $game_variables[TREE_ID]
next if order != TREE[a][j][1]
next if branch1 != TREE[a][j][2]
next if branch2 != (TREE[a][j][3] + 1)
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+branch1*54,27+(order+branch2-1)*40,3,12,colors)
end
else
if branch1 != 0
for j in (0..loopx)
next if TREE[a][j][0] != $game_variables[TREE_ID]
next if branch2 != TREE[a][j][3]
next if order != TREE[a][j][1]
next if branch1 != (TREE[a][j][2] + 1)
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+branch1*54,15+order*40,24,3,colors)
end
else
for j in (0..loopx)
next if TREE[a][j][0] != $game_variables[TREE_ID]
next if branch1 != TREE[a][j][2]
next if branch2 != TREE[a][j][3]
next if order != (TREE[a][j][1] + 1)
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,27+(order-1)*40,3,12,colors)
end
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]]
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
order = $game_variables[CURRENT][2]
branch1 = $game_variables[CURRENT][3]
branch2 = $game_variables[CURRENT][4]
if branch2 != 0
for j in (0..loopx)
next if TREE[a][j][0] != $game_variables[TREE_ID]
next if order != TREE[a][j][1]
next if branch1 != TREE[a][j][2]
next if branch2 != (TREE[a][j][3] + 1)
skill_id = TREE[a][j][4]
if $game_actors[a].skill_learn?($data_skills[skill_id])
can = true
end
end
else
if branch1 != 0
for j in (0..loopx)
next if TREE[a][j][0] != $game_variables[TREE_ID]
next if branch2 != TREE[a][j][3]
next if order != TREE[a][j][1]
next if branch1 != (TREE[a][j][2] + 1)
skill_id = TREE[a][j][4]
if $game_actors[a].skill_learn?($data_skills[skill_id])
can = true
end
end
else
for j in (0..loopx)
next if TREE[a][j][0] != $game_variables[TREE_ID]
next if branch1 != TREE[a][j][2]
next if branch2 != TREE[a][j][3]
next if order != (TREE[a][j][1] + 1)
skill_id = TREE[a][j][4]
if $game_actors[a].skill_learn?($data_skills[skill_id])
can = true
end
end
end
end
can = true if order == 0 && branch1 == 0 && branch2 == 0
if can == true
unless $game_actors[$game_variables[VARIABLES]].skill_learn?($data_skills[$game_variables[CURRENT][0]])
if $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("1つ前のスキルを習得していません", :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
[/pre]
[/fold] |
评分
-
查看全部评分
|