查看: 5033|回复: 4

[已经解决] 如何做技能树

[复制链接]
梦石
0
星屑
411
在线时间
41 小时
注册时间
2018-4-14
回帖
40
发表于 2018-5-25 18:49:31 | 显示全部楼层 |阅读模式
悬赏17星屑已解决
求大神指导

我想实现一个升一级获得一个技能点,或用变量代替技能点。
用技能点来学习新技能。

最佳答案

查看完整内容

https://rpg.blue/thread-405153-1-1.html https://forums.rpgmakerweb.com/index.php?threads/lune-unlimited-skill-tree.25423/ lune无限技能树,你不会下demo可以私信我要。 tomo技能树: [pre lang="ruby"]# スキルツリーシステムver1.02 # 制作者:TOMO # # ツリー型のスキル習得システムです # # # ※使用方法 # 1.スキルツリー画面の呼び出し # SceneManager.call(Scene_SkillTree) # # 2.スキルポイントの追加 # $game_a ...
梦石
1
星屑
14389
在线时间
2110 小时
注册时间
2017-9-28
回帖
607
发表于 2018-5-25 18:49:32 | 显示全部楼层
本帖最后由 Nil2018 于 2018-5-26 11:58 编辑

https://rpg.blue/thread-405153-1-1.html

https://forums.rpgmakerweb.com/i ... d-skill-tree.25423/
lune无限技能树,你不会下demo可以私信我要。

tomo技能树: skill_tree.jpg
  1. # スキルツリーシステムver1.02
  2. # 制作者:TOMO
  3. #
  4. # ツリー型のスキル習得システムです
  5. #
  6. #
  7. # ※使用方法
  8. # 1.スキルツリー画面の呼び出し
  9. # SceneManager.call(Scene_SkillTree)
  10. #
  11. # 2.スキルポイントの追加
  12. # $game_actors[n].add_skill_point(m)
  13. # (nはアクターID、mは追加ポイント)
  14. #
  15. #
  16. # ※補足
  17. # Skillの武器タイプIDは、特徴の「武器タイプ装備」に対応しています
  18. #
  19. # リストに追加したい場合は、
  20. # 対応する武器タイプを装備可能な状態にして下さい

  21. # ※更新履歴
  22. # ver1.02
  23. #   習得済みスキルの強調表示
  24. #   線の自動生成で合流時に重なるミスを修正
  25. #
  26. # ver1.01
  27. #   スキルポイントが正常加算されないバグ修正
  28. #   習得確認ウィンドウの追加
  29. #   コストウィンドウの表記変更

  30. module TOMO
  31.   module SkillTree
  32.     Skill = {}  # 弄るな!
  33.    
  34.     # スキル名の表示
  35.     Name = true
  36.     # スキル名表示時の横幅
  37.     Width = 144
  38.     # 習得済みスキル用アイコンID
  39.     LearnedIcon = 125
  40.    
  41.     # 各種用語
  42.     SPText = "SP"
  43.     CostText = "消費SP:"
  44.     PremiseText = "前提:"
  45.    
  46.    
  47.     DefaultPoint = 1    # デフォルトの消費スキルポイント
  48.     Point = "2 + level" # スキルポイントの計算式
  49.    
  50.    
  51.     # ツリーデータの設定
  52.     # Skill[武器タイプID] = {
  53.     #   :tree => [[1行目],[2行目],…],
  54.     #   スキルID => {"派生" => [派生先のスキルID],
  55.     #              "前提" => [習得前提スキルID],
  56.     #              "SP" => 習得に必要なポイント,
  57.     #              "反転" => [線を逆にしたい派生先スキルID],}
  58.     # }
  59.     #
  60.     # :tree内で0を指定した場合は、そこを飛ばして表示します
  61.     # "派生"を省略した場合は、線が引かれません
  62.     # "前提"を省略した場合は、ポイント消費だけで習得可能です
  63.     # "SP"を省略した場合は、DefaultPointを参照します
  64.     # "反転"を省略した場合は、線は通常通りです("派生"に無いIDは無効)
  65.     Skill[1] = {
  66.       # ツリー
  67.       :tree => [[0,80],
  68.                 [81,0,82,24],
  69.                 [0,83],
  70.                 [0,84]],
  71.       80 => {"派生" => [81, 82, 24]},
  72.       81 => {"前提" => [80], "派生" => [83]},
  73.       82 => {"前提" => [80], "派生" => [83]},
  74.       83 => {"前提" => [81, 82], "派生" => [84], "SP" => 3},
  75.       84 => {"前提" => [83, 24], "SP" => 5},
  76.       24 => {"前提" => [80], "派生" => [84], "反転" => [84]},
  77.     }
  78.   end
  79. end

  80. class Game_Actor
  81.   attr_accessor   :used_skill_point # 使用済みスキルポイント
  82.   #--------------------------------------------------------------------------
  83.   # ● セットアップ
  84.   #--------------------------------------------------------------------------
  85.   alias tomo_skill_tree_setup setup
  86.   def setup(actor_id)
  87.     @skill_point = 0
  88.     @used_skill_point = 0
  89.     tomo_skill_tree_setup(actor_id)
  90.   end
  91.   #--------------------------------------------------------------------------
  92.   # ● スキルポイントの取得
  93.   #--------------------------------------------------------------------------
  94.   def skill_point
  95.     eval(TOMO::SkillTree::Point) + @skill_point - @used_skill_point
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # ● スキルポイントの追加
  99.   #--------------------------------------------------------------------------
  100.   def add_skill_point(value)
  101.     @skill_point += value
  102.   end
  103. end

  104. class Window_SkillTreeTypes < Window_Command
  105.   attr_reader     :tree_window
  106.   #--------------------------------------------------------------------------
  107.   # ● オブジェクト初期化
  108.   #--------------------------------------------------------------------------
  109.   def initialize(x, y)
  110.     super(x, y)
  111.     @actor = nil
  112.     select(0)
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ● ウィンドウ幅の取得
  116.   #--------------------------------------------------------------------------
  117.   def window_width
  118.     return 172
  119.   end
  120.   #--------------------------------------------------------------------------
  121.   # ● 表示行数の取得
  122.   #--------------------------------------------------------------------------
  123.   def visible_line_number
  124.     return 4
  125.   end
  126.   #--------------------------------------------------------------------------
  127.   # ● アクターの設定
  128.   #--------------------------------------------------------------------------
  129.   def actor=(actor)
  130.     return if @actor == actor
  131.     @actor = actor
  132.     refresh
  133.     select(0)
  134.   end
  135.   #--------------------------------------------------------------------------
  136.   # ● コマンドリストの作成
  137.   #--------------------------------------------------------------------------
  138.   def make_command_list
  139.     if @actor
  140.       $data_system.weapon_types.size.times do |wtype|
  141.         if TOMO::SkillTree::Skill[wtype] && @actor.equip_wtype_ok?(wtype)
  142.           name = $data_system.weapon_types[wtype]
  143.           add_command(name, :tree_type, true, wtype)
  144.         end
  145.       end
  146.     end
  147.   end
  148.   #--------------------------------------------------------------------------
  149.   # ● フレーム更新
  150.   #--------------------------------------------------------------------------
  151.   def update
  152.     super
  153.     @tree_window.tree_type = current_ext if @tree_window
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # ● スキルツリーウィンドウの設定
  157.   #--------------------------------------------------------------------------
  158.   def tree_window=(tree_window)
  159.     @tree_window = tree_window
  160.   end
  161. end

  162. class Window_SkillTree < Window_Selectable
  163.   attr_reader     :cost_window
  164.   #--------------------------------------------------------------------------
  165.   # ● オブジェクト初期化
  166.   #--------------------------------------------------------------------------
  167.   def initialize(x, y)
  168.     super(x, y, Graphics.width - x, Graphics.height - y - fitting_height(3))
  169.     @actor = nil
  170.     @tree_type = 0
  171.     deactivate
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # ● スキルツリーのセットを取得
  175.   #--------------------------------------------------------------------------
  176.   def tree
  177.     TOMO::SkillTree::Skill[@tree_type]
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ● 項目数の取得
  181.   #--------------------------------------------------------------------------
  182.   def item_max
  183.     col_max * row_max
  184.   end
  185.   #--------------------------------------------------------------------------
  186.   # ● 横に項目が並ぶときの空白の幅を取得
  187.   #--------------------------------------------------------------------------
  188.   def spacing
  189.     return 0
  190.   end
  191.   #--------------------------------------------------------------------------
  192.   # ● 桁数の取得
  193.   #--------------------------------------------------------------------------
  194.   def col_max
  195.     tree && tree[:tree] ? tree[:tree].collect{|row| row.size }.max : 1
  196.   end
  197.   #--------------------------------------------------------------------------
  198.   # ● 行数の取得
  199.   #--------------------------------------------------------------------------
  200.   def row_max
  201.     tree && tree[:tree] ? tree[:tree].size : 1
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   # ● 項目の幅を取得
  205.   #--------------------------------------------------------------------------
  206.   def item_width
  207.     TOMO::SkillTree::Name ? TOMO::SkillTree::Width : 24
  208.   end
  209.   #--------------------------------------------------------------------------
  210.   # ● ウィンドウ内容の幅を計算
  211.   #--------------------------------------------------------------------------
  212.   def contents_width
  213.     item_width * col_max
  214.   end
  215.   #--------------------------------------------------------------------------
  216.   # ● ウィンドウ内容の高さを計算
  217.   #--------------------------------------------------------------------------
  218.   def contents_height
  219.     item_height * (row_max * 2 - 1)
  220.   end
  221.   #--------------------------------------------------------------------------
  222.   # ● 項目を描画する矩形の取得
  223.   #--------------------------------------------------------------------------
  224.   def item_rect(index)
  225.     rect = Rect.new
  226.     rect.width = item_width
  227.     rect.height = item_height
  228.     rect.x = index % col_max * (item_width + spacing)
  229.     rect.y = index / col_max * 2 * item_height
  230.     rect
  231.   end
  232.   #--------------------------------------------------------------------------
  233.   # ● カーソル位置が画面内になるようにスクロール
  234.   #--------------------------------------------------------------------------
  235.   def ensure_cursor_visible
  236.     super
  237.     if (index % col_max + 1) * item_width > width - standard_padding * 2
  238.       self.ox = (index % col_max - 1) * item_width
  239.     else
  240.       self.ox = 0
  241.     end
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # ● カーソルを右に移動
  245.   #--------------------------------------------------------------------------
  246.   def cursor_right(wrap = false)
  247.     if col_max >= 2 && index % col_max < col_max - 1
  248.       select((index + 1) % item_max)
  249.     end
  250.   end
  251.   #--------------------------------------------------------------------------
  252.   # ● カーソルを左に移動
  253.   #--------------------------------------------------------------------------
  254.   def cursor_left(wrap = false)
  255.     if col_max >= 2 && index % col_max > 0
  256.       select((index - 1 + item_max) % item_max)
  257.     end
  258.   end
  259.   #--------------------------------------------------------------------------
  260.   # ● アクターの設定
  261.   #--------------------------------------------------------------------------
  262.   def actor=(actor)
  263.     return if @actor == actor
  264.     @actor = actor
  265.   end
  266.   #--------------------------------------------------------------------------
  267.   # ● スキルツリータイプの設定
  268.   #--------------------------------------------------------------------------
  269.   def tree_type=(type)
  270.     return if @tree_type == type
  271.     @tree_type = type
  272.     refresh
  273.   end
  274.   #--------------------------------------------------------------------------
  275.   # ● 選択項目のスキルIDを取得
  276.   #--------------------------------------------------------------------------
  277.   def skill_id
  278.     id = tree[:tree][index / col_max][index % col_max] if tree && tree[:tree]
  279.     id = 0 unless id
  280.     id
  281.   end
  282.   #--------------------------------------------------------------------------
  283.   # ● 選択項目のスキルポイントを取得
  284.   #--------------------------------------------------------------------------
  285.   def sp
  286.     tree[skill_id]["SP"] ? tree[skill_id]["SP"] : TOMO::SkillTree::DefaultPoint
  287.   end
  288.   #--------------------------------------------------------------------------
  289.   # ● スキルが習得済みか?
  290.   #--------------------------------------------------------------------------
  291.   def learned?(skill)
  292.     @actor && @actor.skill_learn?(skill)
  293.   end
  294.   #--------------------------------------------------------------------------
  295.   # ● スキルが習得可能か?
  296.   #--------------------------------------------------------------------------
  297.   def learn_ok?(skill)
  298.     point = TOMO::SkillTree::DefaultPoint
  299.     point = tree[skill.id]["SP"] if tree[skill.id]["SP"]
  300.     @actor && !@actor.skill_learn?(skill) &&
  301.     @actor.skill_point >= point && (tree[skill.id]["前提"] ?
  302.     tree[skill.id]["前提"].all?{|id|learned?($data_skills[id])} : true)
  303.   end
  304.   #--------------------------------------------------------------------------
  305.   # ● 選択項目の有効状態を取得
  306.   #--------------------------------------------------------------------------
  307.   def current_item_enabled?
  308.     return false unless @actor
  309.     return false unless tree
  310.     skill = $data_skills[skill_id]
  311.     return false unless skill
  312.     return learn_ok?(skill)
  313.   end
  314.   #--------------------------------------------------------------------------
  315.   # ● スキルを許可状態で表示するかどうか
  316.   #--------------------------------------------------------------------------
  317.   def enable?(skill)
  318.     return false unless @actor
  319.     return false unless tree
  320.     return learned?(skill) || learn_ok?(skill)
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # ● 項目の描画
  324.   #--------------------------------------------------------------------------
  325.   def draw_item(index)
  326.     rect = item_rect_for_text(index)
  327.     if tree && tree[:tree]
  328.       skill_id = tree[:tree][index / col_max][index % col_max]
  329.       if skill_id && skill_id > 0
  330.         skill = $data_skills[skill_id]
  331.         if TOMO::SkillTree::Name
  332.           draw_item_name(skill, rect.x, rect.y, enable?(skill), rect.width - 24)
  333.         else
  334.           draw_icon(skill.icon_index, rect.x, rect.y, enable?(skill))
  335.         end
  336.         if learned?(skill)
  337.           bitmap = Cache.system("Iconset")
  338.           icon_index = TOMO::SkillTree::LearnedIcon
  339.           s_rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  340.           rect.set(rect.x + 8, rect.y + 8, 16, 16)
  341.           contents.stretch_blt(rect, bitmap, s_rect)
  342.         end
  343.       end
  344.     end
  345.   end
  346.   #--------------------------------------------------------------------------
  347.   # ● 全ての線の描画
  348.   #--------------------------------------------------------------------------
  349.   def draw_lines
  350.     if tree && tree[:tree]
  351.       row_max.size.times do |start_y|
  352.         tree[:tree][start_y].each_with_index do |skill_id, start_x|
  353.           next unless skill_id > 0
  354.           next unless tree[skill_id]["派生"]
  355.           tree[skill_id]["派生"].each do |next_skill|
  356.             tree[:tree].each_with_index do |list, end_y|
  357.               if list.include?(next_skill)
  358.                 end_x = list.index(next_skill)
  359.                 mirror = tree[skill_id]["反転"] &&
  360.                   tree[skill_id]["反転"].include?(next_skill)
  361.                 draw_line(start_x, start_y, end_x, end_y, mirror)
  362.               end
  363.             end
  364.           end
  365.         end
  366.       end
  367.     end
  368.   end
  369.   #--------------------------------------------------------------------------
  370.   # ● 線の描画
  371.   #--------------------------------------------------------------------------
  372.   def draw_line(start_x, start_y, end_x, end_y, mirror = false)
  373.     x1, y1 = start_x * item_width, start_y * item_height * 2
  374.     x2, y2 = end_x * item_width, end_y * item_height * 2
  375.     width, height = item_width / 2, item_height / 2
  376.     x, y = x1 + width - 1, y1 + item_height
  377.     if x1 == x2
  378.       contents.fill_rect(x, y, 2, y2 - y, system_color)
  379.     elsif mirror
  380.       if x2 > x1
  381.         contents.fill_rect(x, y, 2, y2 - y - height - 1, system_color)
  382.         contents.fill_rect(x, y2 - height - 1, x2 - x1 + 2,
  383.         2, system_color)
  384.         contents.fill_rect(x2 + width - 1, y2 - height - 1, 2,
  385.         height + 1, system_color)
  386.       else
  387.         contents.fill_rect(x, y, 2, y2 - y - height - 1, system_color)
  388.         contents.fill_rect(x2 + width - 1, y2 - height - 1,
  389.         x1 - x2 + 2, 2, system_color)
  390.         contents.fill_rect(x2 + width - 1, y2 - height - 1, 2,
  391.         height + 1, system_color)
  392.       end
  393.     elsif x2 > x1
  394.       contents.fill_rect(x, y, 2, height + 1, system_color)
  395.       contents.fill_rect(x, y + height - 1, x2 - x1 + 2, 2, system_color)
  396.       contents.fill_rect(x2 + width - 1, y + height, 2,
  397.       y2 - y - height, system_color)
  398.     else
  399.       contents.fill_rect(x, y, 2, height + 1, system_color)
  400.       contents.fill_rect(x2 + width - 1, y + height - 1,
  401.       x1 - x2 + 2, 2, system_color)
  402.       contents.fill_rect(x2 + width - 1, y + height, 2,
  403.       y2 - y - height, system_color)
  404.     end
  405.   end
  406.   #--------------------------------------------------------------------------
  407.   # ● リフレッシュ
  408.   #--------------------------------------------------------------------------
  409.   def refresh
  410.     contents.clear
  411.     create_contents
  412.     draw_all_items
  413.     draw_lines
  414.   end
  415.   #--------------------------------------------------------------------------
  416.   # ● コストウィンドウの設定
  417.   #--------------------------------------------------------------------------
  418.   def cost_window=(cost_window)
  419.     @cost_window = cost_window
  420.     call_update_help
  421.   end
  422.   #--------------------------------------------------------------------------
  423.   # ● ヘルプテキスト更新
  424.   #--------------------------------------------------------------------------
  425.   def update_help
  426.     @help_window.set_item($data_skills[skill_id]) if skill_id
  427.     if @cost_window
  428.       @cost_window.skill_data = [skill_id, tree[skill_id]] if tree && skill_id
  429.     end
  430.   end
  431. end

  432. class Window_SkillTreeStatus < Window_Base
  433.   #--------------------------------------------------------------------------
  434.   # ● オブジェクト初期化
  435.   #--------------------------------------------------------------------------
  436.   def initialize(x, y)
  437.     super(x, y, 172, fitting_height(2))
  438.     @actor = nil
  439.   end
  440.   #--------------------------------------------------------------------------
  441.   # ● アクターの設定
  442.   #--------------------------------------------------------------------------
  443.   def actor=(actor)
  444.     return if @actor == actor
  445.     @actor = actor
  446.     refresh
  447.   end
  448.   #--------------------------------------------------------------------------
  449.   # ● リフレッシュ
  450.   #--------------------------------------------------------------------------
  451.   def refresh
  452.     contents.clear
  453.     if @actor
  454.       draw_actor_name(@actor, 0, 0)
  455.       change_color(system_color)
  456.       rect = Rect.new(0, line_height, contents_width, line_height)
  457.       draw_text(rect, TOMO::SkillTree::SPText)
  458.       change_color(normal_color)
  459.       draw_text(rect, @actor.skill_point, 2)
  460.     end
  461.   end
  462. end

  463. class Window_SkillTreeCost < Window_Base
  464.   #--------------------------------------------------------------------------
  465.   # ● オブジェクト初期化
  466.   #--------------------------------------------------------------------------
  467.   def initialize(x, y)
  468.     super(x, y, Graphics.width - x, fitting_height(3))
  469.     @actor = nil
  470.     @skill_data = nil
  471.   end
  472.   #--------------------------------------------------------------------------
  473.   # ● アクターの設定
  474.   #--------------------------------------------------------------------------
  475.   def actor=(actor)
  476.     return if @actor == actor
  477.     @actor = actor
  478.   end
  479.   #--------------------------------------------------------------------------
  480.   # ● スキルデータの設定
  481.   #--------------------------------------------------------------------------
  482.   def skill_data=(skill_data)
  483.     return if @skill_data == skill_data
  484.     @skill_data = skill_data
  485.     refresh
  486.   end
  487.   #--------------------------------------------------------------------------
  488.   # ● リフレッシュ
  489.   #--------------------------------------------------------------------------
  490.   def refresh
  491.     contents.clear
  492.     if @skill_data && @skill_data[1]
  493.       change_color(system_color)
  494.       rect = Rect.new(0, 0, contents_width, line_height)
  495.       if @actor && @actor.skill_learn?($data_skills[@skill_data[0]])
  496.         draw_text(rect, "取得済み")
  497.       else
  498.         draw_text(rect, TOMO::SkillTree::CostText)
  499.         width = text_size(TOMO::SkillTree::CostText).width
  500.         cost = TOMO::SkillTree::DefaultPoint
  501.         cost = @skill_data[1]["SP"] if @skill_data[1]["SP"]
  502.         change_color(normal_color, @actor.skill_point >= cost)
  503.         draw_text(rect.x + width, rect.y, rect.width - width, rect.height, cost)
  504.         change_color(system_color)
  505.         rect.y += line_height
  506.         draw_text(rect, TOMO::SkillTree::PremiseText)
  507.         p_width = text_size(TOMO::SkillTree::PremiseText).width
  508.         width = TOMO::SkillTree::Width
  509.         count = (contents_width - p_width) / width
  510.         if @skill_data[1]["前提"]
  511.           @skill_data[1]["前提"].each_with_index do |skill_id, i|
  512.             x = rect.x + p_width + width * (i % count)
  513.             y = rect.y + line_height * (i / count)
  514.             enabled = @actor.skill_learn?($data_skills[skill_id])
  515.             draw_item_name($data_skills[skill_id], x, y, enabled, width - 24)
  516.           end
  517.         end
  518.       end
  519.     end
  520.   end
  521. end

  522. class Window_SkillTreeChoice < Window_Selectable
  523.   #--------------------------------------------------------------------------
  524.   # ● オブジェクト初期化
  525.   #--------------------------------------------------------------------------
  526.   def initialize
  527.     x = (Graphics.width - 360) / 2
  528.     y = (Graphics.height - fitting_height(4)) / 2
  529.     super(x, y, 360, fitting_height(4))
  530.     @actor = nil
  531.     @skill_id = 0
  532.     @cost = 0
  533.     self.openness = 0
  534.     deactivate
  535.   end
  536.   #--------------------------------------------------------------------------
  537.   # ● 桁数の取得
  538.   #--------------------------------------------------------------------------
  539.   def col_max
  540.     return 2
  541.   end
  542.   #--------------------------------------------------------------------------
  543.   # ● 項目数の取得
  544.   #--------------------------------------------------------------------------
  545.   def item_max
  546.     col_max
  547.   end
  548.   #--------------------------------------------------------------------------
  549.   # ● 項目を描画する矩形の取得
  550.   #--------------------------------------------------------------------------
  551.   def item_rect(index)
  552.     rect = Rect.new
  553.     rect.width = item_width
  554.     rect.height = item_height
  555.     rect.x = index % col_max * (item_width + spacing)
  556.     rect.y = (index / col_max + 3) * item_height
  557.     rect
  558.   end
  559.   #--------------------------------------------------------------------------
  560.   # ● 決定ハンドラの呼び出し
  561.   #--------------------------------------------------------------------------
  562.   def call_ok_handler
  563.     handle?(:ok) && index == 1 ? call_handler(:cancel) : super
  564.   end
  565.   #--------------------------------------------------------------------------
  566.   # ● アクターの設定
  567.   #--------------------------------------------------------------------------
  568.   def actor=(actor)
  569.     return if @actor == actor
  570.     @actor = actor
  571.   end
  572.   #--------------------------------------------------------------------------
  573.   # ● スキルの設定
  574.   #--------------------------------------------------------------------------
  575.   def set_skill(skill_id, cost)
  576.     return if @skill_id == skill_id && @cost == cost
  577.     @skill_id = skill_id
  578.     @cost = cost
  579.     refresh
  580.   end
  581.   #--------------------------------------------------------------------------
  582.   # ● 水平線の色を取得
  583.   #--------------------------------------------------------------------------
  584.   def line_color
  585.     color = normal_color
  586.     color.alpha = 48
  587.     color
  588.   end
  589.   #--------------------------------------------------------------------------
  590.   # ● 水平線の描画
  591.   #--------------------------------------------------------------------------
  592.   def draw_horz_line(y)
  593.     line_y = y + line_height / 2 - 1
  594.     contents.fill_rect(0, line_y, contents_width, 2, line_color)
  595.   end
  596.   #--------------------------------------------------------------------------
  597.   # ● リフレッシュ
  598.   #--------------------------------------------------------------------------
  599.   def refresh
  600.     contents.clear
  601.     if @actor && @skill_id && @cost
  602.       draw_item_name($data_skills[@skill_id], 0, 0)
  603.       rect = Rect.new(0, 0, contents_width, line_height)
  604.       draw_text(rect, "を習得しますか?", 2)
  605.       rect.y += line_height
  606.       
  607.       change_color(system_color)
  608.       text = TOMO::SkillTree::SPText + ":"
  609.       draw_text(rect, text)
  610.       rect.width -= text_size(text).width
  611.       rect.x += text_size(text).width
  612.       draw_text(rect, "→", 1)
  613.       change_color(normal_color)
  614.       draw_text(rect, @actor.skill_point - @cost, 2)
  615.       rect.width = rect.width / 2 - 12
  616.       draw_text(rect, @actor.skill_point, 2)
  617.       
  618.       draw_horz_line(line_height * 2)
  619.       draw_text(item_rect_for_text(0), "はい", 1)
  620.       draw_text(item_rect_for_text(1), "いいえ", 1)
  621.     end
  622.   end
  623. end



  624. class Scene_SkillTree < Scene_MenuBase
  625.   #--------------------------------------------------------------------------
  626.   # ● 開始処理
  627.   #--------------------------------------------------------------------------
  628.   def start
  629.     super
  630.     create_help_window
  631.     create_status_window
  632.     create_command_window
  633.     create_tree_window
  634.     create_choice_window
  635.     create_cost_window
  636.   end
  637.   #--------------------------------------------------------------------------
  638.   # ● ステータスウィンドウの作成
  639.   #--------------------------------------------------------------------------
  640.   def create_status_window
  641.     @status_window = Window_SkillTreeStatus.new(0, @help_window.height)
  642.     @status_window.actor = @actor
  643.   end
  644.   #--------------------------------------------------------------------------
  645.   # ● コマンドウィンドウの作成
  646.   #--------------------------------------------------------------------------
  647.   def create_command_window
  648.     wy = @status_window.y + @status_window.height
  649.     @command_window = Window_SkillTreeTypes.new(0, wy)
  650.     @command_window.actor = @actor
  651.     @command_window.set_handler(:ok,       method(:on_type_ok))
  652.     @command_window.set_handler(:cancel,   method(:return_scene))
  653.     @command_window.set_handler(:pagedown, method(:next_actor))
  654.     @command_window.set_handler(:pageup,   method(:prev_actor))
  655.   end
  656.   #--------------------------------------------------------------------------
  657.   # ● ツリーウィンドウの作成
  658.   #--------------------------------------------------------------------------
  659.   def create_tree_window
  660.     wx, wy = @command_window.width, @help_window.height
  661.     @tree_window = Window_SkillTree.new(wx, wy)
  662.     @tree_window.actor = @actor
  663.     @tree_window.tree_type = @command_window.current_ext
  664.     @tree_window.help_window = @help_window
  665.     @tree_window.set_handler(:ok,     method(:on_tree_ok))
  666.     @tree_window.set_handler(:cancel, method(:on_tree_cancel))
  667.     @command_window.tree_window = @tree_window
  668.   end
  669.   #--------------------------------------------------------------------------
  670.   # ● 選択ウィンドウの作成
  671.   #--------------------------------------------------------------------------
  672.   def create_choice_window
  673.     @choice_window = Window_SkillTreeChoice.new
  674.     @choice_window.actor = @actor
  675.     @choice_window.set_handler(:ok,     method(:on_choice_ok))
  676.     @choice_window.set_handler(:cancel, method(:on_choice_cancel))
  677.   end
  678.   #--------------------------------------------------------------------------
  679.   # ● コストウィンドウの作成
  680.   #--------------------------------------------------------------------------
  681.   def create_cost_window
  682.     wy = @tree_window.y + @tree_window.height
  683.     @cost_window = Window_SkillTreeCost.new(0, wy)
  684.     @cost_window.actor = @actor
  685.     @tree_window.cost_window = @cost_window
  686.   end
  687.   #--------------------------------------------------------------------------
  688.   # ● スキルツリータイプ[決定]
  689.   #--------------------------------------------------------------------------
  690.   def on_type_ok
  691.     @tree_window.tree_type = @command_window.current_ext
  692.     @tree_window.activate.select(0)
  693.   end
  694.   #--------------------------------------------------------------------------
  695.   # ● スキルツリー[決定]
  696.   #--------------------------------------------------------------------------
  697.   def on_tree_ok
  698.     @choice_window.set_skill(@tree_window.skill_id, @tree_window.sp)
  699.     @choice_window.open.activate.select(0)
  700.   end
  701.   #--------------------------------------------------------------------------
  702.   # ● スキルツリー[決定]
  703.   #--------------------------------------------------------------------------
  704.   def on_tree_cancel
  705.     @tree_window.unselect
  706.     @command_window.activate
  707.   end
  708.   #--------------------------------------------------------------------------
  709.   # ● 選択[決定]
  710.   #--------------------------------------------------------------------------
  711.   def on_choice_ok
  712.     @actor.used_skill_point += @tree_window.sp
  713.     @actor.learn_skill(@tree_window.skill_id)
  714.     @status_window.refresh
  715.     @cost_window.refresh
  716.     @choice_window.close.deactivate
  717.     @tree_window.activate.refresh
  718.   end
  719.   #--------------------------------------------------------------------------
  720.   # ● 選択[決定]
  721.   #--------------------------------------------------------------------------
  722.   def on_choice_cancel
  723.     @choice_window.close.deactivate
  724.     @tree_window.activate.refresh
  725.   end
  726.   #--------------------------------------------------------------------------
  727.   # ● アクターの切り替え
  728.   #--------------------------------------------------------------------------
  729.   def on_actor_change
  730.     @status_window.actor = @actor
  731.     @command_window.actor = @actor
  732.     @tree_window.actor = @actor
  733.     @tree_window.tree_type = @command_window.current_ext
  734.     @choice_window.actor = @actor
  735.     @cost_window.actor = @actor
  736.     @command_window.activate
  737.   end
  738. end
复制代码

评分

参与人数 1赞 +1 收起 理由
南明鬼使 + 1 很有用

查看全部评分

VA外站脚本汉化群:226308173   |    部分远古文件备份:https://wwzv.lanzoue.com/b02rac5pc  密码:acgm
回复

使用道具 举报

梦石
0
星屑
411
在线时间
41 小时
注册时间
2018-4-14
回帖
40
 楼主| 发表于 2018-5-26 11:27:05 | 显示全部楼层
没人吗?
回复

使用道具 举报

梦石
0
星屑
411
在线时间
41 小时
注册时间
2018-4-14
回帖
40
 楼主| 发表于 2018-5-26 18:12:14 | 显示全部楼层
Nil2018 发表于 2018-5-25 18:49
https://rpg.blue/thread-405153-1-1.html

https://forums.rpgmakerweb.com/index.php?threads/lune-unlim ...

尝试了一下,不知道怎么用,求教!
回复

使用道具 举报

梦石
0
星屑
411
在线时间
41 小时
注册时间
2018-4-14
回帖
40
 楼主| 发表于 2018-5-26 21:50:52 | 显示全部楼层
Nil2018 发表于 2018-5-25 18:49
https://rpg.blue/thread-405153-1-1.html

https://forums.rpgmakerweb.com/index.php?threads/lune-unlim ...

已加群,等待同意。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部