Jump to content
Emerald

EST - Emerald's Skill Trees

Recommended Posts

I'm having a error when the first object of the skill tree is nil

on the escene, if you move the cursor to up, the game freezes and nothing happens.

 

i'm using this config:

 

#============================================================================
#
# CONFIGURATION
#
#============================================================================
module EME
 module SKILL_TREES
#----------------------------------------------------------------------------
# SECTION 1 / STANDARD MODULE CONSTANTS
#----------------------------------------------------------------------------   
   USE_MENU_COMMAND = true
   MENU_VOCAB = "Skill Trees"
   FIRST_SELECT_ACTOR = true
   TREE_POINTS_VOCAB		   = "P. Habilidad"
   MP_COST_VOCAB			   = "Costo de Energia"
   CURRENT_TREE_POINTS_VOCAB   = "P. Habilidad en "
   SKILL_LEVEL_VOCAB		   ="Nivel de Habilidad"
   REQUIREMENTS_VOCAB		  = "Requerimientos"
   POINTS_REQUIREMENT_1	    = "[_points] P. Habilidad"
   POINTS_REQUIREMENT_ELSE	 = "[_points] P. Habilidad"
   POINTS_IN_TREE_REQUIREMENT_1  = "[_points] P. Habilidad en [_tree]"
   POINTS_IN_TREE_REQUIREMENT_ELSE = "[_points] P. Habilidad en [_tree]"
   SKILL_AT_LVL_REQUIREMENT_1    = "[_points] P. Habilidad en [_skill]"
   SKILL_AT_LVL_REQUIREMENT_ELSE = "[_points] P. Habilidad en [_skill]"
   LEVEL_REQUIREMENT		   = {
							   "="  => "Nivel igual que [_level]",
							   ">"  => "Nivel mayor que [_level]",
							   "<"  => "Nivel menor que [_level]",
							   ">=" => "Al menos nivel [_level]",
							   "<=" => "Ningun nivel mayor a [_level]",
							   "!=" => "Diferente a [_level]"
							   }
   SKILL_REQUIREMENT		   = "[_skill] aprendido"
   SWITCH_REQUIREMENT		  = {
							   0 => "Something must have happened...",
							   1 => "Must have eaten the pizza skill"
							  }
   VARIABLE_REQUIREMENT	    = {
							   0 => "Something must have happened...",
							   1 => "Collected [_var] orbs"
							  }
   LEVEL_DISPLAY_TYPE		  = 1
   TABLE_TREE_POINTS		   = false
   INDIVIDUAL_LEVEL_POINTS	 = false
   TREE_POINTS_PER_LEVEL	   = 1
   REMOVE_POINTS_ON_LEVEL_DOWN = true
   LEARN_MODE				  = 1
   ACTOR_OR_CLASSES		    = 1
#----------------------------------------------------------------------------
# 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

   "LBtoLG" => [
  "arrow_object",
  18,
  "Lighting"
   ],
   "WCtoLV" => [
  "arrow_object",
  18,
  "LightVeil"
   ],
   "LLtoMF" => [
  "arrow_object",
  18,
  "MoonForce"
   ],
   "LGtoLC" => [
  "arrow_object",
  18,
  "LightChains"
   ],
   "LVtoPV" => [
  "arrow_object",
  18,
  "PlatinumVeil"
   ],
   "LCtoLO" => [
  "arrow_object",
  18,
  "LightBolt"
   ],
   "LOtoCL" => [
  "arrow_object",
  18,
  "CuttingLight"
   ],
   "arrow_down_begin" => ["arrow_object", 18, "test_skill_1"],
   "arrow_down_end"   => ["arrow_object", 18, "test_skill_2"],
   :example_arrow	 => ["arrow_object", 18, "pizza_skill"],
   # Skill Objects

   "LightBall" => [		   # ID
  "skill_object",		  # Type
  [3,4,5,6,7],			 # SubSkills
  [ ["points",1] ]		 # Requerimients
   ],
   "WhiteCloak" => [		  # ID
  "skill_object",		  # Type
  [8,9,10,11,12],		  # SubSkills
  [ ["points",1] ]		 # Requerimients
   ],
   "LightBlast" => [		  # ID
  "skill_object",		  # Type
  [13,14,15,16,17],	    # SubSkills
  [ ["points",1],		  # Requerimients
    ["level",">=",12]
  ]
   ],
   "Lighting"   => [		  # ID
  "skill_object",		  # Type
  [18,19,20,21,22],	    # SubSkills
  [ ["points",1],		  # Requerimients
    ["level",">=",12]
  ]
   ],
   "LightVeil"   => [		 # ID
  "skill_object",		  # Type
  [23,24,25,26,27],	    # SubSkills
  [ ["points",1],		  # Requerimients
    ["level",">=",12]
  ]
   ],
   "LightChains"   => [		 # ID
  "skill_object",		  # Type
  [28,29,30,31,32],	    # SubSkills
  [ ["points",1],		  # Requerimients
    ["level",">=",24]
  ]
   ],
   "MoonForce"   => [		 # ID
  "skill_object",		  # Type
  [33,34,35,36,37,		 # SubSkills
   38,39,40,41,42],
  [ ["points",1],		  # Requerimients
    ["level",">=",36]
  ]
   ],
   "LightBolt"   => [		 # ID
  "skill_object",		  # Type
  [43,44,45,46,47],	    # SubSkills
  [ ["points",1],		  # Requerimients
    ["level",">=",36]
  ]
   ], 
   "PlatinumVeil"   => [	  # ID
  "skill_object",		  # Type
  [48,49,50,51,52],	    # SubSkills
  [ ["points",1],		  # Requerimients
    ["level",">=",36]
  ]
   ],
   "CuttingLight"   => [	  # ID
  "skill_object",		  # Type
  [53,54,55,56,57,		 # SubSkills
   58,59,60,61,62],
  [ ["points",1],		  # Requerimients
    ["level",">=",48]
  ]
   ],

   "ubar_skill"	   => ["skill_object", [1], [["points", 1]]],
   "pizza_skill"	  => ["skill_object", [2, 3, 4], [["points", 1]], [["points", 1],
   ["level", "!=", 99]], [["points", 5], ["tree_skill_level", "ubar_skill", 1]]],
   "test_skill_1"	 => ["skill_object", [26], [["points", 1]]],
   "test_skill_2"	 => ["skill_object", [27, 28], [["points", 1]], [["points", 1], ["level", "=", 15]]]
   }
#----------------------------------------------------------------------------
# SECTION 4 / TREES
#----------------------------------------------------------------------------
   Trees = {

   "light_skills_1" =>
  [nil,nil,		 nil,"LightBall",   nil,"WhiteCloak",  nil,
   nil,nil,		 nil,"LBtoLG",	  nil,"WCtoLV",	  nil,
   nil,"LightBlast",nil,"Lighting",    nil,"LightVeil",   nil,
   nil,"LLtoMF",    nil,"LGtoLC",	  nil,"LVtoPV",	  nil,
   nil,"LLtoMF",    nil,"LightChains", nil,"LVtoPV",	  nil,
   nil,"LLtoMF",    nil,"LCtoLO",	  nil,"LVtoPV",	  nil,
   nil,"MoonForce", nil,"LightBolt",   nil,"PlatinumVeil",nil,
   nil,nil,		 nil,"LOtoCL",	  nil,nil,		   nil,
   nil,nil,		 nil,"CuttingLight",nil,nil,		   nil],
   "test_tree" => ["ubar_skill" , :example_arrow, "pizza_skill", nil, nil, nil, nil],
   "supar_tree" => ["test_skill_1", "arrow_down_begin", "arrow_down_end", "test_skill_2", nil, nil, nil],
   "cute_tree"=> ["test_skill_1"    , nil, nil, nil, nil, nil, nil,
			    nil, "arrow_down_begin", nil, nil, nil, nil, nil,
			    nil, nil, "arrow_down_end"  , "test_skill_2", nil, nil, nil]
   }
#----------------------------------------------------------------------------
# SECTION 5 / TREES PER ACTOR
#----------------------------------------------------------------------------
   Trees_Per_Actor = {
   1 => ["light_skills_1", "cute_tree", "supar_tree", "Magia", "H. Fisicas", "Apoyo"],
   2 => ["test_tree", "supar_tree", nil, "Ubar Tree 2", "MOAR", ""],
   3 => ["supar_tree", "test_tree", "cute_tree", "wow", "it's", "epic"]
   }
 end
end

Share this post


Link to post
Share on other sites

Update to v1.4b!

  • Small fix for the cursor bug of ClubIce
  • The script is now downloadable from DropBox to allow a faster copy-paste process
  • The script is now split up in two parts: instruction and config included (when you download it for the first time) and everything past the config (this excludes the Advanced Info Window options)

Share this post


Link to post
Share on other sites

I noticed that in the skill description, when it shows the MP cost, it doesn't show the TP cost, if present. Could you please make it appear?

 

Also, i saw that if you have a skill_object with multiple skills, when you learn the first level skill, keeping the cursor on it won't show the second skill's description, but shows the first one instead, so the player doesn't know what's next.

 

There seem to be a problem on line 993, regarding switch conditions. If I set a switch with ID different than 0 i get an error at this line.

 

Last but not least, I need a script that replaces the learned skills with the new one. I tried using this script by Fomar http://cobbtocs.co.uk/wp/?p=174 but it doesn't work. It works if you learn the skills when you level up, but if you learn them from the tree, it doesn't. Could you tell me perhaps how to make it compatible?

 

Thanks

Edited by pinka

Share this post


Link to post
Share on other sites

Update to v1.4c!

The script now displays TP Cost too. Also a small fix for the switch error which Pinka had.

 

@Pinka:

Done

 

It should be like that. The normal window only displays information for the skill at its current level and requirements for the next level. HOWEVER, I do have an add-on (Second Tabs) which with the standard config, display information for the next skill if you press the dash button (Shift).

 

Fixed it.

 

Gonna check it out.

Share this post


Link to post
Share on other sites

There seem to be another little problem when setting the tree points requirement.

If I set a skill to have the same tree ID requirement, then it works. If i set a different tree as a requirement, it gives an error at line 1061.

To be clearer, if the skill is in the tree ID 0, and i set tree 0 as a requirement it works, if I set the requirement to tree ID 1, it give error.

Share this post


Link to post
Share on other sites

That's weird... I can't seem to replicate the error. Could you give me a copy of the skill object which hast that requirement?

Share this post


Link to post
Share on other sites

I set it up like this:

"Immortal" => ["skill_object", [261], [["points", 10], ["tree_points", 1, 30], ["tree_points", 2, 30], ["level",">=", 30]]],

Share this post


Link to post
Share on other sites

Fixed it. If I'm right, you can just download the script and replace it in the script editor.

Share this post


Link to post
Share on other sites

Works now, but doesn't type the name of the required tree in the requirements.

Share this post


Link to post
Share on other sites

Either you haven't set a name for the tree, OR the list is to big. Else.... Recopy the script.

Share this post


Link to post
Share on other sites

"Just as always, put this script between Бе Materials and Бе Main (you get a cookie if you knew that already)"

Then I get a cookie as well :D thanks a lot Emerald, you just made my day!

Share this post


Link to post
Share on other sites

It should be ["level", "!=", 99]

 

@Ish: I know it's kinda late but.... Still have the problem? If yes, can you send me a full copy of the error, please?

 

Yes, I still do. With the latest version, the error I get is:

 

Script 'Skill Trees Ace v1.4c' line 1067: NameError ocurred.

undefined methos `process_ok' for class `Window_EST_Trees'

 

 

Thanks!!

Share this post


Link to post
Share on other sites

I dont know which of them involve windows but I have just three right now:

 

MOG_BATTLEBACK_XP V1.0

Tankentai Sideview Battle System (and several Add-ons which were included)

Script Snake by Newold

Share this post


Link to post
Share on other sites

That's very strange... Alright try this:

 

First, recopy the WHOLE script. If you've changed anything in the config, save it so that it somewhere separately. IF the error occurs at start-up of the game, or right when entering the skill trees menu, then an error in the script is ruled out.

 

Second, check Window_Selectable. Copy it from a fresh project. If you still get the error, the problem shouldn't have anything to do with a combination of this script and the maker's scripts.

 

Third, use Ctrl + Shift + F and try to find def process_ok. If it's in ANY other script than mine or Window_Selectable, tell me which script.

Share this post


Link to post
Share on other sites

Hello. I'm using Nicke's Menu Delux script which simply makes the menu pretty. I need to add custom menu selections to Nicke's script but I don't know what your script's menu command is called. I looked through your script under the hood and I thought it would be either :talents or :talents_scene but that doesn't seem to be right. Can you please help me out with this? Mainly what is your script menu command.

 

NVM I got it :P I also needed to use your scene call of Monster_Book

Edited by Rylix

Share this post


Link to post
Share on other sites

Bug Report: I think.... you might have intended this, I don't know.

 

When I make a skill(rank 2) the requirement of another skill, it says the name of the skill at rank 3. In my case, I have a skill with 3 ranks and a skill with 2 ranks. The first skill is named Evader I, Evader II, Evader III with respect to the three ranks. The second skill is named Defiant I, Defiant II with respect to the two ranks. I've written it so in order to get Defiant I, you need two points in Evader, which is Evader II. However, in the requirements it says to get Defiant I, you need 2SP in Evader III. To me it seems that it shouldn't say Evader III but instead what I named the actual skill with the 3 ranks (Evader) and not the 3 skills that make it up (Evader I, Evader II, Evader III). Here is a screenshot and my code of sections 3 and 4. The actor is actor 12, named Test, class test. The tree is Swordsman_tree. The skills Evader I, Evader II, Evader III, Defiant I, Defiant II are numbers 130,131,132,133,134 in that order.

 

GHFCK.png

 

 

#----------------------------------------------------------------------------
# SECTION 3 / OBJECTS
#----------------------------------------------------------------------------

Objects = {

# Arrow Objects
"arrow_down" => ["arrow_object", 2239, "test_skill_1"],
"arrow_up" => ["arrow_object", 2236, "test_skill_2"],
"arrow_left" => ["arrow_object", 2238, "test_skill_1"],
"arrow_right"=> ["arrow_object", 2237, "test_skill_2"],

"defiant_arrow_down" => ["arrow_object", 2239, "Defiant"],

:example_arrow => ["arrow_object", 18, "pizza_skill"],

# Skill Objects
"ubar_skill" => ["skill_object", [1], [["points", 1], ["tree_points", 1, 1]]],
"pizza_skill" => ["skill_object", [2, 3, 4], [["points", 1]], [["points", 1],
["level", "!=", 99]], [["points", 5], ["tree_skill_level", "ubar_skill", 1], ["switch", 1, true]]],

"test_skill_1" => ["skill_object", [26], [["points", 1]]],
"test_skill_2" => ["skill_object", [27, 28], [["points", 1]], [["points", 1], ["level", "=", 15]]],

"Evader" => ["skill_object", [130, 131, 132], [["points", 1]],[["points", 1]],[["points", 1]]],
"Defiant" => ["skill_object", [133, 134], [["tree_skill_level", "Evader", 2], ["points", 1]],[["tree_skill_level", "Evader", 2], ["points", 1]]],

"heal_mastery" => ["skill_object", [130], [["points", 1]]],
"heal" => ["skill_object", [143, 144], [["points", 1], ["tree_skill_level", "heal_mastery", 1]], [["points", 1]]]

}

#----------------------------------------------------------------------------
# SECTION 4 / TREES
#----------------------------------------------------------------------------

 

 

 

    Trees = {
 
    "test_tree" => ["ubar_skill" , :example_arrow, "pizza_skill", nil, nil, nil, nil],
    
    "empty_tree" => ["uber_skill" , nil, nil, nil, nil, nil, nil],
 
    "supar_tree" => ["test_skill_1", "arrow_down", "arrow_up", "test_skill_2", nil, nil, nil],
 
    "Swordsman_tree"=> [ "Evader", nil, "Silencer", nil, nil, nil, nil,
                    "defiant_arrow_down", nil, "curse_striker_arrow_down", nil, "Defense Mastery", nil, "Magic Resist Mastery",
                    "Defiant", nil, "Curse Striker", nil, nil, nil, nil,
                    nil, nil, nil, nil, nil, nil, nil,
                    "Potion Mastery", nil, "Mana Prowess", nil, nil, nil, nil,
                    "self_healing_arrow_down", nil, "casters_heart_arrow_down", nil, nil, nil, nil,
                    "Self Healing", nil, "Casters Heart", nil, nil, nil, nil,
                    nil, nil, nil, nil, nil, nil, nil],
    
    "cute_tree"=> ["test_skill_1"    , nil, nil, nil, nil, nil, nil,
                    nil, "arrow_up", nil, nil, nil, nil, nil,
                    nil, nil, "arrow_right"  , "test_skill_2", nil, nil, nil]

 

Edited by Rylix

Share this post


Link to post
Share on other sites

I get this

Script 'Emerald Skill Tree' line1265: NoMethodError occured.
undefined method '[]' for nil: NilClass

whenever I try to open the skill tree to test my configurations.
I'm not sure how to fix it.

Share this post


Link to post
Share on other sites
I get this

 

Script 'Emerald Skill Tree' line1265: NoMethodError occured.

undefined method '[]' for nil: NilClass

 

whenever I try to open the skill tree to test my configurations.

I'm not sure how to fix it.

I think when I started out, I kept getting that. I just wiped the tree and pasted in a default one from the script and edited it with my skills. It worked afterwards. One tiny tiny thing can cause that error. For the first tree, I'd recommend test running it everytime you make a change. Also to test if your skill is the problem or the actual tree, just put in a skill that you know that works already in it's place, test it. If it works, then it's your test skill that is the problem, if it doesn't work then it's your tree.

Share this post


Link to post
Share on other sites
I get this

 

Script 'Emerald Skill Tree' line1265: NoMethodError occured.

undefined method '[]' for nil: NilClass

 

whenever I try to open the skill tree to test my configurations.

I'm not sure how to fix it.

I think when I started out, I kept getting that. I just wiped the tree and pasted in a default one from the script and edited it with my skills. It worked afterwards. One tiny tiny thing can cause that error. For the first tree, I'd recommend test running it everytime you make a change. Also to test if your skill is the problem or the actual tree, just put in a skill that you know that works already in it's place, test it. If it works, then it's your test skill that is the problem, if it doesn't work then it's your tree.

I found the problem now. I forgot to change Trees per Actor and I put the skill names in the wrong place. Thanks for your advice though.

Share this post


Link to post
Share on other sites

I've got another issue *I also still have my bug report issue about 3 replies up*. When I level up a skill to a stronger version, it keeps my old skill. so at the moment... I have four of the same skill with different stats when I max one skill box. Here is my code and a couple of pictures. The skill I'm talking about is Crippling Strike. Someone please help :(

 

 

 

FbZKK.png

 

And in this spoiler is the entire script that I edited. I haven't changed anything under the hood in the script, just edited the trees and skills.

 

 

#============================================================================
# Skill Trees Ace v1.4c
# 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
# 0.5 -> Started the script. Added all basic functions. However, as of now
# requirements aren't shown in the info window.
# 0.6 -> Bug fixes for leveling skills and information window.
# 0.6b-> Yet another bugfix.
# 1.0 -> Added more customization on how to display skill levels on their icons.
# Also added an option which, if the menu command is used, allows you to
# select an actor first.
# 1.0b-> Small glitch fixed regarding switching between actors.
# 1.0c-> 'nother small glitch fixed regarding switching between actors. Also
# fixed a mistake made in previous version.
# 1.0d-> Changed something regarding forgetting previously learned skills, to
# avoid problems.
# 1.1a-> Bugfix time. Solved a few issues.
# 1.1b-> Bugfix patch #2. Possible first version without window bugs...
# 1.1c-> Bugfix patch #3. Fixed a slight problem with the requirements.
# 1.1d-> Bugfix patch #4. Fixed another slight problem with the requirements.
# 1.1e-> Bugfix patch #5. Fixed yet another problem with the requirements and
# also made the skill tree selection box disappear as soon as the scene
# starts.
# 1.2a-> Changed how almost all the methods in Game_Actor where structured.
# Removed some "skills with 1 level" issues in the process. Also split
# skill learning up in 3 categories, changeable with LEARN_MODE.
# Removed a few tree skill reset related bugs too.
# 1.2b-> Small typo fix. Also fixed an issue with leveling skills in LEARN_MODE
# 1 and 2 in which an already learnt skill would accidentally be forgotten.
# 1.2c-> Fixed an issues in which an wrong actor learned the selected skill and
# used up his/her points and an issue where the skill trees selection
# window would be activated while the skill tree window should be active.
# 1.3 -> Added an option to make trees based on class ID instead of actor ID.
# 1.4a-> Made fixes for the standard config, a deleted portion of the script,
# switching between actors and the trees selection window. Also added
# the requirements to the standard info window.
# 1.4b-> Small bugfix for cursor input.
# 1.4c-> Added TP cost display. Also solved a small bug regarding switch
# requirements display. Also fixed a small bug with actor IDs.
#----------------------------------------------------------------------------
# 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.
# See REQUIREMENTS VARIABLES as the bottom of the instructions for more info
# about the requirements.
#
# LEVEL_DISPLAY_TYPE / How the levels of the skills are displayed on their icons.
# 0 = No display.
# 1 = Current level only.
# 2 = Current level and max level.
#
#
# 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!!
#
# LEARN_MODE / Affects how you can gain skill levels. If 0, you must have learned
# the skill by putting a point in it in the same tree. If 1, you must have learned
# the skill by putting a point in it in any tree. If 2, you can also have learned
# the skill outside of skill trees.
#
# ACTOR_OR_CLASSES / Affects if trees are based on actors or on classes. 0 for
# actors, 1 for classes. NOTE THAT, if you change it to classes, Trees_Per_Actor
# don't work on actor_ids, but on class_ids. Also note that if an actor changes
# class, you could best use a reset to make sure the player has all the points
# back and hasn't learned skills which aren't in the new trees. Ask for help
# if you don't know where to use the reset.
#
#----------------------------------------------------------------------------
# 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]
# 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.
#
# 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!!
#
#----------------------------------------------------------------------------
# REQUIREMENT VARIABLES
#----------------------------------------------------------------------------
# POINTS_REQUIREMENT_1 and POINTS_REQUIREMENT_ELSE
# Text to display when skill points are required ("points" requirement).
# _1 is the singular form, and _ELSE the plural.
# [_points] will be replaced by the required amount of points, so
# "Finally, [_points] points" with the requirement ["points", 7] becomes
# Finally, 7 points
#
# POINTS_IN_TREE_REQUIREMENT_1 and POINTS_IN_TREE_REQUIREMENT_ELSE
# Works the same as POINTS_REQUIREMENT, only for the "tree_points" requirement.
# An additional parameter for this string is [_tree] which will be replaced by
# the name of the tree in which the player should have the set amount of points.
# So "Have [_points] points in [_tree]" with ["tree_points", 0, 15] becomes
# Have 15 points in Ubar Tree
#
# SKILL_AT_LVL_REQUIREMENT_1 and SKILL_AT_LVL_REQUIREMENT_ELSE
# Works the same as POINTS_IN_TREE with [_tree] being replace by the name of
# the required skill (at its current level), [_skill].
# This string is for "tree_skill_level".
#
# LEVEL_REQUIREMENT
# All the strings for every possible case with "level". The sign corresponds
# to case in the "level" requirement. Only constant is [_level], which is
# obviously replaced by the required level.
#
# ["level", "!=", 5] with standard settings gives:
# Level anything but 5
#
# SKILL REQUIREMENT
# String for "skill" requirement. Only constant is [_skill], which is replaced
# by the skill's name.
# "[_skill] learned" with ["skill", 1] and skill 1 called Black End gives:
# Black End learned
#
# SWITCH_REQUIREMENT and VARIABLE_REQUIREMENT
# These two work exactly the same, with the exception of the constants.
# The both have [_id], which is replaced by the ID of the switch/variable, but
# variables also have [_var] which becomes the amount according to the
# requirements (which the variable must be equal to, or whatever).
# Every sentence is according to their ID, and if their ID is missing, the
# first one will be used (0 => ...), which is usually "Something must have
# happened..."
#----------------------------------------------------------------------------
# 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"
FIRST_SELECT_ACTOR = true

TREE_POINTS_VOCAB = "SP"
MP_COST_VOCAB = "MP Cost"
TP_COST_VOCAB = "TP Cost"
CURRENT_TREE_POINTS_VOCAB = "SP in "
SKILL_LEVEL_VOCAB ="Skill Level"
REQUIREMENTS_VOCAB = "Requirements"

POINTS_REQUIREMENT_1 = "[_points] Skill Point"
POINTS_REQUIREMENT_ELSE = "[_points] Skill Points"
POINTS_IN_TREE_REQUIREMENT_1 = "[_points] SP in [_tree]"
POINTS_IN_TREE_REQUIREMENT_ELSE = "[_points] SP in [_tree]"
SKILL_AT_LVL_REQUIREMENT_1 = "[_points] SP in [_skill]"
SKILL_AT_LVL_REQUIREMENT_ELSE = "[_points] SP in [_skill]"
LEVEL_REQUIREMENT = {
"=" => "Level equal to [_level]",
">" => "Level higher than [_level]",
"<" => "Level below [_level]",
">=" => "Level at least [_level]",
"<=" => "Level not higher than [_level]",
"!=" => "Level anything but [_level]"
}
SKILL_REQUIREMENT = "[_skill] learned"
SWITCH_REQUIREMENT = {
0 => "Something must have happened...",
1 => "Must have eaten the pizza skill"
}
VARIABLE_REQUIREMENT = {
0 => "Something must have happened...",
1 => "Collected [_var] orbs"
}

LEVEL_DISPLAY_TYPE = 2
TABLE_TREE_POINTS = false
INDIVIDUAL_LEVEL_POINTS = false
TREE_POINTS_PER_LEVEL = 2
REMOVE_POINTS_ON_LEVEL_DOWN = true
LEARN_MODE = 1
ACTOR_OR_CLASSES = 0

#----------------------------------------------------------------------------
# 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" => ["arrow_object", 2239, "test_skill_1"],
"arrow_up" => ["arrow_object", 2236, "test_skill_2"],
"arrow_left" => ["arrow_object", 2238, "test_skill_1"],
"arrow_right"=> ["arrow_object", 2237, "test_skill_2"],

"defiant_arrow_down" => ["arrow_object", 2239, "Defiant"],
"curse_striker_arrow_down" => ["arrow_object", 2239, "Curse Striker"],
"self_healing_arrow_down" => ["arrow_object", 2239, "Self Healing"],
"casters_heart_arrow_down" => ["arrow_object", 2239, "Casters Heart"],

:example_arrow => ["arrow_object", 18, "pizza_skill"],

# Skill Objects
"ubar_skill" => ["skill_object", [1], [["points", 1], ["tree_points", 1, 1]]],
"pizza_skill" => ["skill_object", [2, 3, 4], [["points", 1]], [["points", 1],
["level", "!=", 99]], [["points", 5], ["tree_skill_level", "ubar_skill", 1], ["switch", 1, true]]],

"test_skill_1" => ["skill_object", [26], [["points", 1]]],
"test_skill_2" => ["skill_object", [27, 28], [["points", 1]], [["points", 1], ["level", "=", 15]]],

"Crippling Strike" => ["skill_object", [161, 162, 163, 164], [["points", 1]], [["points", 1], ["level", ">=", 4]], [["points", 1], ["level", ">=", 7]], [["points", 1], ["level", ">=", 10]]],
"Evader" => ["skill_object", [130, 131, 132], [["points", 1]],[["points", 1]],[["points", 1]]],
"Defiant" => ["skill_object", [133, 134], [["tree_skill_level", "Evader", 2], ["points", 1]],[["tree_skill_level", "Evader", 2], ["points", 1]]],
"Silencer" => ["skill_object", [135, 136, 137], [["points", 1]],[["points", 1]],[["points", 1]]],
"Curse Striker" => ["skill_object", [138, 139, 140], [["tree_skill_level", "Silencer", 2], ["points", 1]],[["tree_skill_level", "Silencer", 2], ["points", 1]],[["tree_skill_level", "Silencer", 2], ["points", 1]]],
"Defense Mastery" => ["skill_object", [141, 142, 143, 144], [["points", 1], ["level", ">=", 5]],[["points", 1]],[["points", 1]],[["points", 1]]],
"Magic Resist Mastery"=> ["skill_object", [145, 146, 147, 148], [["points", 1], ["level", ">=", 5]],[["points", 1]],[["points", 1]],[["points", 1]]],
"Potion Mastery" => ["skill_object", [149, 150], [["points", 1], ["level", ">=", 10]],[["points", 1]]],
"Mana Prowess" => ["skill_object", [151, 152], [["points", 1], ["level", ">=", 10]],[["points", 1]]],
"Self Healing" => ["skill_object", [153, 154], [["points", 1], ["level", ">=", 20], ["tree_skill_level", "Potion Mastery", 2]],[["points", 1]]],
"Casters Heart" => ["skill_object", [155, 156], [["points", 1], ["level", ">=", 20], ["tree_skill_level", "Mana Prowess", 2]],[["points", 1]]],


"LAST LINE" => ["skill_object", [143, 144], [["points", 1], ["tree_skill_level", "heal_mastery", 1]], [["points", 1]]]

}

#----------------------------------------------------------------------------
# SECTION 4 / TREES
#----------------------------------------------------------------------------

Trees = {

"test_tree" => ["ubar_skill" , :example_arrow, "pizza_skill", nil, nil, nil, nil],

"empty_tree" => ["uber_skill" , nil, nil, nil, nil, nil, nil],

"supar_tree" => ["test_skill_1", "arrow_down", "arrow_up", "test_skill_2", nil, nil, nil],

"Swordsman_Mas_tree"=> [ "Evader", nil, "Silencer", nil, nil, nil, nil,
"defiant_arrow_down", nil, "curse_striker_arrow_down", nil, "Defense Mastery", nil, "Magic Resist Mastery",
"Defiant", nil, "Curse Striker", nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil,
"Potion Mastery", nil, "Mana Prowess", nil, nil, nil, nil,
"self_healing_arrow_down", nil, "casters_heart_arrow_down", nil, nil, nil, nil,
"Self Healing", nil, "Casters Heart", nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil],

"Swordsman_S_tree"=> [ "Crippling Strike", nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil],

"cute_tree"=> ["test_skill_1" , nil, nil, nil, nil, nil, nil,
nil, "arrow_up", nil, nil, nil, nil, nil,
nil, nil, "arrow_right" , "test_skill_2", nil, nil, nil]
}

#----------------------------------------------------------------------------
# SECTION 5 / TREES PER ACTOR
#----------------------------------------------------------------------------

Trees_Per_Actor = {

1 => ["test_tree", "cute_tree", "supar_tree", "Ubar Tree", "POWAR", "Hello"],
2 => ["test_tree", "supar_tree", nil, "Ubar Tree 2", "MOAR", ""],
3 => ["supar_tree", "test_tree", "cute_tree", "wow", "it's", "epic"],
4 => ["supar_tree", "test_tree", "cute_tree", "wow", "it's", "epic"],
5 => ["supar_tree", "test_tree", "cute_tree", "wow", "it's", "epic"],
6 => ["supar_tree", "test_tree", "cute_tree", "wow", "it's", "epic"],
7 => ["supar_tree", "test_tree", "cute_tree", "wow", "it's", "epic"],
8 => ["supar_tree", "test_tree", "cute_tree", "wow", "it's", "epic"],
9 => ["supar_tree", "test_tree", "cute_tree", "wow", "it's", "epic"],
10=> ["supar_tree", "test_tree", "cute_tree", "wow", "it's", "epic"],
11=> ["supar_tree", "test_tree", "cute_tree", "wow", "it's", "epic"],
12=> ["Swordsman_Mas_tree", "Swordsman_S_tree", "cute_tree", "Mastery", "Special", "Magic"],
13=> ["Swordsman_Mas_tree", "Swordsman_S_tree", "cute_tree", "Mastery", "Special", "Magic"]

}

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 original_contents_height
height - standard_padding * 2
end

def contents_height
@contents_height != nil ? @contents_height : original_contents_height
end

def refresh
contents.clear
@contents_height = original_contents_height + 24 * ([get_requirements.size - 4, 0].max)
create_contents
# 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
unless @skill_object == nil
level = [@actor.est_skill_level(@skill_object, @tree_id) - 1, 0].max # Which element of the row with skill IDs should be picked?
@current_skill = $data_skills[@skill_object[1][level]] # The skill that will be picked
draw_skill_name(0, 106)
draw_skill_cost(136, 106)
draw_skill_level(136, 1130)
draw_description(0, 154)
draw_line_2
draw_requirements(0, 208)
end
end

def draw_description(x, y)
current_line = 0
text = []
@current_skill.description.each_line {|line| text[current_line] = line; current_line += 1 }
draw_text(x, y, 328, 24, text[0])
draw_text(x, y + 24, 328, 24, text[1])
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)
if @current_skill.mp_cost != 0
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)
if @current_skill.tp_cost != 0
change_color(system_color)
draw_text(x, y + 24, 144, line_height, EME::SKILL_TREES::TP_COST_VOCAB)
change_color(normal_color)
draw_text(x + 144, y + 24, 48, line_height, @current_skill.tp_cost.to_s, 2)
end
elsif @current_skill.tp_cost != 0
change_color(system_color)
draw_text(x, y, 144, line_height, EME::SKILL_TREES::TP_COST_VOCAB)
change_color(normal_color)
draw_text(x + 144, y, 48, line_height, @current_skill.tp_cost.to_s, 2)
end
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

def draw_requirements(x, y)
draw_text(x, y, 328, line_height, EME::SKILL_TREES::REQUIREMENTS_VOCAB)
requirements = get_requirements
unless requirements == 0
required_points = 0
required_tpoints = [0, 0, 0]
required_tskills = []
required_levels = []
required_skills = []
required_switches = []
required_variables = []
requirements.each{|requirement|
case requirement[0]
when "points"
required_points = requirement[1] if requirement[1] > required_points
when "tree_points"
required_tpoints[requirement[1]] = requirement[2] if requirement[2] > required_tpoints[requirement[1]]
when "tree_skill_level"
required_tskills.push(requirement)
when "level"
required_levels.push(requirement)
when "skill"
required_skills.push(requirement[1])
when "switch"
required_switches.push(requirement)
when "variable"
required_variables.push(requirement)
end
}
line_number = 1
if required_points != 0
required_points == 1 ? text = EME::SKILL_TREES::POINTS_REQUIREMENT_1.gsub("[_points]", required_points.to_s) : text = EME::SKILL_TREES::POINTS_REQUIREMENT_ELSE.gsub("[_points]", required_points.to_s)
draw_text(x, y + 24 * line_number, 328, line_height, text)
line_number += 1
end
if required_tpoints[0] != 0
required_tpoints[0] == 1 ? text = EME::SKILL_TREES::POINTS_IN_TREE_REQUIREMENT_1.gsub("[_points]", required_tpoints[0].to_s).gsub("[_tree]", EME::SKILL_TREES::Trees_Per_Actor[@actor.id][3]) : text = EME::SKILL_TREES::POINTS_IN_TREE_REQUIREMENT_ELSE.gsub("[_points]", required_tpoints[0].to_s).gsub("[_tree]", EME::SKILL_TREES::Trees_Per_Actor[@actor.id][3])
draw_text(x, y + 24 * line_number, 328, line_height, text)
line_number += 1
end
if required_tpoints[1] != 0
required_tpoints[1] == 1 ? text = EME::SKILL_TREES::POINTS_IN_TREE_REQUIREMENT_1.gsub("[_points]", required_tpoints[1].to_s).gsub("[_tree]", EME::SKILL_TREES::Trees_Per_Actor[@actor.id][4]) : text = EME::SKILL_TREES::POINTS_IN_TREE_REQUIREMENT_ELSE.gsub("[_points]", required_tpoints[1].to_s).gsub("[_tree]", EME::SKILL_TREES::Trees_Per_Actor[@actor.id][4])
draw_text(x, y + 24 * line_number, 328, line_height, text)
line_number += 1
end
if required_tpoints[2] != 0
required_tpoints[2] == 1 ? text = EME::SKILL_TREES::POINTS_IN_TREE_REQUIREMENT_1.gsub("[_points]", required_tpoints[2].to_s).gsub("[_tree]", EME::SKILL_TREES::Trees_Per_Actor[@actor.id][5]) : text = EME::SKILL_TREES::POINTS_IN_TREE_REQUIREMENT_ELSE.gsub("[_points]", required_tpoints[2].to_s).gsub("[_tree]", EME::SKILL_TREES::Trees_Per_Actor[@actor.id][5])
draw_text(x, y + 24 * line_number, 328, line_height, text)
line_number += 1
end
if !required_tskills.empty?
index = 0
loop do
req_points = required_tskills[index][2]
object = EME::SKILL_TREES::Objects[required_tskills[index][1]]
req_skill = $data_skills[object[1][@actor.est_skill_level(object, @tree_id) - 1]]
req_skill_name = req_skill.name
req_icon_index = req_skill.icon_index
if req_points == 1
text = EME::SKILL_TREES::SKILL_AT_LVL_REQUIREMENT_1.gsub("[_points]", req_points.to_s).gsub("[_skill]", "\\I[" + req_icon_index.to_s + "]" + req_skill_name)
else
text = EME::SKILL_TREES::SKILL_AT_LVL_REQUIREMENT_ELSE.gsub("[_points]", req_points.to_s).gsub("[_skill]", req_skill_name)
end
draw_text_ex(x, y + 24 * line_number, text)
line_number += 1
index += 1
break if index == required_tskills.size
end
end
if !required_levels.empty?
index = 0
loop do
text = EME::SKILL_TREES::LEVEL_REQUIREMENT[required_levels[index][1]].gsub("[_level]", required_levels[index][2].to_s)
draw_text(x, y + 24 * line_number, 328, line_height, text)
line_number += 1
index += 1
break if index == required_levels.size
end
end
if !required_skills.empty?
index = 0
loop do
text = EME::SKILL_TREES::SKILL_REQUIREMENT.gsub("[_skill]", $data_skills[required_skills[index]].name)
draw_text(x, y + 24 * line_number, 328, line_height, text)
line_number += 1
index += 1
break if index == required_skills.size
end
end
if !required_switches.empty?
index = 0
loop do
if EME::SKILL_TREES::SWITCH_REQUIREMENT.has_key?(required_switches[index][1])
text = EME::SKILL_TREES::SWITCH_REQUIREMENT[required_switches[index][1]].gsub("[_id]", required_switches[index][1].to_s)
else
text = EME::SKILL_TREES::SWITCH_REQUIREMENT[0].gsub("[_id]", required_switches[index][1].to_s)
end
draw_text(x, y + 24 * line_number, 328, line_height, text)
line_number += 1
index += 1
break if index == required_switches.size
end
end
if !required_variables.empty?
index = 0
loop do
if EME::SKILL_TREES::VARIABLE_REQUIREMENT.has_key?(required_variables[index][1])
text = EME::SKILL_TREES::VARIABLE_REQUIREMENT[required_variables[index][1]].gsub("[_id]", required_variables[index][1].to_s).gsub("[_var]", required_variables[index][3].to_s)
else
text = EME::SKILL_TREES::VARIABLE_REQUIREMENT[0].gsub("[_id]", required_variables[index][1].to_s).gsub("[_var]", required_variables[index][3].to_s)
end
draw_text(x, y + 24 * line_number, 328, line_height, text)
line_number += 1
index += 1
break if index == required_variables.size
end
end
else
draw_text(x, y + 24, 328, line_height, "None")
end
end

def get_requirements
level = 2 + @actor.est_skill_level(@skill_object, @tree_id)
requirements = @skill_object[level]
requirements = 0 if requirements == nil
return requirements
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_init_actor initialize
def initialize(actor_id)
@non_tree_skills = []
eme_est_init_actor(actor_id)
@tree_points = 0
@total_tree_points = 0
@points_per_tree = [0,0,0]
@tree_skills = [[], [], []]
if EME::SKILL_TREES::ACTOR_OR_CLASSES == 0
if EME::SKILL_TREES::TABLE_TREE_POINTS
if EME::SKILL_TREES::Tree_Points_Table.include?(@actor_id)
@tree_points = EME::SKILL_TREES::Tree_Points_Table[@actor_id]
else
@tree_points = EME::SKILL_TREES::Tree_Points_Table[0]
end
else
if EME::SKILL_TREES::INDIVIDUAL_LEVEL_POINTS
@tree_points = EME::SKILL_TREES::TREE_POINTS_PER_LEVEL[@actor_id] * (level - 1) if @actor_id >= 0
else
@tree_points = EME::SKILL_TREES::TREE_POINTS_PER_LEVEL * (level - 1)
end
end
else
if EME::SKILL_TREES::TABLE_TREE_POINTS
if EME::SKILL_TREES::Tree_Points_Table.include?(@class_id)
@tree_points = EME::SKILL_TREES::Tree_Points_Table[@class_id]
else
@tree_points = EME::SKILL_TREES::Tree_Points_Table[0]
end
else
if EME::SKILL_TREES::INDIVIDUAL_LEVEL_POINTS
@tree_points = EME::SKILL_TREES::TREE_POINTS_PER_LEVEL[@class_id] * (level - 1) if @class_id >= 0
else
@tree_points = EME::SKILL_TREES::TREE_POINTS_PER_LEVEL * (level - 1)
end
end
end
end

alias eme_est_level_up level_up
def level_up
eme_est_level_up
if EME::SKILL_TREES::ACTOR_OR_CLASSES == 0
if EME::SKILL_TREES::TABLE_TREE_POINTS
if EME::SKILL_TREES::Tree_Points_Table.has_key?(@actor_id)
@tree_points += EME::SKILL_TREES::Tree_Points_Table[@actor_id][@level - 2]
@total_tree_points += EME::SKILL_TREES::Tree_Points_Table[@actor_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[@actor_id - 1]
@total_tree_points += EME::SKILL_TREES::TREE_POINTS_PER_LEVEL[@actor_id - 1]
else
@tree_points += EME::SKILL_TREES::TREE_POINTS_PER_LEVEL
@total_tree_points += EME::SKILL_TREES::TREE_POINTS_PER_LEVEL
end
end
else
if EME::SKILL_TREES::TABLE_TREE_POINTS
if EME::SKILL_TREES::Tree_Points_Table.has_key?(@class_id)
@tree_points += EME::SKILL_TREES::Tree_Points_Table[@class_id][@level - 2]
@total_tree_points += EME::SKILL_TREES::Tree_Points_Table[@class_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[@class_id - 1]
@total_tree_points += EME::SKILL_TREES::TREE_POINTS_PER_LEVEL[@class_id - 1]
else
@tree_points += EME::SKILL_TREES::TREE_POINTS_PER_LEVEL
@total_tree_points += EME::SKILL_TREES::TREE_POINTS_PER_LEVEL
end
end
end
end

alias eme_est_level_down level_down
def level_down
eme_est_level_down
if EME::SKILL_TREES::ACTOR_OR_CLASSES == 0
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?(@actor_id)
@tree_points -= EME::SKILL_TREES::Tree_Points_Table[@actor_id][@level - 1]
@total_tree_points -= EME::SKILL_TREES::Tree_Points_Table[@actor_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[@actor_id]
@total_tree_points -= EME::SKILL_TREES::TREE_POINTS_PER_LEVEL[@actor_id]
else
@tree_points -= EME::SKILL_TREES::TREE_POINTS_PER_LEVEL
@total_tree_points -= EME::SKILL_TREES::TREE_POINTS_PER_LEVEL
end
end
end
else
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?(@class_id)
@tree_points -= EME::SKILL_TREES::Tree_Points_Table[@class_id][@level - 1]
@total_tree_points -= EME::SKILL_TREES::Tree_Points_Table[@class_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[@class_id]
@total_tree_points -= EME::SKILL_TREES::TREE_POINTS_PER_LEVEL[@class_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
end

alias eme_est_learn_skill learn_skill
def learn_skill(skill_id)
eme_est_learn_skill(skill_id)
@non_tree_skills.push(skill_id) unless @non_tree_skills.include?(skill_id)
end

alias eme_est_forget_skill forget_skill
def forget_skill(skill_id)
eme_est_forget_skill(skill_id)
@non_tree_skills.delete(skill_id)
end

def learn_tree_skill(skill_id)
unless skill_learn?($data_skills[skill_id])
@skills.push(skill_id)
@skills.sort!
end
end

def forget_tree_skill(skill_id)
@skills.delete(skill_id)
end

def est_tree_skill_learn?(skill_object, tree_id, level)
@tree_skills[tree_id].include?(skill_object[1][level])
end

def est_all_trees_skill_learn?(skill_object, level)
@tree_skills[0].include?(skill_object[1][level]) or @tree_skills[1].include?(skill_object[1][level]) or @tree_skills[2].include?(skill_object[1][level])
end

def est_skill_level(skill_object, tree_id)
current_skill = 0
loop do
case EME::SKILL_TREES::LEARN_MODE
when 0
break if skill_object[1][current_skill] == nil
break unless est_tree_skill_learn?(skill_object, tree_id, current_skill)
current_skill += 1
when 1
break if skill_object[1][current_skill] == nil
break unless est_all_trees_skill_learn?(skill_object, current_skill)
current_skill += 1
when 2
break if skill_object[1][current_skill] == nil
break unless skill_learn?($data_skills[skill_object[1][current_skill]]) or est_all_trees_skill_learn?(skill_object, current_skill)
current_skill += 1
end
end
return current_skill
end

def est_skill_maxed?(skill_object, tree_id)
return true if est_skill_level(skill_object, tree_id) == est_skill_max_level(skill_object)
end

def est_skill_max_level(skill_object)
return skill_object[1].size
end

def est_reset_all_trees
for i in 0..2
est_reset_tree(i)
end
end

def est_reset_tree(tree_id)
@tree_points += @points_per_tree[tree_id]
@points_per_tree[tree_id] = 0
@tree_skills[tree_id].each {|skill_id| forget_tree_skill(skill_id) unless est_learned_elswhere?(skill_id, tree_id)}
@tree_skills[tree_id] = []
end

def est_learned_elswhere?(skill_id, tree_id)
current_tree = 0
for i in 0..2
next if current_tree == tree_id
return true if @tree_skills[tree_id].include?(skill_id)
end
return true if @non_tree_skills.include?(skill_id)
return false
end

def est_trees_amount
return 0 unless EME::SKILL_TREES::Trees_Per_Actor.has_key?(@actor_id) and EME::SKILL_TREES::ACTOR_OR_CLASSES == 0
return 0 unless EME::SKILL_TREES::Trees_Per_Actor.has_key?(@class_id) and EME::SKILL_TREES::ACTOR_OR_CLASSES == 1
count = 0
for i in 0..2
count += 1 if EME::SKILL_TREES::Trees_Per_Actor[@actor_id][i] != nil and EME::SKILL_TREES::ACTOR_OR_CLASSES == 0
count += 1 if EME::SKILL_TREES::Trees_Per_Actor[@class_id][i] != nil and EME::SKILL_TREES::ACTOR_OR_CLASSES == 1
end
return count
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
attr_accessor :previous_skill

def initialize(tree_id)
super(0, 48, 7 * 24 + 24, Graphics.height - 48)
@tree_id = tree_id
@data = []
if EME::SKILL_TREES::FIRST_SELECT_ACTOR and $game_party.menu_actor != nil
@actor = $game_party.menu_actor
else
if $game_party.members[$game_party.est_last_actor_index] != nil
@actor = $game_party.members[$game_party.est_last_actor_index]
else
@actor = $game_party.members[0]
end
end
@trees = EME::SKILL_TREES::Trees
@trees_per_actor = EME::SKILL_TREES::Trees_Per_Actor
@objects = EME::SKILL_TREES::Objects
refresh
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]][0] != "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]][0] != "arrow_object"
select(current_element)
return
else
current_element += 1
end
else
self.unselect
end
end
end
end

alias eme_est_process_ok process_ok
def process_ok
if current_skill_not_maxed?
eme_est_process_ok
else
Sound.play_buzzer
end
end

alias eme_est_cursor_down cursor_down
def cursor_down(wrap = false)
loop do
if @index + col_max > @data.size - 1
@index = 0
if @data[@index] != nil and @objects[@data[@index]][0] != "arrow_object"
select(0)
break
else
cursor_right(wrap)
break
end
elsif @data[@index + col_max] != nil and @objects[@data[index + col_max]][0] != "arrow_object"
eme_est_cursor_down(wrap)
break
else
self.index += col_max
self.index = 0 if index > item_max
end
end
$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
@index = item_max
if @data[@index] != nil and @objects[@data[@index]][0] != "arrow_object"
select(item_max)
break
else
cursor_left(wrap)
break
end
elsif @data[index - col_max] != nil and @objects[@data[index - col_max]][0] != "arrow_object"
eme_est_cursor_up(wrap)
break
else
@index -= col_max
@index = 0 if @index < 0
end
end
$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]][0] != "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]][0] != "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)
for i in 2...arrow_object.size
return false unless enable_skill?(@objects[arrow_object[i]], true)
end
return 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]
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"
return false unless @actor.est_skill_level(@objects[requirement[1]], @tree_id) >= requirement[2] or @actor.est_skill_maxed?(@objects[requirement[1]], @tree_id)
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.skill_learn?($data_skills[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 current_skill_not_maxed?
return false if @data[index] == nil
case @objects[@data[index]][0]
when "skill_object"
return true unless @actor.est_skill_maxed?(@objects[@data[index]], @tree_id)
end
return false
end

def make_tree_data
id = @actor.id if EME::SKILL_TREES::ACTOR_OR_CLASSES == 0
id = @actor.class_id if EME::SKILL_TREES::ACTOR_OR_CLASSES == 1
if @trees_per_actor[id] != nil
if @trees_per_actor[id][@tree_id] != nil
@data = @trees[@trees_per_actor[id][@tree_id]]
elsif @trees_per_actor[@actor.id][0] != nil
@tree_id = 0
@data = @trees[@trees_per_actor[id][@tree_id]]
elsif @trees_per_actor[@actor.id][1] != nil
@tree_id = 1
@data = @trees[@trees_per_actor[id][@tree_id]]
elsif @trees_per_actor[@actor.id][2] != nil
@tree_id = 2
@data = @trees[@trees_per_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)
skill_level_2 = [skill_level - 1, 0].max
draw_icon($data_skills[object[1][skill_level_2]].icon_index, rect.x, rect.y, enable_skill?(object, false))
contents.font.size = 16
unless EME::SKILL_TREES::LEVEL_DISPLAY_TYPE == 0
unless @actor.est_skill_maxed?(object, @tree_id)
if EME::SKILL_TREES::LEVEL_DISPLAY_TYPE == 1
draw_text(rect.x + 2, rect.y + 4, 24, line_height, skill_level.to_s)
else
max_skill_level = @actor.est_skill_max_level(object)
draw_text(rect.x + 2, rect.y + 4, 24, line_height, skill_level.to_s+"/"+max_skill_level.to_s)
end
else
draw_text(rect.x + 2, rect.y + 4, 24, line_height, "MAX")
end
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
if EME::SKILL_TREES::USE_MENU_COMMAND
if EME::SKILL_TREES::FIRST_SELECT_ACTOR
@command_window.set_handler(:talents, method(:command_personal))
else
@command_window.set_handler(:talents, method(:talents_scene))
end
end
end

def talents_scene
unless EME::SKILL_TREES::FIRST_SELECT_ACTOR
SceneManager.call(Scene_SkillTrees)
else
@status_window.activate
@status_window.select($game_party.members.index($game_party.menu_actor))
end
end

alias eme_est_personal_ok on_personal_ok
def on_personal_ok
if @command_window.current_symbol == :talents
SceneManager.call(Scene_SkillTrees)
else
eme_est_personal_ok
end
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_trees_selection.unselect
@skill_tree.activate
end

def update
super
@skill_tree.active ? @last_window = "trees" : @last_window = "selection"
any_change = false
any_change_2 = false
if @info_window.skill_object != @skill_tree.objects[@skill_tree.data[@skill_tree.index]] and @skill_tree.objects[@skill_tree.data[@skill_tree.index]] != nil
@info_window.skill_object = @skill_tree.objects[@skill_tree.data[@skill_tree.index]]
any_change_2 = 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
@skill_tree.refresh
@skill_tree.select_last
@info_window.skill_object = @skill_tree.objects[@skill_tree.data[@skill_tree.index]]
@skill_tree.unselect
end
@info_window.refresh if any_change or any_change_2
if Input.press?(:X)
@info_window.oy -= 2 unless @info_window.oy == 0
elsif Input.press?(:Y)
@info_window.oy += 2 unless @info_window.oy == @info_window.contents_height - @info_window.original_contents_height
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 if EME::SKILL_TREES::ACTOR_OR_CLASSES == 0
@skill_trees_selection.actor_id = @skill_tree.actor.class_id if EME::SKILL_TREES::ACTOR_OR_CLASSES == 1
@skill_trees_selection.clear_command_list
@skill_trees_selection.make_command_list
@skill_trees_selection.refresh
@skill_trees_selection.viewport = @viewport
@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_trees_selection.unselect
@skill_tree.activate
@skill_tree.select_last
end

def switch_to_selection
@skill_tree.deactivate
@skill_tree.unselect
@skill_trees_selection.activate
id = @skill_tree.tree_id
if EME::SKILL_TREES::ACTOR_OR_CLASSES == 0
id -= 1 if EME::SKILL_TREES::Trees_Per_Actor[@skill_tree.actor.id][1] == nil and id > 1
id -= 1 if EME::SKILL_TREES::Trees_Per_Actor[@skill_tree.actor.id][0] == nil
else
id -= 1 if EME::SKILL_TREES::Trees_Per_Actor[@skill_tree.actor.class_id][1] == nil and id > 1
id -= 1 if EME::SKILL_TREES::Trees_Per_Actor[@skill_tree.actor.class_id][0] == nil
end
@skill_trees_selection.select(id || 0)
end

def actor_left
$game_party.menu_actor = @skill_tree.actor
$game_party.menu_actor_prev
@skill_tree.actor = $game_party.menu_actor
if (@skill_trees_selection.actor_id != @skill_tree.actor.id and EME::SKILL_TREES::ACTOR_OR_CLASSES == 0) or (@skill_trees_selection.actor_id != @skill_tree.actor.class_id and EME::SKILL_TREES::ACTOR_OR_CLASSES == 1)
@skill_trees_selection.actor_id = @skill_tree.actor.id if EME::SKILL_TREES::ACTOR_OR_CLASSES == 0
@skill_trees_selection.actor_id = @skill_tree.actor.class_id if EME::SKILL_TREES::ACTOR_OR_CLASSES == 1
@info_window.actor = @skill_tree.actor
@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)
end
@last_window == "trees" ? @skill_tree.activate : @skill_trees_selection.activate
@skill_tree.unselect unless @skill_tree.active
end

def actor_right
$game_party.menu_actor = @skill_tree.actor
$game_party.menu_actor_next
@skill_tree.actor = $game_party.menu_actor
if (@skill_trees_selection.actor_id != @skill_tree.actor.id and EME::SKILL_TREES::ACTOR_OR_CLASSES == 0) or (@skill_trees_selection.actor_id != @skill_tree.actor.class_id and EME::SKILL_TREES::ACTOR_OR_CLASSES == 1)
@skill_trees_selection.actor_id = @skill_tree.actor.id if EME::SKILL_TREES::ACTOR_OR_CLASSES == 0
@skill_trees_selection.actor_id = @skill_tree.actor.class_id if EME::SKILL_TREES::ACTOR_OR_CLASSES == 1
@info_window.actor = @skill_tree.actor
@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)
end
@last_window == "trees" ? @skill_tree.activate : @skill_trees_selection.activate
@skill_tree.unselect unless @skill_tree.active
end

def learn_skill
object = @skill_tree.objects[@skill_tree.data[@skill_tree.index]]
unless @actor.est_skill_maxed?(object, @skill_tree.tree_id)
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
@actor.tree_points -= cost
@actor.points_per_tree[@skill_tree.tree_id] += cost
@actor.tree_skills[@skill_tree.tree_id].push(object[1][@actor.est_skill_level(object, @skill_tree.tree_id)])
previous_level = [@actor.est_skill_level(object, @skill_tree.tree_id) - 2, 0].max
@actor.forget_tree_skill(object[1][previous_level]) unless @actor.est_skill_level(object, @skill_tree.tree_id) == 1 or @actor.est_learned_elswhere?(object[1][previous_level], @skill_tree.tree_id)
@actor.learn_tree_skill(object[1][@actor.est_skill_level(object, @skill_tree.tree_id) - 1])
@skill_tree.refresh
@info_window.refresh
@skill_tree.activate
end
end

end

 

 

 

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted