| 
 Dervvulfman's Skill Tree (Micko's) Passive Skill Malfunction! - reiji1337 -  04-27-2017
 
 Hi guys, sorry to make my first post a question! But I got a strange problem,
 
 I'm using Micko's Skill Tree (revised by Dervvulfman I believe) and did the passive tree thing, but then what ended up happening is the passive stats is applied to ALL of my actors.  Not only that, the strangest part is its doing so without any addition to the skill tree at all!
 
 
 
 Code: #==============================================================================# ** MicKo's Skill Tree - Revised
 #------------------------------------------------------------------------------
 #  by DerVVulfman (January 6, 2016)
 #  based on MicKo's work from February 28, 2011
 #  Version 1.6
 #  RPGMaker XP / RGSS
 #==============================================================================
 #
 #  INTRODUCTION:
 #
 #  This system allows you to craft a skill tree  such as those in games like
 #  Diablo or some Final Fantasy RPGs.  Earlier systems required the crafting
 #  of these with elaborate events systems, but no more.
 #
 #  Not only can the player select skills from the tree by spending points to
 #  acquire them,  but may also increase or advance a skill from one skill to
 #  another.   Unlike MicKo's original system, this revised version keeps the
 #  changed skills solely for the individual actor.  In the previous version,
 #  any changes to a skill would affect all users of that partucular skill...
 #  but no longer will with this version.
 #
 #  There are added bonuses to this system. Through this system, you can make
 #  a skill give bonus  'passive'  effects to an actor, allowing them to gain
 #  or lose stats and/or maximum health scores.  However,  the passive skills
 #  feature from MicKo's original version was removed.
 #
 #  And skills may increase if additional points are added to an already gained
 #  skill, if that skill allows
 #
 #------------------------------------------------------------------------------
 #
 #  SCRIPT CALL
 #
 #  $scene = Scene_SkillTree.new(actor_index[, from_map])
 #     -or-
 #  skilltree(actor_index[, from_map])
 #
 #  actor_index    This is the index value of the actor in your party, not in
 #                 your actor's database.  Thus an actor_index of 0 would set
 #                 the system to display your party leader.  Default = 0
 #
 #  from_map       This is a true/false value that indicates if you are using
 #                 this feature from a menu or from the field map.  If set to
 #                 true, the system exits straight to the field map.  But if
 #                 set to false, the system goes straight to the main menu.
 #                 By default, it is set to false so you return to the menu.
 #
 #                                *    *    *
 #
 #  NOTE:  The first script call method is advised if being used in a custom
 #         menu system.
 #
 #==============================================================================
 #
 #  COMPATABILITY
 #
 #  Rewrites the pdef and mdef methods in Game_Battler (683 & 693)
 #  Rewrites the refresh method in Window_Skill (1072, noted the changed lines)
 #
 #==============================================================================
 #
 #  CREDITS AND THANKS
 #
 #  Definite thanks to MicKo who crafted the bulk of this fine system.  And
 #  thank to finalholylight who noted a rank leveling issue in the original
 #  version.
 #
 #==============================================================================
 
 
 
 #==============================================================================
 #
 #    **   C  O  N  F  I  G  U  R  A  T  I  O  N      M  O  D  U  L  E   **    #
 #
 #  For purposes of ease, the configuration section, module SkillTree, has been
 #  broken down into parts.  These parts relate to the actors, the skill tree
 #  layout, default texts, and the like.  Please study it.
 #
 #==============================================================================
 
 module SkillTree
 #--------------------------------------------------------------------------
 # * SYSTEM REQUIRED HASHES - DO NOT TOUCH -
 #--------------------------------------------------------------------------
 STARTING_POINTS, RANKS, POINT_COST, TREE_COST, PREREQUISITES  = {},{},{},{},{}
 PASSIVE_EFFECT, BACKGROUND_LIST, INFOBACKGROUND_LIST, BOOKS   = {},{},{},{}
 #--------------------------------------------------------------------------
 
 
 
 #--------------------------------------------------------------------------
 # * PART I:  STARTUP OPTIONS
 #--------------------------------------------------------------------------
 
 # == ACTOR POINTS ==
 # This sets how many points your actor has when starting. Default = 0
 #
 #            Actor ID     Points given to actor
 # ===================     ======================
 STARTING_POINTS[1]    = 0
 STARTING_POINTS[2]    = 0
 
 
 # == CLASS ACTOR BEHAVIOR ==
 # This sets whether the tree system is based on individual trees for the
 # actor or are skill trees shared among character classes. Default = false
 #
 # ===================
 CLASS_TREE_START    = true
 
 
 
 #--------------------------------------------------------------------------
 # * PART II:  BOOK ITEM OPTIONS
 #--------------------------------------------------------------------------
 
 # == BOOKS  ==
 # This is fairly straight forward.  This identifies an item as a book
 # in which an actor can use to either learn a skill or advance an al-
 # ready learned skill if the skill itself can be advanced.  The ID of
 # the skill learned can be any.  But note that advancable skills should
 # use the ID of the starting skill (ie, the original skill).
 #
 #             Item ID     Base Skill ID(s)
 # ===================     ======================
 BOOKS[33]             = [1, 10]
 
 
 
 #--------------------------------------------------------------------------
 # * PART III:  BOARD DESIGN
 #--------------------------------------------------------------------------
 
 # == SPACING SYSTEM ==
 # This set of arrays handles the spacing of the skill icons displayed in
 # the skill tree.  The first set handles how much space is between the
 # individual skills, both horzontally and vertically.  The second sets
 # how far the icons are from the top and left-most edge of the grid.
 #
 # Syntax:         = [ horiz, vert ]
 #
 SKILL_SPACING   = [20, 20]  # Distance (in px) between skills in grid.
 BORDER_SPACING  = [10, 10]  # Distance (in px) from top-left grid corner.
 
 
 # == THE SKILL TREE ==
 # This literally defines your skill tree. Each tree is a hash array made up
 # of a collection of Skill IDs or nil values that are drawn on your screen.
 # Nil values  act as spaces  between the  individual skills  in the  trees.
 # And each actor or class may have one or more skill tree branches assigned
 # to him or her.
 #                            *    *    *
 # Each row in the hash array tree is defined in this syntax / manner...
 #         Row number => [ Skill ID, Skill ID,... Skill ID ]
 # ... and each row of data  for a given tree  must have  the same number of
 # values.   So if the first row has five IDs,  the second row must likewise
 # have five IDs, and so on.
 #                            *    *    *
 # Trees must be uniformly designed,  and every row  within each branch must
 # have the same number of objects.
 #
 #                            *    *    *
 # It is possible to use  predefined skill trees  and place them  within the
 # arrays of one  or more trees as you can see below.  Originally, the trees
 # for the 2nd tree had to be written within its own skill array. But as you
 # can see below, copies of this tree were made and placed  within that of
 # the 3rd skill tree.
 #                            *    *    *
 # Syntax:  SKILLS_ROWS = [{Row number => [skill id, skill id, ...]}]
 # -------------------------------------------------------------------------
 SKILLS_ROWS     = {}  # Do Not Touch
 # -------------------------------------------------------------------------
 # --- First Skill Tree (either 1st actor's or 1st character class's ---
 SKILLS_ROWS[1]  = [ { 0 => [nil, 57, nil],
 1 => [nil, nil, 60],
 2 => [nil, nil, 61],
 3 => [nil, 62, nil] }   ]
 # -------------------------------------------------------------------------
 # --- Second Skill Tree (either 2nd actor's or 2nd character class's ---
 # --- Note that TWO tree branches are present in this tree -------------
 SKILLS_ROWS[2]  = [ { # Tree 1
 0 => [nil  , nil  , 1, nil, nil],
 1 => [6 , nil , 9, nil, 3],
 2 => [nil, nil , nil, nil, nil],
 3 => [7, 8, nil, nil, nil],
 4 => [nil, nil , nil, nil, nil]}
 ]
 SKILLS_ROWS[3]  = [ { # Tree 1
 0 => [7  , 1  , nil, nil, nil, nil, nil, nil, nil],
 1 => [19 , 14 , nil, nil, nil, nil, nil, nil, nil],
 2 => [30 , 26 , nil, nil, nil, nil, nil, nil, nil],
 3 => [nil, nil, 10 , nil, nil, nil, nil, nil, nil],
 4 => [nil, 33 , 21 , nil, nil, nil, nil, nil, nil]}
 ]
 SKILLS_ROWS[4]  = [ { # Tree 1
 0 => [7  , 1  , nil, nil, nil, nil, nil, nil, nil],
 1 => [19 , 14 , nil, nil, nil, nil, nil, nil, nil],
 2 => [30 , 26 , nil, nil, nil, nil, nil, nil, nil],
 3 => [nil, nil, 10 , nil, nil, nil, nil, nil, nil],
 4 => [nil, 33 , 21 , nil, nil, nil, nil, nil, nil]}
 ]
 # -------------------------------------------------------------------------
 # --- Tree Branch Definitions - Individually made prior to use in Tree  ---
 # --- Tree Branch 1 -------------------------------------------------------
 TREE_BRANCH1 =       {0 => [7  , 1  , nil, nil, ],
 1 => [19 , 14 , nil, nil, ],
 2 => [30 , 26 , nil, nil, ],
 3 => [nil, nil, 10 , nil, ],
 4 => [nil, 33 , 21 , nil, ]}
 # --- Tree Branch 1 -------------------------------------------------------
 TREE_BRANCH2 =       {0 => [nil, 61 , nil, nil, nil, nil, nil, nil, nil],
 1 => [62 , 63 , nil, nil, nil, nil, nil, nil, nil],
 2 => [64 , 67 , 66 , nil, nil, nil, nil, nil, nil],
 3 => [nil, nil, nil, nil, nil, nil, nil, nil, nil],
 4 => [nil, 69 , nil, nil, nil, nil, nil, nil, nil]}
 
 # -------------------------------------------------------------------------
 # --- Third Skill Tree (either 3rd actor's or 3rd character class's ---
 # --- Uses the defined tree branches from above ---
 SKILLS_ROWS[5]    = [ TREE_BRANCH1, TREE_BRANCH2 ]
 
 
 # == THE SKILL TABS ==
 # This set of arrays  defines the names  of the individual branches in each
 # tree within the system.  Not every skill tree need have an array.  But if
 # an array is defined, its recommended to have  as many 'names' or elements
 # as it does branches. So, if a tree has three branches, each branch should
 # have a name.
 #                            *    *    *
 # And if no tab set is defined for a tree, the tabs for each branch in that
 # tree will be blank.
 # -------------------------------------------------------------------------
 SKILLS_TABS = {}  # Do Not Touch
 # -------------------------------------------------------------------------
 #
 SKILLS_TABS[1] = ["Arthur"]
 SKILLS_TABS[2] = ["Chitose"]
 SKILLS_TABS[3] = ["Nagato"]
 SKILLS_TABS[4] = ["Axel"]
 
 
 #--------------------------------------------------------------------------
 # * PART IV:  SKILL REQUIREMENTS
 #--------------------------------------------------------------------------
 
 # == POINTS COST ==
 # Default is set to 1, so if you want all your skills to cost 1 skill point,
 # just leave this blank.
 #
 #              Skill ID   Point Cost for Skill
 # =====================   ======================
 POINT_COST[1]           = 1
 
 
 # == TREE SYSTEM SPENDING POINTS ==
 # Skills are only unlocked when 'X' amount of points have been spent in
 # total within the skill tree.
 #
 #              Skill ID   Prerequisite Skill IDs
 # =====================   ======================
 TREE_COST[1]    = 0
 TREE_COST[7]   = 5       # Must spend at least 5 points in total
 TREE_COST[8]   = 5       # Must spend at least 5 points in total
 TREE_COST[9]   = 0       # Must spend at least 5 points in total
 
 
 # == RANK ==
 # Skills that may increase and change when more points are applied.
 # The actual skill increases to the next one in the array.
 #
 RANKS[3]                = [4,5]
 
 
 
 # == PREREQUISITES ==
 # Skills that are required before gaining the new one.  You can assign
 # a skill to have one or more 'required' skills which must be learned
 # before access is granted through the tree.  If the skill ID given is
 # of a ranked skill, the ranked skill must be at its maximum level be-
 # fore the skill is attainable
 #
 #              Skill ID   Prerequisite Skill IDs
 # =====================   ======================
 PREREQUISITES[3]       = 1       # Skill 10 requires Skill 1 at max rank
 PREREQUISITES[6]       = 1       # Skill 14 requires Skill 1 at max rank
 PREREQUISITES[7]       = 6  # Skill 19 requires both Skill 7 and 14
 PREREQUISITES[8]       = 6      # .... to be at max rank (ie 9 & 18)
 PREREQUISITES[9]       = 1      # .... to be at max rank (ie 9 & 18)
 
 # == PASSIVE EFFECT:  ACTOR ==
 # Skills within this group will give the actor bonuses to their max HP,
 # Strength, Physical Defense and like scores.  The skill must be learned
 # within the Skill Tree for the bonuses to take effect.
 #
 # Syntax:  [ MaxHP+, MaxSP+, STR+, DEX+, AGI+, INT+, PDEF+, MDEF+ ]
 #
 #              Skill ID   Passive effect changes
 # =====================   ======================
 PASSIVE_EFFECT[3]     =  [0,0,10,0,0,0,10,10]
 PASSIVE_EFFECT[4]     =  [0,0,20,0,0,0,20,20]
 PASSIVE_EFFECT[5]     =  [0,0,20,0,0,0,20,20]
 PASSIVE_EFFECT[8]     =  [0,0,0,0,100,0,0,0]
 
 #--------------------------------------------------------------------------
 # * PART V:  VISIBILITY & FEATURES
 #--------------------------------------------------------------------------
 
 # == HIGHLIGHTED NOTICE SETTINGS ==
 # These are the values that help notify the player if a skill needs more
 # points to attain, or is used to highlight the rank value drawn over the
 # icons in the tree itself.
 #
 UNAVAILABLE_COLOR   = Color.new(255, 0, 0) # Set color to unavailable text
 RANK_DISPLAY_COLOR  = Color.new(255,0,255) # Sets color to rank in tree
 RANK_DISPLAY_SIZE   = 16                   # Adjusts rank text size
 RANK_DISPLAY_SHADOW = true                 # If rank has shadow effect
 
 
 # == WINDOW AREAS ==
 # This allows you to set the position, dimensions and opacity of the
 # individual windows of the tree system.
 #
 # Syntax = [ x, y, width, height, opacity, backopacity ]
 #
 SKILL_NAME_AREA   = [440, 416, 200,  64, 255, 100] # Actor Name
 SKILL_TABS_AREA   = [  0,   0, 440,  64, 255, 100] # Selection
 SKILL_WINDOW_AREA = [  0,  64, 440, 310, 255, 100] # Tree Area
 SKILL_INFO_AREA   = [140, 330, 500, 150,   0,   0] # Description
 SKILL_POINT_AREA  = [520,   0, 120,  64, 255, 100] # Points Remaining
 
 
 # == INFO WINDOW AREAS ==
 # This allows you to set the position, dimensions and alignment of the
 # text in the information window.  All arrays follow the same syntax.
 #
 # Syntax = [ x, y, width, height, alignment]
 # Alignment values are:   0=left, 1=right, 2=center
 # The only exception is TEXT_SKILLICON, which has no centering value.
 #
 TEXT_SKILLICON      = [  0,   0 ]             # The icon position
 TEXT_SKILLNAME      = [ 28,  -4, 400, 32, 0 ] # The Skill Name
 TEXT_SKILLRANK      = [  0,  20, 450, 32, 0 ] # The Skill's Rank
 TEXT_SKILLDESC      = [  0,  44, 450, 32, 0 ] # The Skill's Description
 TEXT_SKILLCOST      = [160,  -4, 300, 32, 2 ] # Cost to gain or level
 TEXT_SKILLSPEND     = [130,  20, 330, 32, 2 ] # Points needed spent in tree
 TEXT_SKILLREQUIRED  = [  0,  68, 450, 32, 0 ] # Required skills
 TEXT_SKILLGAIN      = [  0,  92, 450, 32, 0 ] # Skill availability
 
 
 # == SHOW/HIDE FLAGS ==
 # These values are used to show or hide certain aspects or dieplays in the
 # skill tree system.  These are simple boolean(true/false) values.
 #
 SHOW_NAME_WINDOW    = true   # Display the actor name window?
 HIDE_NAME_INACTIVE  = false  # Hide the name window if actor has no tree?
 SHOW_NEXT_SKILL     = true   # Show next available skill if can level?
 INFO_SHOW_ALL       = true   # Show info, even if skill unavailable?
 RANK_SHOW_ALL       = false  # Show rank, even non ranking skills?
 RANK_SHOW_ZERO      = false  # Show if rank is currently '0'
 SHOW_ALL_TREE       = true   # Show the arrows & rank to possible skills?
 
 
 # == SKILL AVAILABILITY OPACITIES ==
 # This sets how solid or transparent icons are, based on the skill's avail-
 # ability.   The first three values  in the array  govern the icons for the
 # actual skills while the fourth deals with  the opacity of the unavailable
 # icon that is typically drawn overtop.
 #
 # The opacity settings are a range of 0 to 255, with 255 being more opaque.
 #
 # Syntax:  = [ Learned,  Learnable, Unavailable, Unavailable-Icon]
 #
 SKILL_AVAILABLE = [255, 125, 255, 255]
 
 
 
 #--------------------------------------------------------------------------
 # * PART VI:  CUSTOM GRAPHICS
 #--------------------------------------------------------------------------
 
 # == SKILL TREE ARROWS ==
 # These three arrays hold the arrow graphics, corner graphics and the
 # horizontal and vertical line graphics drawn in the skill tree.  It
 # should be self-explanatory.  All these graphics are stored within
 # the Graphics\SkillGree folder.
 #
 ARROW_ARRAY   = ["arrowdown", "arrowup", "arrowleft", "arrowright" ]
 CORNER_ARRAY  = ["corner1",   "corner2", "corner3",   "corner4" ]
 LINE_ARRAY    = ["linehoriz", "linevert" ]
 
 
 # == UNAVAILABLE SYMBOL ICON ==
 # This is a graphic that is drawn overtop of skills that cannot be
 # selected.  If you do not wish to use this feature, just set it to nil.
 # The icon, like the other graphics used in this system, are stored in
 # the Graphics\SkillTree folder.
 #
 UNAVAILABLE_ICON = "Unavailable"
 
 
 # == BACKGROUND ==
 # This is the background image shown when the skill tree is running.  It
 # may be drawn behind the windows of the system, and concealed if the
 # windows are not set to a transparent setting (see WINDOW AREAS for
 # opacity settings).
 #
 # Optionally, it may be set to nil for no image background, or set to a
 # value of -1 if you opt for the field map as a background.
 #
 # All backgrounds and like images for this system are cached within the
 # Graphics\SkillTree folder
 #
 WINDOW_BACKGROUND   = -1
 
 
 # == BACKGROUND ARRAY ==
 # This array collection defines the background images of each skill tree
 # for each actor in your database.  Unlike the SKILL_TABS array, this one
 # need not match up with the SKILLS_ROWS array.  The image stored within
 # the WINDOW_BACKGROUND value will be used in its place if not found. But
 # if you were to have an actor has four skill trees defined for him alone,
 # this array should have an array containing all four background images.
 #
 # All backgrounds and like images for this system are cached within the
 # Graphics\SkillTree folder.
 #
 # You only need to identify the actor or actors, and their collection of
 # images.  Any not listed are assumed to have no background array images
 # and will use the previously defined background image from the above
 # system.
 #
 #
 BACKGROUND_LIST[2] = []   # Basil's images
 BACKGROUND_LIST[5] = []             # Estelle's image
 
 
 # == INFO WINDOW BACKGROUND ==
 # This is the background image optionally used by the Skill Information
 # window.  The image is still drawn overtop of the main Skill Tree win-
 # dow, but behind the information window so the windowskin and opacities
 # may influence its appearance.  Please make sure you create an image
 # large enough to accommodate your window area.  It does not stretch the
 # image to fit.
 #
 # Optionally, just enter nil to avoid using it.
 #
 # And all backgrounds and like images for this system are cached within the
 # Graphics\SkillTree folder
 #
 INFOBACKGROUND   = "info"
 
 
 # == INFOW WINDOW ARRAY ==
 # This array collection defines the background images for the information
 # window that matches the skill trees for each actor in the database.  It
 # works exactly like the BACKGROUND ARRAY system (above) but only relates
 # to the information window.
 #
 # All backgrounds and like images for this system are cached within the
 # Graphics\SkillTree folder
 #
 #
 INFOBACKGROUND_LIST[2] =[nil, "info2"]    # Basil's info box
 # Changes in the 2nd
 # tab of his tree.
 
 
 
 #--------------------------------------------------------------------------
 # * PART VII:  INFO WINDOW DIALOG
 #--------------------------------------------------------------------------
 # PURPOSE:  Internationalism.  This section allows the end user to change
 #           the text used in the system depending on his/her own language.
 
 # == SKILL POINT TEXT ==
 # This array holds the text for both singular and plural versions of the
 # skill points text shown.
 #
 SKILLPOINTS_NAME = ["Skill Point", "Skill Points"]
 
 
 # == RANK SCORE TEXT ==
 # Thexe strings set the text that displays the skill's current rank. The
 # text ' {rank_score} ' is a required placeholder that is filled with the
 # actual rank score.
 #
 RANK_TEXT_1 = "Current Rank : {rank_score}"   # If the skill has a rank
 RANK_TEXT_2 = "Current Rank : 0"              # If the skill has no rank
 
 
 # == REQUIRED POINTS TEXT ==
 # These strings set the text that displays how many points are needed
 # to be spent to obtain the skill or to increase that skill's rank/level.
 # And one to display how many points need to be spent in total in the tree.
 # The text ' {point_score} ' is a required placeholder that is filled with
 # the points needed, while the ' {point_text} ' value is a placeholder
 # filled with the text from the SKILLPOINTS_NAME array, whether it is
 # singular or plural.
 #
 POINT_COST_1      = "Requires {point_score} {point_text}"
 POINT_COST_2      = "Requires {point_score} {point_text} to level"
 POINT_COST_3      = "Requires {point_score} {point_text} used in Tree"
 
 
 
 # == SKILL ACCESS TEXT ==
 # This string sets the text that displays if a skill is acquired, leveled
 # to its maximum rank, has another level attainable, or unavailable.
 #
 ACQUIRED_TXT        = "Skill acquired"
 ACQUIRED_LEVEL      = "Maximum level acquired"
 NEXT_RANKING_SKILL  = "Next Skill:  "
 UNAVAILABLE         = "Unavailable."
 
 
 # == SKILL PREREQUISITES TEXT ==
 # This string sets the text that displays if you need prerequisite skills
 # to garner the new skill.
 #
 SKILLS_REQ        = "Skills Required: "
 
 
 
 end
 
 
 
 #==============================================================================
 # ** RPG::Cache
 #------------------------------------------------------------------------------
 #  A module that loads each of RPGXP's graphic formats, creates a Bitmap
 #  object, and retains it.
 #==============================================================================
 
 module RPG::Cache
 #--------------------------------------------------------------------------
 # * SkillTree Image Folder
 #--------------------------------------------------------------------------
 def self.skilltree(filename)
 self.load_bitmap("Graphics/SkillTree/", filename)
 end
 end
 
 
 
 #==============================================================================
 # ** RPG::Skill
 #------------------------------------------------------------------------------
 #  Data class for skills.
 #==============================================================================
 
 class RPG::Skill
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_reader :need_update
 #--------------------------------------------------------------------------
 # * Alias Listings
 #--------------------------------------------------------------------------
 alias skilltree_rpgskill_initialize initialize
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
 # Perform the original call
 skilltree_rpgskill_initialize
 # Add Skilltree values
 @rank         = 1
 @need_update  = true
 end
 #--------------------------------------------------------------------------
 # * Set Update Needed
 #--------------------------------------------------------------------------
 def need_update=(need_update)
 @need_update = need_update
 end
 #--------------------------------------------------------------------------
 # * Get Skill Point Cost
 #--------------------------------------------------------------------------
 def skill_points_cost
 value = (SkillTree::POINT_COST[@id].nil?) ? 1 : SkillTree::POINT_COST[@id]
 return value
 end
 #--------------------------------------------------------------------------
 # * Get Skill Tree Spending Points Needed
 #--------------------------------------------------------------------------
 def spentpoints_needed
 value = SkillTree::TREE_COST.include?(@id) ? SkillTree::TREE_COST[@id] : 0
 return value
 end
 #--------------------------------------------------------------------------
 # * Defines skill's line
 #--------------------------------------------------------------------------
 def line(actor, tree)
 for i in $game_actors[actor].initialskills[tree].keys
 if $game_actors[actor].initialskills[tree][i].include?(@id)
 @goodline = i
 return @goodline
 end
 end
 end
 #--------------------------------------------------------------------------
 # * Defines skill's position in line
 #--------------------------------------------------------------------------
 def position(actor, tree)
 return if @goodline.nil?
 for i in 0...$game_actors[actor].initialskills[tree][@goodline].size
 if $game_actors[actor].initialskills[tree][@goodline][i] == (@id)
 @goodposition = i
 return @goodposition
 end
 end
 end
 #--------------------------------------------------------------------------
 # * Defines skill's x position
 #--------------------------------------------------------------------------
 def x
 (24 + SkillTree::SKILL_SPACING[0]) * @goodposition +
 SkillTree::BORDER_SPACING[0]
 end
 #--------------------------------------------------------------------------
 # * Defines skill's y position
 #--------------------------------------------------------------------------
 def y
 (24 + SkillTree::SKILL_SPACING[1]) * @goodline +
 SkillTree::BORDER_SPACING[1]
 end
 end
 
 
 
 #==============================================================================
 # ** Game_Battler
 #------------------------------------------------------------------------------
 #  This class deals with battlers. It's used as a superclass for the Game_Actor
 #  and Game_Enemy classes.
 #==============================================================================
 
 class Game_Battler
 #--------------------------------------------------------------------------
 # * Alias Listings
 #--------------------------------------------------------------------------
 alias skilltree_game_battler_initialize initialize
 alias skilltree_game_battler_skill_can_use? skill_can_use?
 alias skilltree_game_battler_skill_effect skill_effect
 alias skilltree_game_battler_item_effect item_effect
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
 @pdef_plus = 0
 @mdef_plus = 0
 # Perform the original call
 skilltree_game_battler_initialize
 end
 #--------------------------------------------------------------------------
 # * Set Pdef
 #     pdef : new Pdef
 #--------------------------------------------------------------------------
 def pdef=(pdef)
 @pdef_plus += pdef - self.pdef
 end
 #--------------------------------------------------------------------------
 # * Set Mdef
 #     mdef : new Mdef
 #--------------------------------------------------------------------------
 def mdef=(mdef)
 @mdef_plus += mdef - self.mdef
 end
 #--------------------------------------------------------------------------
 # * Get Physical Defense Power
 #--------------------------------------------------------------------------
 def pdef
 n = base_pdef + @pdef_plus
 for i in @states
 n *= $data_states[i].pdef_rate / 100.0
 end
 return Integer(n)
 end
 #--------------------------------------------------------------------------
 # * Get Magic Defense Power
 #--------------------------------------------------------------------------
 def mdef
 n = base_mdef + @mdef_plus
 for i in @states
 n *= $data_states[i].mdef_rate / 100.0
 end
 return Integer(n)
 end
 #--------------------------------------------------------------------------
 # * Determine Usable Skills
 #     skill_id : skill ID
 #--------------------------------------------------------------------------
 def skill_can_use?(skill_id)
 if self.is_a?(Game_Actor)
 for skill in @skills
 if SkillTree::RANKS.has_key?(skill)
 if SkillTree::RANKS[skill].include?(skill_id)
 skill_id = skill
 break
 end
 end
 end
 end
 return skilltree_game_battler_skill_can_use?(skill_id)
 end
 #--------------------------------------------------------------------------
 # * Apply Skill Effects
 #     user  : the one using skills (battler)
 #     skill : skill
 #--------------------------------------------------------------------------
 def skill_effect(user, skill)
 if self.is_a?(Game_Actor)
 id = skill.id
 new_id = @skill_id[id]
 skill = $data_skills[new_id]
 end
 return skilltree_game_battler_skill_effect(user, skill)
 end
 #--------------------------------------------------------------------------
 # * Application of Item Effects
 #     item : item
 #--------------------------------------------------------------------------
 def item_effect(item)
 # Perform Book Effect and return effective
 book_effective = book_effect(item)
 # The original call
 effective = skilltree_game_battler_item_effect(item)
 # Return effective (true if either original or book is true, else false)
 return book_effective if book_effective == true
 return effective
 end
 #--------------------------------------------------------------------------
 # * Application of Book Effects
 #     item : item
 #--------------------------------------------------------------------------
 def book_effect(item)
 effective = false
 if SkillTree::BOOKS.has_key?(item.id)
 skill_list       = SkillTree::BOOKS[item.id]
 for skill in skill_list
 rank        = @skill_level[skill]
 rank_max    = 0
 if SkillTree::RANKS.has_key?(skill)
 rank_max  =  SkillTree::RANKS[skill].size
 end
 if !skill_check(skill)
 update_add_skill(skill)
 effective = true
 elsif rank < rank_max && skill_check(skill)
 update_increase_skill(skill)
 effective = true
 end
 end
 end
 return effective
 end
 #--------------------------------------------------------------------------
 # * Check if Finished Learning Skill Including Ranked Skills
 #     skill_id : skill ID
 #--------------------------------------------------------------------------
 def skill_check(skill_id)
 for skill in @skills
 if SkillTree::RANKS.has_key?(skill)
 return true if SkillTree::RANKS[skill].include?(skill_id)
 end
 end
 return @skills.include?(skill_id)
 end
 #--------------------------------------------------------------------------
 # * Frame Update (updating with new skill not learned)
 #--------------------------------------------------------------------------
 def update_add_skill(skill)
 learn_skill(skill)
 $data_skills[skill].need_update = true
 update_actor_tree_passive_effects(skill)
 end
 #--------------------------------------------------------------------------
 # * Learn Skill
 #     skill_id : skill ID
 #--------------------------------------------------------------------------
 def learn_skill(skill_id)
 return unless (skill_id > 0 and not skill_learn?(skill_id))
 @skills.push(skill_id)
 @skills.sort!
 end
 #--------------------------------------------------------------------------
 # * Frame Update (updating new skill that was learned)
 #--------------------------------------------------------------------------
 def update_increase_skill(skill)
 rank_max  =  SkillTree::RANKS[skill].size
 rank      = @skill_level[skill]
 @skill_level[skill] += 1
 $data_skills[skill].need_update = true
 new_id = SkillTree::RANKS[skill][@skill_level[skill]-1]
 update_skill(skill, new_id)
 end
 #--------------------------------------------------------------------------
 # * Update actor skill (based on new learned skill)
 #--------------------------------------------------------------------------
 def update_skill(id, new_id)
 return if skill_id[id] == $data_skills[new_id].id
 @skill_id[id]               = $data_skills[new_id].id
 @skill_icon_name[id]        = $data_skills[new_id].icon_name
 update_actor_tree_passive_effects(id)
 return
 end
 #--------------------------------------------------------------------------
 # * Update actor stats (support for passive skills)
 #--------------------------------------------------------------------------
 def update_actor_tree_passive_effects(skill)
 # Get Current 'recorded' Skill ID
 current_skill = @skill_id[skill]
 # Get Previous 'recorded' Skill ID
 prev_skill    = update_actor_prev_skill_rank_id(skill_id)
 # Perform passive effect removal and additions
 update_actor_passive_removal(prev_skill)
 update_actor_passive_addition(current_skill)
 end
 #--------------------------------------------------------------------------
 # * Determine previous skill ID from Skill Rank Chain if any
 #     skill_id : skill ID
 #--------------------------------------------------------------------------
 def update_actor_prev_skill_rank_id(skill_id)
 # Get Previous 'recorded' Skill ID
 target_id    = nil
 for skills in @skills
 next unless SkillTree::RANKS.has_key?(skills)
 test = SkillTree::RANKS[skills]
 ind = test.index(skill_id)
 unless ind.nil?
 target_id = test[ind-1] if ind > 0
 end
 end
 return target_id
 end
 #--------------------------------------------------------------------------
 # * Decrease actor stats from losing passive effect skill
 #     skill_id : skill ID
 #--------------------------------------------------------------------------
 def update_actor_passive_removal(skill_id)
 return if skill_id.nil?
 return unless SkillTree::PASSIVE_EFFECT.has_key?(skill_id)
 self.maxhp  -= SkillTree::PASSIVE_EFFECT[skill_id][0]
 self.maxsp  -= SkillTree::PASSIVE_EFFECT[skill_id][1]
 self.str    -= SkillTree::PASSIVE_EFFECT[skill_id][2]
 self.dex    -= SkillTree::PASSIVE_EFFECT[skill_id][3]
 self.agi    -= SkillTree::PASSIVE_EFFECT[skill_id][4]
 self.int    -= SkillTree::PASSIVE_EFFECT[skill_id][5]
 self.pdef   -= SkillTree::PASSIVE_EFFECT[skill_id][6]
 self.mdef   -= SkillTree::PASSIVE_EFFECT[skill_id][7]
 end
 #--------------------------------------------------------------------------
 # * Increase actor stats after adding passive effect skill
 #     skill_id : skill ID
 #--------------------------------------------------------------------------
 def update_actor_passive_addition(skill_id)
 return unless SkillTree::PASSIVE_EFFECT.has_key?(skill_id)
 self.maxhp  += SkillTree::PASSIVE_EFFECT[skill_id][0]
 self.maxsp  += SkillTree::PASSIVE_EFFECT[skill_id][1]
 self.str    += SkillTree::PASSIVE_EFFECT[skill_id][2]
 self.dex    += SkillTree::PASSIVE_EFFECT[skill_id][3]
 self.agi    += SkillTree::PASSIVE_EFFECT[skill_id][4]
 self.int    += SkillTree::PASSIVE_EFFECT[skill_id][5]
 self.pdef   += SkillTree::PASSIVE_EFFECT[skill_id][6]
 self.mdef   += SkillTree::PASSIVE_EFFECT[skill_id][7]
 end
 end
 
 
 
 #==============================================================================
 # ** Game_Actor
 #------------------------------------------------------------------------------
 #  This class handles the actor. It's used within the Game_Actors class
 #  ($game_actors) and refers to the Game_Party class ($game_party).
 #==============================================================================
 
 class Game_Actor < Game_Battler
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_accessor :skill_level              # Skill level or rank attained
 attr_accessor :skill_id                 # Revised Skill ID (New skill)
 attr_accessor :skill_icon_name          # Revised Skill Icon Used
 attr_accessor :skillpoints              # Initial Tree System Skill Points
 attr_accessor :initialskills            # Initial Skills in Tree System
 attr_accessor :skills_used              # Tree System Skills Flagged
 attr_accessor :points_spent             # Total Points Spent in Tree
 #--------------------------------------------------------------------------
 # * Alias Listings
 #--------------------------------------------------------------------------
 alias skilltree_game_actor_setup setup
 alias skilltree_game_actor_skill_can_use? skill_can_use?
 #--------------------------------------------------------------------------
 # * Setup
 #     actor_id : actor ID
 #--------------------------------------------------------------------------
 def setup(actor_id)
 # Perform the original call
 skilltree_game_actor_setup(actor_id)
 # Set Skill Tree Data
 @skillpoints      = 0
 @points_spent     = 0
 @skill_level      = []
 @skill_id         = []
 @skill_icon_name  = []
 @passive_skills   = []
 @skills_used      = []
 @initialskills    = []
 # Create individual (adjustable) list per actor
 for id in 1...$data_skills.size
 @skill_level[id]      = 0
 @skill_id[id]         = $data_skills[id].id
 @skill_icon_name[id]  = $data_skills[id].icon_name
 unless $data_skills[id].nil?
 update_actor_tree_passive_effects(id)
 end
 end
 # Reupdate HP and SP if changed
 @hp = maxhp
 @sp = maxsp
 # Skip if no tree
 return if SkillTree::SKILLS_ROWS[actor_id].nil?
 switch_id = (SkillTree::CLASS_TREE_START == true) ? @class_id : actor_id
 # Loop through skill tree
 for i in 0...SkillTree::SKILLS_ROWS[switch_id].size
 # Determine how many rows in selected tree
 cnt = SkillTree::SKILLS_ROWS[switch_id][i].size
 # Create a temp array
 temparray = []
 # Loop through rows in tree branch
 for j in 0..cnt-1
 # Add each row into temp data array
 temparray = temparray + SkillTree::SKILLS_ROWS[switch_id][i][j]
 end
 # Add temp data
 @skills_used[i] = temparray
 @skills_used[i].flatten!
 @initialskills[i] = SkillTree::SKILLS_ROWS[switch_id][i]
 end
 # Add Points to actors
 if SkillTree::STARTING_POINTS[actor_id] != nil
 @skillpoints = SkillTree::STARTING_POINTS[actor_id]
 end
 # Delete Skill Used
 @skills_used.delete(nil)
 end
 #--------------------------------------------------------------------------
 # * Check if actor can learn skill
 #     skill_id : skill ID
 #     tree     : Tree
 #--------------------------------------------------------------------------
 def can_learn?(id, tree)
 return false unless ( (was_used?(id, tree) || can_rank?(id, tree) ||
 !skill_learn?(id)) && enough_points?(id) && enough_points_spent?(id))
 # Return true if no needed prereqisites
 return true if SkillTree::PREREQUISITES[id].nil?
 # Handle multiple Prerequisites for a skill
 if SkillTree::PREREQUISITES[id].is_a?(Array)
 id_array = SkillTree::PREREQUISITES[id]
 if SkillTree::PREREQUISITES[id].all? {|v|
 if SkillTree::RANKS.has_key?(v)
 skill_learn?(v) && @skill_id[v] == ranked_skill(v)
 else
 skill_learn?(v)
 end
 }
 return true
 end
 # Handle multiple Prerequisites for a skill
 else
 pid = SkillTree::PREREQUISITES[id]
 flag_passed = false
 if SkillTree::RANKS.has_key?(pid)
 flag_passed = skill_learn?(pid) && @skill_id[pid] == ranked_skill(pid)
 else
 flag_passed = skill_learn?(pid)
 end
 return true if flag_passed
 end
 # End Method
 return false
 end
 #--------------------------------------------------------------------------
 # * Check highest ranked skill in list
 #     skill_id : skill ID
 #--------------------------------------------------------------------------
 def ranked_skill(skill_id)
 placement = (SkillTree::RANKS[skill_id].size)-1
 value     = SkillTree::RANKS[skill_id][placement]
 return value
 end
 #--------------------------------------------------------------------------
 # * Determine Usable Skills
 #     skill_id : skill ID
 #--------------------------------------------------------------------------
 def skill_can_use?(skill_id)
 for skill in @skills
 if SkillTree::RANKS.has_key?(skill)
 if SkillTree::RANKS[skill].include?(skill_id)
 skill_id = skill
 break
 end
 end
 end
 return skilltree_game_actor_skill_can_use?(skill_id)
 end
 #--------------------------------------------------------------------------
 # * Check if actor used skill in tree
 #     id       : skill ID
 #     tree     : Tree
 #--------------------------------------------------------------------------
 def was_used?(id, tree)
 (@skills_used[tree].include?(skill_id))
 end
 #--------------------------------------------------------------------------
 # * Check if actor can increase skill rank
 #     id       : skill ID
 #     tree     : Tree
 #--------------------------------------------------------------------------
 def can_rank?(id, tree)
 rank_max = 1
 if SkillTree::RANKS.has_key?(id)
 rank_max = SkillTree::RANKS[id].size + 1
 end
 (@skills_used[tree].include?(id) && skill_learn?(id) && rank_max > 1)
 end
 #--------------------------------------------------------------------------
 # * Check if actor has enough points
 #     id       : skill ID
 #     tree     : Tree
 #--------------------------------------------------------------------------
 def enough_points?(id)
 (@skillpoints >= $data_skills[id].skill_points_cost)
 end
 #--------------------------------------------------------------------------
 # * Check if actor has spent enough points in tree
 #     id       : skill ID
 #     tree     : Tree
 #--------------------------------------------------------------------------
 def enough_points_spent?(id)
 $data_skills[id].spentpoints_needed <= @points_spent
 end
 end
 
 
 
 #==============================================================================
 # ** Window_Base
 #------------------------------------------------------------------------------
 #  This class is for all in-game windows.
 #==============================================================================
 
 class Window_Base < Window
 #--------------------------------------------------------------------------
 # * Reset the font
 #--------------------------------------------------------------------------
 def reset_font
 self.contents.font.name           = Font.default_name
 self.contents.font.size           = Font.default_size
 self.contents.font.color          = Font.default_color
 end
 end
 
 
 
 #==============================================================================
 # ** Window_Skill
 #------------------------------------------------------------------------------
 #  This window displays usable skills on the skill and battle screens.
 #==============================================================================
 
 class Window_Skill < Window_Selectable
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
 if self.contents != nil
 self.contents.dispose
 self.contents = nil
 end
 @data = []
 for i in 0...@actor.skills.size
 skill = $data_skills[@actor.skills[i]]
 if skill != nil
 # -- ( Changed Code Between Comment Set ) ---------------------------
 new_id    = @actor.skill_id[skill.id]
 skill = $data_skills[new_id]
 # -- ( Changed Code Between Comment Set ) ---------------------------
 @data.push(skill)
 end
 end
 # If item count is not 0, make a bit map and draw all items
 @item_max = @data.size
 if @item_max > 0
 self.contents = Bitmap.new(width - 32, row_max * 32)
 for i in 0...@item_max
 draw_item(i)
 end
 end
 end
 end
 
 
 
 #==============================================================================
 # ** Window_SkillTreeName
 #------------------------------------------------------------------------------
 #  This window class contains all skill tree choice display functions
 #==============================================================================
 
 class Window_SkillTreeName < Window_Selectable
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize(actor_index)
 super(SkillTree::SKILL_NAME_AREA[0], SkillTree::SKILL_NAME_AREA[1],
 SkillTree::SKILL_NAME_AREA[2], SkillTree::SKILL_NAME_AREA[3])
 width             = SkillTree::SKILL_NAME_AREA[2] - 32
 height            = SkillTree::SKILL_NAME_AREA[3] - 32
 self.contents     = Bitmap.new(width, height)
 self.opacity      = SkillTree::SKILL_NAME_AREA[4]
 self.back_opacity = SkillTree::SKILL_NAME_AREA[5]
 @actor            = $game_party.actors[actor_index]
 refresh
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
 self.contents.clear
 draw_actor_name(@actor, 0, 0)
 end
 end
 
 
 
 #==============================================================================
 # ** Window_SkillTreeTabs
 #------------------------------------------------------------------------------
 #  This window class contains all skill tree choice display functions
 #==============================================================================
 
 class Window_SkillTreeTabs < Window_Selectable
 #--------------------------------------------------------------------------
 # * Public Instance Values
 #--------------------------------------------------------------------------
 attr_reader :item_max
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize(actor_index)
 super(SkillTree::SKILL_TABS_AREA[0], SkillTree::SKILL_TABS_AREA[1],
 SkillTree::SKILL_TABS_AREA[2], SkillTree::SKILL_TABS_AREA[3])
 @actor            = $game_party.actors[actor_index]
 @switch_id        = (SkillTree::CLASS_TREE_START == true) ?
 @actor.class_id : @actor.id
 @item_max         = SkillTree::SKILLS_ROWS[@switch_id].size
 @column_max       = SkillTree::SKILLS_ROWS[@switch_id].size
 @row_max          = 1
 self.index        = 0
 width             = SkillTree::SKILL_TABS_AREA[2] - 32
 height            = SkillTree::SKILL_TABS_AREA[3] - 32
 self.contents     = Bitmap.new(width, height)
 self.opacity      = SkillTree::SKILL_TABS_AREA[4]
 self.back_opacity = SkillTree::SKILL_TABS_AREA[5]
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
 self.contents.clear
 for i in 0...@item_max
 my_text = ''
 next if SkillTree::SKILLS_TABS[@switch_id].nil?
 my_text = SkillTree::SKILLS_TABS[@switch_id][i]
 next if my_text.nil?
 self.contents.draw_text( (self.width - 32) / @item_max * i, 0,
 (self.width - 32) / @item_max, 32, my_text, 1 )
 end
 end
 end
 
 
 
 #==============================================================================
 # ** Window_SkillTreeMain
 #------------------------------------------------------------------------------
 #  This window class contains all skill tree display functions
 #==============================================================================
 
 class Window_SkillTreeMain < Window_Base
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_accessor :initialskills
 attr_accessor :tree
 attr_reader   :index
 attr_reader   :item_used
 attr_reader   :line
 attr_reader   :item_max
 #--------------------------------------------------------------------------
 # * Object Initialization
 #     actor_index : actor_index
 #--------------------------------------------------------------------------
 def initialize(actor_index)
 super(SkillTree::SKILL_WINDOW_AREA[0], SkillTree::SKILL_WINDOW_AREA[1],
 SkillTree::SKILL_WINDOW_AREA[2], SkillTree::SKILL_WINDOW_AREA[3])
 @tree             = 0
 @actor            = $game_party.actors[actor_index]
 @switch_id        = (SkillTree::CLASS_TREE_START == true) ?
 @actor.class_id : @actor.id
 # Discontinue if no skill tree for actor
 return if SkillTree::SKILLS_ROWS[@switch_id].nil?
 # Initialize Skills
 initialize_skills
 @column_max       = SkillTree::SKILLS_ROWS[@switch_id][@tree][0].size
 @row_max          = SkillTree::SKILLS_ROWS[@switch_id][@tree].keys.size
 @item_max         = @item_used.size
 self.index        = 0
 width             = SkillTree::SKILL_WINDOW_AREA[2] - 32
 height            = @row_max * ( SkillTree::SKILL_SPACING[1] + 24 ) +
 SkillTree::BORDER_SPACING[1]- 16
 self.contents     = Bitmap.new(width, height)
 self.opacity      = SkillTree::SKILL_WINDOW_AREA[4]
 self.back_opacity = SkillTree::SKILL_WINDOW_AREA[5]
 # Refresh
 refresh
 end
 #--------------------------------------------------------------------------
 # * Initialize Skills list and position
 #--------------------------------------------------------------------------
 def initialize_skills
 @initialskills = @actor.initialskills[@tree]
 @item_used = @actor.skills_used[@tree]
 @item_used.flatten!
 @item_used.delete(nil)
 for i in 0...@item_used.size
 skillid = @item_used[i]
 $data_skills[skillid].line(@actor.id, @tree)
 $data_skills[skillid].position(@actor.id, @tree)
 $data_skills[skillid].need_update = true
 end
 @prerequisites = []
 end
 #--------------------------------------------------------------------------
 # * Set Cursor Position
 #--------------------------------------------------------------------------
 def index=(index)
 @index = index
 update_cursor_rect
 end
 #--------------------------------------------------------------------------
 # * Update Cursor position
 #--------------------------------------------------------------------------
 def update_cursor_rect
 if self.active
 @line     = $data_skills[@item_used[@index]].line(@switch_id, @tree)
 @position = $data_skills[@item_used[@index]].position(@switch_id, @tree)
 new_x     = $data_skills[@item_used[@index]].x
 new_y     = $data_skills[@item_used[@index]].y
 self.cursor_rect.set(new_x, new_y, 24, 24)
 else
 self.cursor_rect.empty
 end
 end
 #--------------------------------------------------------------------------
 # * Update Skill Tree Window content
 #--------------------------------------------------------------------------
 def update
 super
 # Update index
 @index = @item_used.size - 1 if @index > @item_used.size - 1
 if self.active and @item_max > 0 and @index >= 0
 @line = $data_skills[@item_used[@index]].line(@switch_id,@tree)
 @position = $data_skills[@item_used[@index]].position(@switch_id,@tree)
 # If directional button was pressed
 update_cursor_up      if Input.repeat?(Input::UP)
 update_cursor_down    if Input.repeat?(Input::DOWN)
 update_cursor_left    if Input.repeat?(Input::LEFT)
 update_cursor_right   if Input.repeat?(Input::RIGHT)
 end
 # Update cursor rectangle
 update_cursor_rect
 end
 #--------------------------------------------------------------------------
 # * Update Skill Tree Window cursor movement (UP)
 #--------------------------------------------------------------------------
 def update_cursor_up
 # Values Acquired
 curline = @line
 curpos  = @position
 moving  = checked = false
 #
 for i in 1..@line
 if @initialskills[curline - i].any? {|v| v.is_a?(Integer)}
 if @initialskills[curline - i].any? { |v|
 v != nil &&
 $data_skills[v].position(@switch_id,@tree) == @position} &&
 !moving
 # Play Cancel SE
 $game_system.se_play($data_system.cursor_se)
 # Move Index
 moving = move_type_two(curpos, curline)
 elsif i == @line
 checked = true
 end
 if @initialskills[curline - i].any? {|v|
 v != nil &&
 $data_skills[v].position(@switch_id,@tree) < @position} &&
 !@initialskills[curline - i].any? { |v|
 v != nil &&
 $data_skills[v].position(@switch_id,@tree) == @position} &&
 !moving && checked
 # Play Decision SE
 $game_system.se_play($data_system.decision_se)
 # Garner Check Position
 checkpos = check_position(curpos)
 until $data_skills[@item_used[@index]].position(@switch_id,
 @tree) < curpos &&
 $data_skills[@item_used[@index]].line(@switch_id,@tree) < curline &&
 !checkpos
 moving = true
 @index -= 1
 @newoy = false
 # Garner Check Position
 checkpos = check_position(curpos)
 end
 elsif @initialskills[curline - i].any? {|v|
 v != nil &&
 $data_skills[v].position(@switch_id,@tree) > @position} &&
 !@initialskills[curline - i].any? {|v|
 v != nil &&
 $data_skills[v].position(@switch_id,@tree) <= @position} &&
 !moving && checked
 # Play Cancel SE
 $game_system.se_play($data_system.cancel_se)
 # Garner Check Position
 checkpos = check_position(curpos)
 until $data_skills[@item_used[@index]].position(@switch_id,
 @tree) > curpos &&
 $data_skills[@item_used[@index]].line(@switch_id,@tree) < curline &&
 !checkpos
 moving = true
 @index -= 1
 @newoy = false
 # Garner Check Position
 checkpos = check_position(curpos)
 end
 end
 end
 end
 end
 #--------------------------------------------------------------------------
 # * Update Skill Tree Window cursor movement (DOWN)
 #--------------------------------------------------------------------------
 def update_cursor_down
 # Values Acquired
 curline = @line
 curpos  = @position
 moving  = checked = false
 # Sort through the tree
 for i in curline + 1...@initialskills.size
 if @initialskills[i].any? {|v| v.is_a?(Integer)}
 if @initialskills[i].any? {|v|
 v != nil &&
 $data_skills[v].position(@switch_id,@tree) == @position} &&
 !moving
 # Play Cancel SE
 $game_system.se_play($data_system.cursor_se)
 # Move Index
 moving = move_type_one(curpos, curline)
 elsif i == @initialskills.size - 1
 checked = true
 end
 if @initialskills[i].any? {|v|
 v != nil &&
 $data_skills[v].position(@switch_id,@tree) < @position} &&
 !@initialskills[i].any? {|v|
 v != nil &&
 $data_skills[v].position(@switch_id,@tree) == @position} &&
 !moving && checked
 # Play Decision SE
 $game_system.se_play($data_system.decision_se)
 # Garner Check Position
 checkpos = check_position(curpos)
 until $data_skills[@item_used[@index]].position(@switch_id,
 @tree) < curpos &&
 $data_skills[@item_used[@index]].line(@switch_id,@tree) > curline &&
 !checkpos
 moving = true
 @index += 1
 @newoy = false
 # Garner Check Position
 checkpos = check_position(curpos)
 end
 elsif @initialskills[i].any? {|v|
 v != nil &&
 $data_skills[v].position(@switch_id,@tree) > @position} &&
 !@initialskills[i].any? {|v|
 v != nil &&
 $data_skills[v].position(@switch_id,@tree) <= @position} &&
 !moving && checked
 # Play Cancel SE
 $game_system.se_play($data_system.cancel_se)
 # Garner Check Position
 checkpos = check_position(curpos)
 until $data_skills[@item_used[@index]].position(@switch_id,
 @tree) > curpos &&
 $data_skills[@item_used[@index]].line(@switch_id,@tree) > curline &&
 !checkpos
 moving = true
 @index += 1
 @newoy = false
 # Garner Check Position
 checkpos = check_position(curpos)
 end
 end
 end
 end
 end
 #--------------------------------------------------------------------------
 # * Update Skill Tree Window cursor movement (LEFT)
 #--------------------------------------------------------------------------
 def update_cursor_left
 if (@column_max >= 2 && @position > 0)
 # Values Acquired
 curline = @line
 curpos  = @position
 moving  = checked = false
 #
 if @initialskills[curline].any? {|v|
 v != nil &&
 $data_skills[v].position(@switch_id,@tree) < curpos}
 # Play
 
 RE: Dervvulfman's Skill Tree (Micko's) Passive Skill Malfunction! - DerVVulfman -  04-27-2017
 
 The boon of the Passive Skills bonus system is that it can act independent of the Skill Tree.  That is, if I set up Mass Heal to be a passive skill that grants a +4 bonus to intelligence, just learning it would give the actor that bonus.  Once learned, that bonus remains... even if you upgrade it in the tree.
 
 However, it should not apply to all the actors.  I just tested the default demo, and raised Basil's Healing state from Heal (Skill #1) to Mass Heal (Skill #3).  And according to the Passive States, skill #3 would give a +10 bonus to the max HP.  And it did so, but only to Basil as it should.  I likewise played with Aluxes's tree and only his stats were changed.  And messing with just theirs, neither Gloria nor Hilda's stats were affected.
 
 Perchance, do your actors begin their adventure already having learned skills #3, #4, #5 and #8?
 
 I wonder how many would recognize that you added LEET in leetspeak nowadays?
   
 
 RE: Dervvulfman's Skill Tree (Micko's) Passive Skill Malfunction! - reiji1337 -  04-27-2017
 
 Haha this has been my tag for about 15 years I doubt kids these days get it though
 
 And I assumed thats how it worked so i made sure none of them started with those skills..
 
 http://puu.sh/vxCqX/a995fa1ffa.png
 
 This is an example of one of my passive skills, maybe I put wrong numbers somehow?
 
 Additionally, I just tested it, I learned the skills in the passive tree and the character its assigned to now has double the bonuses, while the other actors have that initial boost in stats
 
 
 RE: Dervvulfman's Skill Tree (Micko's) Passive Skill Malfunction! - DerVVulfman -  04-27-2017
 
 The way you have the skill set up in the screenshot is inconsequential.  The demo itself allows the 'Mass Heal' to give a +10 MaxStrength bonus just because of the set up in the script itself.  It only checks if the actor has the skill by ID and only uses the values in the passive states array for that skill.  Nothing added within the Skill database affects it.
 
 You have a separate tree just to assign passive states?  Interesting.  Nope, that would not cause the issue.
 
 Have you attempted to duplicate this in a new, separate demo that only has the Skill Tree system utilizing your current configuration?  Perhaps there is another script that is duplicating or applying the bonuses in question.
 
 
 RE: Dervvulfman's Skill Tree (Micko's) Passive Skill Malfunction! - reiji1337 -  04-27-2017
 
 I pasted it in a completely new project and the problem is still present unfortunately...
 
 I actually don't have a separate tree for passives, the passives 3 (upgraded to 4 and 5) and 8 are on my second actor's skill tree!
 
 INTERESTINGLY ENOUGH... I copied the demo's script to a brand new project and the problem is still there!!! Perhaps it's a problem with my RMXP version??
 
 Whats even more interesting is I open up the demo and check the stats...
 http://puu.sh/vyhBE/f8ca6f859d.jpg
 All of their HP's are exactly 45 higher than they are in the database!
 
 
 RE: Dervvulfman's Skill Tree (Micko's) Passive Skill Malfunction! - DerVVulfman -  04-28-2017
 
 I found the issue, it occurring when it is supposed to check if the current skill is/was a passive skill.  I just forgot to put in a limiter to ensure the battler 'had' the skill memorized ........ so it was applying the bonuses for all.
  
 Be that is it may, the new version has now been uploaded and bumped to version 1.7.   AND... your name is now in the script credits.
 
 BTW.   I use two upper-case V's for the VV in DerVV
  I get that a lot. 
 
 RE: Dervvulfman's Skill Tree (Micko's) Passive Skill Malfunction! - reiji1337 -  04-28-2017
 
 Siiiick haha I'll download the new version and paste over my configs! And oh alright I'll keep that in mind, thanks again bro
 
 
 
 |