Jump to content

Recommended Posts

Skill Trees

-Tsukihime

 

skill_tree.JPG

 

This script adds skill tree functionality.

It adds additional learning conditions that will require you to have certain levels of mastery for some other skills.

 

Download

 

Script: http://db.tt/HQSCLLpK

Required: Core Learning, Skill Levels

 

Usage

 

So for example suppose Eric needs to have Fire level 10 to learn Flame.

 

In the Classes tab, you would first create an entry for Flame.

Then you would tag the learning object with

 

<slv: skill_id level>

 

In this case, Fire's ID is 51, so I would write

 

skill_tree2.JPG

 

Now when I go and level up Fire...

 

skill_tree3.JPG

 

You can have as many conditions as you want. Just tag them separately

 

<slv: 1 5> <slv: 2 8> ...

Edited by Tsukihime

Share this post


Link to post
Share on other sites

In your imagination lol

 

I don't have any plans to design a GUI for it but someone can use this script to build one since the logic itself is already implemented.

 

Otherwise I guess you would need to somehow tell your players how to learn new skills and why your skills have levels in the first place.

Share this post


Link to post
Share on other sites

You could integrate this with yanfly's learn skill engine of you needed a gui... not sure how possible that is.

 

Oh! Also I was kind of curious about doing a thing like FP Inventory Plus with skills, just because I like customizing skills a bit, so allowing duplicates would be interesting. :3

Edited by KilloZapit

Share this post


Link to post
Share on other sites

That would require you to create a wrapper class for the skill and then store it with the actor.

Which is trivial. I think I started working on something like that but for some reason dropped the idea.

 

How does yanfly's GUI look?

Share this post


Link to post
Share on other sites

That would require you to create a wrapper class for the skill and then store it with the actor.

Which is trivial. I think I started working on something like that but for some reason dropped the idea.

 

How does yanfly's GUI look?

There are some screenies here if you wanna see...

Share this post


Link to post
Share on other sites

It may not be exactly what you're after, but combing this script (which is excellent btw) with Yanfly's Common Event shop (Found here: http://yanflychannel...mon-event-shop/) can give you a sort of skill tree. I've done a quick one here:

 

CommonItemShop-SkillTree.png

 

I've used a variable as a second currency (which makes it a little more awkward than just using straight cash), but it seems like it couild be a good replacement.

 

If you wanted to do it properly, items in the shop can be turned on/off using switches which is nice (I have a variable set up for number of times a 'Soul' is used so I can turn it off when a player reaches max level for example)

Share this post


Link to post
Share on other sites

Or, if that link ever vanishes...
 

Spoiler

=begin
#==============================================================================
 ** Skill Tree
 Author: Hime
 Date: Oct 6, 2012
------------------------------------------------------------------------------
 ** Change log
 Oct 6
   - initial release
------------------------------------------------------------------------------   
 ** Terms of Use
 * Free to use in non-commercial projects
 * Contact me for commercial use
 * No real support. The script is provided as-is
 * Will do bug fixes, but no compatibility patches
 * Features may be requested but no guarantees, especially if it is non-trivial
 * Preserve this header
-------------------------------------------------------------------------------
 ** Required
 -Skill Levels
 -Core Learning
-------------------------------------------------------------------------------
 Allows you to setup skills to require the user to achieve certain levels of
 mastery for other skills before the skill can be learned.
 
 In the class tab, tag each learning object with
 
    <slv: skill_id level>
    <slv: 3 6>
    
 Which means skill 3 must be at least level 6.
 
#==============================================================================
=end
$imported = {} if $imported.nil?
$imported["Tsuki_SkillTree"] = true
#==============================================================================
# ** Configuration
#==============================================================================
module Tsuki
  module Skill_Tree
    Skill_Level_Regex = /<slv:?\s*(\d+) (\d+)>/i
  end
end
#==============================================================================
# ** Rest of the script
#==============================================================================

module RPG
  class Class::Learning
    def skill_requirements
      return @slv_reqs  unless @slv_reqs.nil?
      load_notetag_skill_tree
      return @slv_reqs
    end
    
    def load_notetag_skill_tree
      @slv_reqs = {}
      res = self.note.scan(Tsuki::Skill_Tree::Skill_Level_Regex)
      res.each {|id, lvl|
        @slv_reqs[id.to_i] = lvl.to_i
      }
    end
  end
end

module Vocab
  
  Skill_Level_Up = "%s's %s level increased to %d"
end

class Game_Actor < Game_Battler

  def display_skill_level_up(skill_id)
    $game_message.add(sprintf(Vocab::Skill_Level_Up, @name, $data_skills[skill_id].name, skill_level(skill_id)))
  end
  
  def display_learn_skills(new_skills)
    new_skills.each {|skill|
      $game_message.add(sprintf(Vocab::ObtainSkill, skill.name))
    }
  end
  
  # See if we can learn anything new
  def check_new_skills
    last_skills = skills
    self.class.learnings.each do |learning|
      learn_skill(learning.skill_id) if can_learn_skill?(learning)
    end
    display_learn_skills(skills - last_skills)
  end

  alias :th_skill_tree_slevel_up :skill_level_up
  def skill_level_up(skill_id)
    last_level = skill_level(skill_id)
    th_skill_tree_slevel_up(skill_id)
    display_skill_level_up(skill_id) if skill_level(skill_id) != last_level
    check_new_skills
  end
  
  alias :th_skill_tree_can_learn? :can_learn_skill?
  def can_learn_skill?(learning)
    return false unless skill_level_requirements_met?(learning)
    th_skill_tree_can_learn?(learning)
  end
  
  def skill_level_requirements_met?(learning)
    !learning.skill_requirements.any? {|id, lvl|
      skill_level(id) < lvl
    }
  end
end

 

 

This is a more permanent placement, just in case. (this is the internet after all; things come and go and less than 1% of it all is Wayback Machine archived)

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.

×