赞 | 0 |
VIP | 3 |
好人卡 | 7 |
积分 | 7 |
经验 | 34794 |
最后登录 | 2024-2-21 |
在线时间 | 684 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 719
- 在线时间
- 684 小时
- 注册时间
- 2009-5-29
- 帖子
- 461
|
直接给脚本
不要问我怎么用,我还没用过……
来自 www.rpgmakervxace.net- #============================================================================
- # Skill Trees Ace v0.5
- # By Emerald
- # HEAVILY inspired by Basic(?) - Skill Trees of Awesome by Leongon
- #----------------------------------------------------------------------------
- # You're free to use the script for any game, as long as you give credits
- #----------------------------------------------------------------------------
- # Version History
- # 1.0 -> Started the script. Added all basic functions. However, as of now
- # requirements aren't shown in the info window.
- #----------------------------------------------------------------------------
- # This is a script which I felt very needed for games where character
- # customization is important. Note that this is a pretty hard to use script,
- # so read the instructions thoroughly!
- #
- # INSTRUCTIONS:
- #
- # Just as always, put this script between ▼ Materials and ▼ Main.... If we
- # scripters just got a penny for everytime we say this...
- #
- # The rest of the instructions are seperated in different sections. Read them
- # thoroughly!!
- #
- # 1. Standard Module Constants
- # 2. Tree Points Table
- # 3. Objects
- # 4. Trees
- # 5. Trees Per Actor
- # 6. Script Calls and others
- #
- # Information for the information window can be found at the bottom of the
- # configurations!
- #----------------------------------------------------------------------------
- # SECTION 1 / STANDARD MODULE CONSTANTS
- #----------------------------------------------------------------------------
- # USE_MENU_COMMAND / If set to true, a command in the menu will appear which
- # links you to the Skill Trees scene.
- #
- # MENU_VOCAB / Name of the menu command. Only use if USE_MENU_COMMAND is true.
- #
- #
- # The following five constants are only used in the standard information
- # window:
- # TREE_POINTS_VOCAB / Name of the points which you can use to level skills.
- #
- # MP_COST_VOCAB / Name of the MP Cost of the skill.
- #
- # CURRENT_TREE_POINTS_VOCAB / The part of text that comes before the name of
- # the current tree. Together, they form the name for the points invested in the
- # current tree.
- #
- # SKILL_LEVEL_VOCAB / Name of the skill levels.
- #
- # REQUIREMENTS_VOCAB / Title of the requirements block.
- #
- #
- # The following constants deal with getting points at level up:
- # TABLE_TREE_POINTS / Gain points according to a table. See Tree Points Table
- # for more info.
- #
- # INDIVIDUAL_LEVEL_POINTS / Do the actors gain individual amounts of Tree Points
- # on level up, yes or no. Doesn't apply for TABLE_TREE_POINTS.
- #
- # TREE_POINTS_PER_LEVEL / Amount of Tree Point received on level up. Make it an
- # array ( [] ) with the amounts according to actor IDs if INDIVIDUAL_LEVEL_POINTS
- # is true. NOTE THAT the first element is for actor ID 0, NOT 1!!!
- #
- # REMOVE_POINTS_ON_LEVEL_DOWN / If set to true, points will be removed from the
- # current amount of Tree Points if the actor's level goes down. BEST USED IN
- # COMBINATION WITH RESETS!!
- #
- #----------------------------------------------------------------------------
- # SECTION 2 / TREE_POINTS_TABLE
- #----------------------------------------------------------------------------
- # This section contains tables with points which actors gain on level up if
- # TABLE_TREE_POINTS is set to true.
- #
- # The table 0 => [...] is for every actor WITHOUT an individual table. Else,
- # the key (key => [...]) should be equal to the actor_id.
- #
- # The values within the table are the amount of tree points gained for every
- # NEXT LEVEL!! So the first amount is gained upon reaching level 2, the second
- # amount upon reaching level 3 etc.
- #
- #----------------------------------------------------------------------------
- # SECTION 3 / OBJECTS
- #----------------------------------------------------------------------------
- # Probably the hardest one...
- # In this section, you create the objects that make up a tree. These can be
- # either skills, or 'arrows'. Arrows are just icons which will be grayed out
- # if their child skill is unavailable.
- #
- # Syntax:
- # ARROWS
- # Identifier => ["arrow_object", icon_index, child_skill]
- # Identifier = a 'name' to easily identify the object. It is used to build trees
- # in the next section, and therefore must be unique. However, it can be whatever
- # you want it to be. Even an array.
- #
- # "arrow_object" = the type of the object. Must be exactly "arrow_object" if you
- # want to make it an ARROW OBJECT.
- #
- # icon_index = INDEX of the ICON that is used by the object.
- #
- # child_skill = SKILL OBJECT which determines if this arrow should be GRAYED OUT
- # or NOT. Use the identifier of the SKILL OBJECT as value for this one. Note that
- # required amount of points doesn't count! (at least, not the first one)
- #
- #
- # SKILLS
- # Identifier => ["skill_object", [skill_1, skill_2, etc...], [requirements_first_skill], [requirements_second_skill], etc.....]
- # Identifier = exact same as for the ARROW OBJECTS.
- #
- # "skill_object" = exact same as "arrow_object", but identifies SKILL OBJECTS.
- #
- # skill_1, 2, etc... = the IDs of the SKILLS at this object's different LEVELS.
- # can be as many as you want. Icon will be taken from the skill, and is grayed
- # out if requirements don't apply (except for the first COSTS requirement).
- #
- # requirements_first_skill = an ARRAY with the different REQUIREMENTS for the
- # skill which belongs to this requirements. The requirements are respective with
- # the skills. So:
- # [skill_1, skill_2, skill_3], [requirements_skill_1], [requirements_skill_2], [requirements_skill_3]
- #
- # You can have as many of the following types of requirements as you want, but
- # you MUST have at least one of the first type:
- #
- # Tree Points, ["points", amount_needed]
- # amount_needed = amount of points required.
- # NOTE that the VERY FIRST of this type of requirements is the cost to level the
- # skill.
- #
- # Points in a certain tree, ["tree_points", tree_id, points_needed]
- # tree_id = the tree_id of the tree in which the actor must have the needed
- # points. If it is the first tree, tree_id = 0, second tree, tree_id = 1, third
- # tree, tree_id = 2.
- # points_needed = the points required in the specified tree.
- #
- # Skill Object at certain level, ["tree_skill_level", skill_object, required_level, can_be_from_different_trees]
- # skill_object = the identifier of the object which should have the required level.
- # required_level = can't be more obvious. 0 is unlearned. Note that the skill level
- # should be equal to OR HIGHER THAN this value.
- # can_be_from_different_trees = the learned skills are unique per tree. Set this
- # to true if the skill of the SKILL OBJECT's level may also be learned by another
- # tree.
- #
- # Required level, ["level", case, required_level]
- # case = in which manner should the level be required? "=" (equal to), ">"
- # (greater than), ">=" (greater than, equal to), "<" (less than), "<=" (less than
- # equal to), "!=" (everything BUT)
- #
- # Skill learned, ["skill", skill_id]
- # skill_id = ID of the skill which the actor must have learned.
- # NOTE THAT THIS ONE can also be skills NOT learned by skill trees!! AND IT'S A
- # SINGLE SKILL!
- #
- # Switch on certain value, ["switch", switch_id, key]
- # switch_id = again, obvious....
- # key = either true or false, the switch must be equal to this.
- #
- # Variable, ["variable", variable_id, case, amount]
- # variable_id = ...
- # case = same cases as with REQUIRED LEVEL.
- #----------------------------------------------------------------------------
- # SECTION 4 / TREES
- #----------------------------------------------------------------------------
- # Trees are build up from rows and identifiers. Note that every row has 7
- # spots for objects. Doesn't matter what the objects are.
- #
- # Syntax:
- # Identifier => [object, object, object, object, object, object, object,
- # object, object, object, object, object, object, object]
- # Identifier = the 'name' of the tree. This must be individual and is used to
- # sort the trees for the actors(next section). Can be a string, number, symbol,
- # whatever.... As long as it is identical and you use the exact same identifier
- # in the next section.
- #
- # object = the IDENTIFIER of the object. Every tree has rows of 7 OBJECTS. The
- # amounts of rows if infinite. If you want to leave an spot blank, use nil.
- #
- #----------------------------------------------------------------------------
- # SECTION 5 / TREES PER ACTOR
- #----------------------------------------------------------------------------
- # The eassiest out of them all. Note that EVERY ACTOR should have an array
- # here.
- #
- # Syntax:
- # Actor_id => [tree_1, tree_2, tree_3, "tree_name_1", "tree_name_2", "tree_name_3"]
- # Actor_id = obvious....
- #
- # tree_1...3 = the IDENTIFIER of the tree as used in Trees. So, can be a string,
- # variable, symbol, whatever.... Leave nil for no tree.
- #
- # "tree_name_1...3" = NAME of the tree as displayed within the scene. Must be
- # a string.
- #
- #----------------------------------------------------------------------------
- # SECTION 6 / SCRIPT CALLS AND OTHERS
- #----------------------------------------------------------------------------
- # To add Tree Points, use:
- # $game_actors[actor_id].tree_points += x
- # $game_actors[actor_id].total_tree_points += x
- # Where actor_id is the id of the actor for which the skill_points are meant
- # and x is the amount received. Note that the total_tree_points should also
- # receive the SAME amount as it is a variable used when RESETING TREES!!
- #
- # To add Tree Points to individual trees, use:
- # $game_actors[actor_id].tree_points -= x
- # $game_actors[actor_id].points_per_tree[tree_id] += x
- # Where actor_id has the same meaning as above, tree_id is the id of the tree
- # to add the points to and x is the amount of ppoints. The tree_points is used
- # in order to prevent adding points which the actor has just gained. Else, use
- # $game_actors[actor_id].total_tree_points += x.
- #
- # To reset a tree, use:
- # $game_actors[actor_id].est_reset_tree(tree_id)
- # $game_actors[actor_id].est_reset_all_trees
- # The first is for only a single tree, the second for ALL trees. For tree_id,
- # put the ID of the tree to reset.
- #
- # $game_actors[actor_id].est_skill_maxed?(skill_object, tree_id)
- # to check if the actor with actor_id has maxed the SKILL OBJECT with skill_object
- # as IDENTIFIER. Tree_id is the tree containing the SKILL OBJECT.
- #
- # $game_actors[actor_id].est_skill_level(skill_object, tree_id, different_trees_too?)
- # this returns the skill level of the SKILL OBJECT with skill_object as identifier.
- # tree_id is the ID of the tree containing the SKILL OBJECT. If different_trees_too?
- # is set to true, the actor may have learned the skill in a different tree for
- # the skill level to go up by 1.
- #
- # Use SceneManager.call(Scene_SkillTrees) to call the Skill Trees scene.
- #
- # INFORMATION_WINDOW
- # This script always shows a window to the right of the tree. You can edit the
- # contents of this window at the end of the configurations. HOWEVER, you need
- # to be able to script to do this!!
- #----------------------------------------------------------------------------
- # HEAVILY inspired by Basic(?) - Skill Trees of Awesome by Leongon
- #----------------------------------------------------------------------------
- # If you have any issues with this script, contact me at
- # http://www.rpgmakervxace.net/index.php?/
- #============================================================================
- #
- # CONFIGURATION
- #
- #============================================================================
-
- module EME
- module SKILL_TREES
-
- #----------------------------------------------------------------------------
- # SECTION 1 / STANDARD MODULE CONSTANTS
- #----------------------------------------------------------------------------
-
- USE_MENU_COMMAND = true
- MENU_VOCAB = "Skill Trees"
-
- TREE_POINTS_VOCAB = "SP"
- MP_COST_VOCAB = "MP Cost"
- CURRENT_TREE_POINTS_VOCAB = "SP in "
- SKILL_LEVEL_VOCAB ="Skill Level"
- REQUIREMENTS_VOCAB = "Requirements"
-
- TABLE_TREE_POINTS = false
- INDIVIDUAL_LEVEL_POINTS = false
- TREE_POINTS_PER_LEVEL = 2
- REMOVE_POINTS_ON_LEVEL_DOWN = true
-
- #----------------------------------------------------------------------------
- # SECTION 2 / TREE_POINTS_TABLE
- #----------------------------------------------------------------------------
-
- Tree_Points_Table = {
- 0 => [2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2],
-
- 1 => [3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3]
- }
-
- #----------------------------------------------------------------------------
- # SECTION 3 / OBJECTS
- #----------------------------------------------------------------------------
-
- Objects = {
-
- # Arrow Objects
- "arrow_down_begin" => ["arrow_object", 18, "test_skill_2"],
- "arrow_down_end" => ["arrow_object", 18, "test_skill_2"],
-
- # Skill Objects
- "test_skill_1" => ["skill_object", [1, 2, 3], [["points", 1]], [["points", 1]], [["points", 1]]],
- "test_skill_2" => ["skill_object", [4, 5, 6], [["points", 1], ["tree_skill_level", "test_skill_1", 3]], [["points", 1]], [["points", 1]]]
-
- }
-
- #----------------------------------------------------------------------------
- # SECTION 4 / TREES
- #----------------------------------------------------------------------------
-
- Trees = {
-
- "test_tree" => ["test_skill_1" , nil, nil, nil, nil, nil, nil,
- "arrow_down_begin", nil, nil, nil, nil, nil, nil,
- "arrow_down_end" , nil, nil, nil, nil, nil, nil,
- "test_skill_2"]
- }
-
- #----------------------------------------------------------------------------
- # SECTION 5 / TREES PER ACTOR
- #----------------------------------------------------------------------------
-
- Trees_Per_Actor = {
-
- 1 => ["test_tree", nil, nil, "Ubar Tree", "", ""],
- 2 => [nil, "test_tree", nil, "", "Ubar Tree 2", ""]
-
- }
-
- end
- end
-
- #============================================================================
- # ADVANCED INFORMATION WINDOW
- #----------------------------------------------------------------------------
- # If you can script, here's the refresh with all the contents of the
- # information window so you can easily change it if you want to.
- #
- # Added constants:
- # @actor = the current actor. It's the $game_actors[actor_id] version.
- # @tree_id = the ID of the current tree. 0, 1 or 2.
- # @skill_object = the object that is currently selected.
- #
- # Useful constants:
- # Tree Points = @actor.tree_points
- # Points in current tree = @actor.points_per_tree[@tree_id]
- # Skill object level = @actor.est_skill_level(@skill_object, @tree_id)
- #============================================================================
-
- class Window_EST_Information < Window_Base
-
- def refresh
- contents.clear
- # Actor Info
- draw_actor_face(@actor, 0, 0)
- draw_actor_name(@actor, 100, 0)
- draw_actor_level(@actor, 212, 0)
- draw_actor_class(@actor, 100, 24)
- draw_actor_tree_points(@actor, 212, 24)
- draw_actor_current_tree_points(@actor, 100, 48)
- draw_line
- # Skill Info
- @current_skill = $data_skills[@skill_object[1][@actor.est_skill_level(@skill_object, @tree_id)]]
- draw_skill_name(0, 106)
- draw_skill_cost(136, 106)
- draw_skill_level(136, 1130)
- draw_text_ex(0, 154, @current_skill.description)
- draw_line_2
- # draw_requirements(0, 208)
- end
-
- def draw_actor_level(actor, x, y)
- change_color(system_color)
- draw_text(x, y, 80, line_height, Vocab::level)
- change_color(normal_color)
- draw_text(x + 92, y, 24, line_height, actor.level, 2)
- end
-
- def draw_actor_tree_points(actor, x, y)
- change_color(system_color)
- draw_text(x, y, 80, line_height, EME::SKILL_TREES::TREE_POINTS_VOCAB)
- change_color(normal_color)
- draw_text(x + 80, y, 36, line_height, actor.tree_points, 2)
- end
-
- def draw_actor_current_tree_points(actor, x, y)
- change_color(system_color)
- draw_text(x, y, 170, line_height, EME::SKILL_TREES::CURRENT_TREE_POINTS_VOCAB + EME::SKILL_TREES::Trees_Per_Actor[actor.id][@tree_id + 3])
- change_color(normal_color)
- draw_text(x + 192, y, 36, line_height, actor.points_per_tree[@tree_id], 2)
- end
-
- def draw_line
- rect = Rect.new(0, 100, contents.width, 2)
- contents.fill_rect(rect, normal_color)
- end
-
- def draw_line_2
- rect = Rect.new(0, 202, contents.width, 2)
- contents.fill_rect(rect, normal_color)
- end
-
- def draw_skill_name(x, y)
- draw_icon(@current_skill.icon_index, x, y, true)
- change_color(normal_color)
- draw_text(x + 24, y, 112, line_height, @current_skill.name)
- end
-
- def draw_skill_cost(x, y)
- change_color(system_color)
- draw_text(x, y, 144, line_height, EME::SKILL_TREES::MP_COST_VOCAB)
- change_color(normal_color)
- draw_text(x + 144, y, 48, line_height, @current_skill.mp_cost.to_s, 2)
- end
-
- def draw_skill_level(x, y)
- change_color(system_color)
- draw_text(x, y, 144, line_height, EME::SKILL_TREES::SKILL_LEVEL_VOCAB)
- change_color(normal_color)
- unless @actor.est_skill_maxed?(@skill_object, @tree_id)
- draw_text(x + 156, y, 36, line_height, @actor.est_skill_level(@skill_object, @tree_id).to_s, 2)
- else
- draw_text(x + 156, y, 36, line_height, "MAX", 2)
- end
- end
- =begin
- def draw_requirements(x, y)
- draw_text(x, y, 328, line_height, EME::SKILL_TREES::REQUIREMENTS_VOCAB)
- end
- =end
- end
-
- # Don't edit anything past this line unless you know what you're doing.
-
- #============================================================================
- #
- # Game_Party
- # Adds memorize variables.
- #============================================================================
-
- class Game_Party
-
- attr_accessor :est_last_object_index
- attr_accessor :est_last_tree_id
- attr_accessor :est_last_actor_index
-
- alias eme_est_something_something_dark_side initialize
- def initialize
- eme_est_something_something_dark_side
- @est_last_object_index = 0
- @est_last_tree_id = 0
- @est_last_actor_index = 0
- end
-
- end
-
- #============================================================================
- #
- # Game_Actor
- # Adds needed individual variables and stuff.
- #============================================================================
-
- class Game_Actor
-
- attr_accessor :tree_points
- attr_accessor :total_tree_points
- attr_accessor :points_per_tree
- attr_accessor :tree_skills
-
- alias eme_est_setup_actor setup
- def setup(actor_id)
- eme_est_setup_actor(actor_id)
- @tree_points = 0
- @total_tree_points = 0
- @points_per_tree = [0,0,0]
- @tree_skills = [[], [], []]
- end
-
- alias eme_est_level_up level_up
- def level_up
- eme_est_level_up
- if EME::SKILL_TREES::TABLE_TREE_POINTS
- if EME::SKILL_TREES::Tree_Points_Table.has_key?(@id)
- @tree_points += EME::SKILL_TREES::Tree_Points_Table[@id][@level - 2]
- @total_tree_points += EME::SKILL_TREES::Tree_Points_Table[@id][@level - 2]
- else
- @tree_points += EME::SKILL_TREES::Tree_Points_Table[0][@level - 2]
- @total_tree_points += EME::SKILL_TREES::Tree_Points_Table[0][@level - 2]
- end
- else
- if EME::SKILL_TREES::INDIVIDUAL_LEVEL_POINTS
- @tree_points += EME::SKILL_TREES::TREE_POINTS_PER_LEVEL[@id]
- @total_tree_points += EME::SKILL_TREES::TREE_POINTS_PER_LEVEL[@id]
- else
- @tree_points += EME::SKILL_TREES::TREE_POINTS_PER_LEVEL
- @total_tree_points += EME::SKILL_TREES::TREE_POINTS_PER_LEVEL
- end
- end
- end
-
- alias eme_est_level_down level_down
- def level_down
- eme_est_level_down
- if EME::SKILL_TREES::REMOVE_POINTS_ON_LEVEL_DOWN
- if EME::SKILL_TREES::TABLE_TREE_POINTS
- if EME::SKILL_TREES::Tree_Points_Table.has_key?(@id)
- @tree_points -= EME::SKILL_TREES::Tree_Points_Table[@id][@level - 1]
- @total_tree_points -= EME::SKILL_TREES::Tree_Points_Table[@id][@level - 1]
- else
- @tree_points -= EME::SKILL_TREES::Tree_Points_Table[0][@level - 1]
- @total_tree_points -= EME::SKILL_TREES::Tree_Points_Table[0][@level - 1]
- end
- else
- if EME::SKILL_TREES::INDIVIDUAL_LEVEL_POINTS
- @tree_points -= EME::SKILL_TREES::TREE_POINTS_PER_LEVEL[@id]
- @total_tree_points -= EME::SKILL_TREES::TREE_POINTS_PER_LEVEL[@id]
- else
- @tree_points -= EME::SKILL_TREES::TREE_POINTS_PER_LEVEL
- @total_tree_points -= EME::SKILL_TREES::TREE_POINTS_PER_LEVEL
- end
- end
- end
- end
-
- def est_reset_tree(tree_id)
- @tree_points += @tree_points[tree_id]
- @tree_points[tree_id] = 0
- @tree_skills[tree_id].clear
- end
-
- def est_reset_all_trees
- for i in 0..2
- est_reset_tree(i)
- end
- end
-
- def est_skill_level(skill_object, tree_id)
- current_skill = 0
- loop do
- unless est_skill_maxed?(skill_object, tree_id)
- if @tree_skills[0].include?(skill_object[1][current_skill])
- current_skill += 1
- elsif @tree_skills[1].include?(skill_object[1][current_skill])
- current_skill += 1
- elsif @tree_skills[2].include?(skill_object[1][current_skill])
- current_skill += 1
- else
- return current_skill
- break
- end
- else
- break
- return est_skill_max_level(skill_object)
- end
- end
- end
-
- def est_skill_maxed?(skill_object, tree_id)
- current_element = 0
- last_element = skill_object[1].size - 1
- loop do
- if current_element == last_element
- return @tree_skills[tree_id].include?(skill_object[1][current_element])
- else
- if @tree_skills[tree_id].include?(skill_object[1][current_element])
- current_element += 1
- else
- return false
- end
- end
- end
- end
-
- def est_skill_max_level(skill_object)
- return skill_object[1].size - 1
- end
-
- end
-
- #============================================================================
- #
- # Window_EST_Trees
- # The main window. This one depicts the current tree.
- #============================================================================
-
- class Window_EST_Trees < Window_Selectable
-
- attr_reader :data
- attr_reader :objects
- attr_reader :trees
- attr_reader :trees_per_actor
- attr_accessor :actor
- attr_accessor :tree_id
-
- def initialize(tree_id)
- super(0, 48, 7 * 24 + 24, Graphics.height - 48)
- @tree_id = tree_id
- @data = []
- @actor = $game_party.members[$game_party.est_last_actor_index]
- @trees = EME::SKILL_TREES::Trees
- @trees_per_actor = EME::SKILL_TREES::Trees_Per_Actor
- @objects = EME::SKILL_TREES::Objects
- refresh
- select_last
- end
-
- def item_max
- @data ? @data.size : 1
- end
-
- def col_max
- return 7
- end
-
- def item_width
- return 24
- end
-
- def item_height
- return 24
- end
-
- def spacing
- return 0
- end
-
- def select_last
- if @data[$game_party.est_last_object_index] != nil and @objects[@data[$game_party.est_last_object_index]][1] != "arrow_object"
- select($game_party.est_last_object_index)
- else
- current_element = 0
- last_element = @data.size - 1
- loop do
- if current_element != last_element
- if @data[current_element] != nil and @objects[@data[current_element]][1] != "arrow_object"
- select(current_element)
- return
- else
- current_element += 1
- end
- else
- self.unselect
- end
- end
- end
- end
-
- alias eme_est_cursor_down cursor_down
- def cursor_down(wrap = false)
- loop do
- if index + col_max > @data.size - 1
- self.index = 0
- if @data[index] != nil and @objects[@data[index]] != "arrow_object"
- select(0)
- return
- end
- elsif @data[index + col_max] != nil and @objects[@data[index + col_max]][0] != "arrow_object"
- break
- else
- self.index += col_max
- self.index = 0 if index > item_max
- end
- end
- eme_est_cursor_down(wrap)
- $game_party.est_last_object_index = @index
- end
-
- alias eme_est_cursor_up cursor_up
- def cursor_up(wrap = false)
- loop do
- if index - col_max < 0
- self.index = @data.size - 1
- if @data[index] != nil and @objects[@data[index]] != "arrow_object"
- select(index)
- return
- end
- elsif @data[index - col_max] != nil and @objects[@data[index - col_max]][0] != "arrow_object"
- break
- else
- self.index -= col_max
- self.index = 0 if index < 0
- end
- end
- eme_est_cursor_up(wrap)
- $game_party.est_last_object_index = @index
- end
-
- alias eme_est_cursor_right cursor_right
- def cursor_right(wrap = false)
- loop do
- if index + 1 > @data.size - 1
- self.index = 0
- if @data[index] != nil and @objects[@data[index]] != "arrow_object"
- select(0)
- return
- end
- elsif @data[index + 1] != nil and @objects[@data[index + 1]][0] != "arrow_object"
- break
- else
- self.index += 1
- self.index = 0 if index > item_max
- end
- end
- eme_est_cursor_right(wrap)
- $game_party.est_last_object_index = @index
- end
-
- alias eme_est_cursor_left cursor_left
- def cursor_left(wrap = false)
- loop do
- if index - 1 < 0
- self.index = @data.size - 1
- if @data[index] != nil and @objects[@data[index]] != "arrow_object"
- select(@data.size - 1)
- return
- end
- elsif @data[index - 1] != nil and @objects[@data[index - 1]][0] != "arrow_object"
- break
- else
- self.index -= 1
- self.index = 0 if index > item_max
- end
- end
- eme_est_cursor_left(wrap)
- $game_party.est_last_object_index = @index
- end
-
- def enable_arrow?(arrow_object)
- return true if enable_skill?(@objects[arrow_object[2]], true)
- end
-
- def enable_skill?(skill_object, used_in_enable_arrow)
- return true if @actor.est_skill_maxed?(skill_object, @tree_id)
- requirements = skill_object[@actor.est_skill_level(skill_object, @tree_id) + 2]
- $game_variables[1] = requirements if skill_object == @objects["test_skill_2"]
- requirements.each {|requirement|
- case requirement[0]
- when "points"
- return false unless used_in_enable_arrow or @actor.tree_points >= requirement[1]
- when "tree_points"
- return false unless @actor.points_per_tree[requirement[1]] >= requirement[2]
- when "tree_skill_level"
- if requirement[3] == true
- for i in 0..2
- return false unless @actor.est_skill_level(@objects["test_skill_1"], i) >= requirement[2] or @actor.est_skill_maxed?(@objects[requirement[1]], i)
- end
- else
- return false unless @actor.est_skill_level(@objects["test_skill_1"], @tree_id) >= requirement[2] or @actor.est_skill_maxed?(@objects[requirement[1]], @tree_id)
- end
- when "level"
- case requirement[1]
- when "="
- return false unless @actor.level == requirement[2]
- when ">"
- return false unless @actor.level > requirement[2]
- when ">="
- return false unless @actor.level >= requirement[2]
- when "<"
- return false unless @actor.level < requirement[2]
- when "<="
- return false unless @actor.level <= requirement[2]
- when "!="
- return false unless @actor.level != requirement[2]
- end
- when "skill"
- return false unless @actor.has_skill?(requirement[1])
- when "switch"
- if requirement[2]
- return false unless $game_switches[requirement[1]]
- else
- return false if $game_switches[requirement[1]]
- end
- when "variable"
- case requirement[2]
- when "="
- return false unless $game_variables[requirement[1]] == requirement[3]
- when ">"
- return false unless $game_variables[requirement[1]] > requirement[3]
- when ">="
- return false unless $game_variables[requirement[1]] >= requirement[3]
- when "<"
- return false unless $game_variables[requirement[1]] < requirement[3]
- when "<="
- return false unless $game_variables[requirement[1]] <= requirement[3]
- when "!="
- return false unless $game_variables[requirement[1]] != requirement[3]
- end
- end
- }
- return true
- end
-
- def current_item_enabled?
- return false if @data[index] == nil
- case @objects[@data[index]][0]
- when "skill_object"
- return true if enable_skill?(@objects[@data[index]], false)
- when "arrow_object"
- return true if enable_arrow?(@objects[@data[index]])
- end
- return false
- end
-
- def make_tree_data
- if @trees_per_actor[@actor.id] != nil
- if @trees_per_actor[@actor.id][@tree_id] != nil
- @data = @trees[@trees_per_actor[@actor.id][@tree_id]]
- elsif @trees_per_actor[@actor.id][0] != nil
- @tree_id = 0
- @data = @trees[@trees_per_actor[@actor.id][@tree_id]]
- elsif @trees_per_actor[@actor.id][1] != nil
- @tree_id = 1
- @data = @trees[@trees_per_actor[@actor.id][@tree_id]]
- elsif @trees_per_actor[@actor.id][2] != nil
- @tree_id = 2
- @data = @trees[@trees_per_actor[@actor.id][@tree_id]]
- else
- @data = nil
- end
- else
- @data = nil
- end
- end
-
- def draw_item(index)
- if @data[index] != nil
- object = @objects[@data[index]]
- rect = item_rect(index)
- rect.width -= 4
- if object[0] == "arrow_object"
- draw_icon(object[1], rect.x, rect.y, enable_arrow?(object))
- elsif object[0] == "skill_object"
- skill_level = @actor.est_skill_level(object, @tree_id)
- draw_icon($data_skills[object[1][skill_level]].icon_index, rect.x, rect.y, enable_skill?(object, false))
- contents.font.size = 16
- unless @actor.est_skill_maxed?(object, @tree_id)
- draw_text(rect.x + 2, rect.y + 4, 24, line_height, @actor.est_skill_level(object, @tree_id).to_s)
- else
- draw_text(rect.x + 2, rect.y + 4, 24, line_height, "MAX")
- end
- end
- end
- end
-
- def refresh
- make_tree_data
- create_contents
- draw_all_items
- select_last
- end
-
- end
-
- #============================================================================
- #
- # Window_EST_Selection
- # Window which enables the player to select the differen trees.
- #============================================================================
-
- class Window_EST_Selection < Window_HorzCommand
-
- attr_accessor :actor_id
-
- def initialize
- @actor_id = 0
- super(0, 0)
- end
-
- def window_width
- Graphics.width
- end
-
- def col_max
- return 3
- end
-
- def update
- super
- case current_symbol
- when :tree_1
- $game_party.est_last_tree_id = 0
- when :tree_2
- $game_party.est_last_tree_id = 1
- when :tree_3
- $game_party.est_last_tree_id = 2
- end
- end
-
- def make_command_list
- if EME::SKILL_TREES::Trees_Per_Actor.include?(@actor_id)
- add_command(EME::SKILL_TREES::Trees_Per_Actor[@actor_id][3], :tree_1) if EME::SKILL_TREES::Trees_Per_Actor[@actor_id][0] != nil
- add_command(EME::SKILL_TREES::Trees_Per_Actor[@actor_id][4], :tree_2) if EME::SKILL_TREES::Trees_Per_Actor[@actor_id][1] != nil
- add_command(EME::SKILL_TREES::Trees_Per_Actor[@actor_id][5], :tree_3) if EME::SKILL_TREES::Trees_Per_Actor[@actor_id][2] != nil
- end
- end
-
- alias eme_est_i_need_something_original refresh
- def refresh
- eme_est_i_need_something_original
- clear_command_list
- make_command_list
- end
-
- end
-
- #============================================================================
- #
- # Window_EST_Information
- # Window which shows all needed information.
- #============================================================================
-
- class Window_EST_Information < Window_Base
-
- attr_accessor :actor
- attr_accessor :tree_id
- attr_accessor :skill_object
-
- def initialize
- super(7 * 24 + 24, 48, Graphics.width - 7 * 24 - 24, Graphics.height - 48)
- @actor = nil
- @tree_id = 0
- @skill_object = ["", [0], ["points", 0]]
- end
-
- end
-
- #============================================================================
- #
- # Window_MenuCommand
- # Adds the skill trees menu command.
- #============================================================================
-
- class Window_MenuCommand
-
- alias eme_est_original_commands add_original_commands
- def add_original_commands
- eme_est_original_commands
- add_command(EME::SKILL_TREES::MENU_VOCAB, :talents) if EME::SKILL_TREES::USE_MENU_COMMAND
- end
-
- end
-
- #============================================================================
- #
- # Scene_Menu
- # Adds the handler to access the skill trees scene from the menu.
- #============================================================================
-
- class Scene_Menu
-
- alias eme_est_create_command_window create_command_window
- def create_command_window
- eme_est_create_command_window
- @command_window.set_handler(:talents, method(:talents_scene)) if EME::SKILL_TREES::USE_MENU_COMMAND
- end
-
- def talents_scene
- SceneManager.call(Scene_SkillTrees)
- end
-
- end
-
- #============================================================================
- #
- # Scene_SkillTrees
- # New scene to learn skills from the trees.
- #============================================================================
-
- class Scene_SkillTrees < Scene_MenuBase
-
- def start
- super
- create_skill_trees
- create_skill_trees_selection
- create_info_window
- @skill_trees_selection.deactivate
- @skill_tree.activate
- end
-
- alias eme_est_scene_update update
- def update
- eme_est_scene_update
- any_change = false
- if @info_window.skill_object != @skill_tree.objects[@skill_tree.data[$game_party.est_last_object_index]]
- @info_window.skill_object = @skill_tree.objects[@skill_tree.data[$game_party.est_last_object_index]]
- any_change = true
- end
- if @info_window.tree_id != $game_party.est_last_tree_id
- @info_window.tree_id = $game_party.est_last_tree_id
- any_change = true
- end
- if @skill_tree.tree_id != $game_party.est_last_tree_id
- @skill_tree.tree_id = $game_party.est_last_tree_id
- any_change = true
- end
- if any_change
- @info_window.refresh
- @skill_tree.refresh
- end
- end
-
- def create_skill_trees
- @skill_tree = Window_EST_Trees.new($game_party.est_last_tree_id)
- @skill_tree.viewport = @viewport
- @skill_tree.set_handler(:ok, method(:learn_skill))
- @skill_tree.set_handler(:cancel, method(:switch_to_selection))
- @skill_tree.set_handler(:pageup, method(:actor_left))
- @skill_tree.set_handler(:pagedown, method(:actor_right))
- end
-
- def create_skill_trees_selection
- @skill_trees_selection = Window_EST_Selection.new
- @skill_trees_selection.actor_id = @skill_tree.actor.id
- @skill_trees_selection.clear_command_list
- @skill_trees_selection.make_command_list
- @skill_trees_selection.refresh
- @skill_trees_selection.viewport = @viewport
- @skill_trees_selection.select(@skill_tree.tree_id)
- @skill_trees_selection.set_handler(:ok, method(:switch_to_tree))
- @skill_trees_selection.set_handler(:cancel, method(:return_scene))
- @skill_trees_selection.set_handler(:pageup, method(:actor_left))
- @skill_trees_selection.set_handler(:pagedown, method(:actor_right))
- end
-
- def create_info_window
- @info_window = Window_EST_Information.new
- @info_window.actor = @skill_tree.actor
- @info_window.tree_id = @skill_tree.tree_id
- @info_window.skill_object = @skill_tree.objects[@skill_tree.data[@skill_tree.index]]
- @info_window.refresh
- @info_window.viewport = @viewport
- end
-
- def switch_to_tree
- @skill_trees_selection.deactivate
- @skill_tree.activate
- end
-
- def switch_to_selection
- @skill_tree.deactivate
- @skill_trees_selection.activate
- end
-
- def actor_left
- last_window = "selection"
- if @skill_tree.active
- last_window = "trees"
- end
- current_actor_index = $game_party.members.index(@skill_tree.actor)
- if current_actor_index - 1 >= 0
- @skill_tree.actor = $game_party.members[current_actor_index - 1]
- else
- @skill_tree.actor = $game_party.members[$game_party.members.size - 1]
- end
- @skill_trees_selection.actor_id = @skill_tree.actor.index
- @info_window.actor = @skill_tree.actor
- @skill_tree.refresh
- @skill_trees_selection.refresh
- @info_window.refresh
- $game_party.est_last_actor_index = $game_party.members.index(@skill_tree.actor)
- if last_window = "trees"
- @skill_tree.activate
- else
- @skill_trees_selection.activate
- end
- end
-
- def actor_right
- last_window = "selection"
- if @skill_tree.active
- last_window = "trees"
- end
- current_actor_index = $game_party.members.index(@skill_tree.actor)
- if $game_party.members[current_actor_index + 1] != nil
- @skill_tree.actor = $game_party.members[current_actor_index + 1]
- else
- @skill_tree.actor = $game_party.members[0]
- end
- @skill_trees_selection.actor_id = @skill_tree.actor.id
- @info_window.actor = @skill_tree.actor
- @skill_tree.refresh
- @skill_trees_selection.refresh
- @info_window.refresh
- $game_party.est_last_actor_index = $game_party.members.index(@skill_tree.actor)
- if last_window = "trees"
- @skill_tree.activate
- else
- @skill_trees_selection.activate
- end
- end
-
- def learn_skill
- object = @skill_tree.objects[@skill_tree.data[@skill_tree.index]]
- current_element = 0
- cost = 0
- loop do
- if object[@actor.est_skill_level(object, @skill_tree.tree_id) + 2][current_element][0] == "points"
- cost = object[@actor.est_skill_level(object, @skill_tree.tree_id) + 2][current_element][1]
- break
- else
- current_element += 1
- end
- end
- $game_actors[@actor.id].tree_points -= cost
- $game_actors[@actor.id].points_per_tree[@skill_tree.tree_id] += cost
- $game_actors[@actor.id].tree_skills[@skill_tree.tree_id].push(object[1][@actor.est_skill_level(object, @skill_tree.tree_id)])
- $game_actors[@actor.id].learn_skill(object[1][@actor.est_skill_level(object, @skill_tree.tree_id)])
- @skill_tree.refresh
- @info_window.refresh
- @skill_tree.activate
- end
-
- end
复制代码 |
|