Skip to content

Kru_SkillTree

Bill Hunt edited this page May 29, 2019 · 1 revision

download

This plugin requires Kru_Core and Kru_SkillCore

live demo

Skill tree example

This plugin allows you to create a skill tree which players can buy points into to unlock new skills. This replaces the traditional method of assigning new skills on level up. This also allows you to have multiple levels per skill, increasing the potency of the technique, and you can increase the cost of the skill accordingly.

Configuration

Plugin options

This plugin has two options:

  • Skill Points - how many points to award the actor on level up.
  • Initial Points - how many points to assign to each actor at the beginning of the game.

Class Notes

Each skill tree is dependent on the class of the actor. Location for skills is an [x,y] pair to locate the icon of the skill. You can also draw arbitrary lines to make the display prettier, using [x1,y1, x2,y2] location points.

The following note will create two skills and two lines.

Note: This plugin uses JSON in the notes field instead of the traditional tags used by many plugins - this JSON must be all on one line. The example below has "pretty" formatted JSON for clarity, but this should be "minified" before using.

{
  "skills": [
    {
      "id": 11,
      "location": [
        10,
        60
      ]
    },
    {
      "id": 12,
      "location": [
        160,
        10
      ]
    }
  ],
  "lines": [
    {
      "location": [
        118,
        78,
        154,
        32
      ]
    },
    {
      "location": [
        118,
        78,
        154,
        78
      ]
    }
  ]
}

Skill Notes

You can also configure the skills themselves using the notes field. To set a maximum level for a skill, set the max parameter. You can also set dependencies and requirements with the req parameter.

In the following example, the skill has a maximum level of 10. To unlock the skill, the player must first have put at least 5 levels into the skill with id #11, and the actor themselves must be at least level 7 or above.

{"max":10,"req":{"skill":[{"id":11,"level":5}],"level":7}}

You can also use this plugin to set custom results and costs per level. In the following example, the listed values can be set on a skill to create a healing spell that heals 50HP per level (with a 20% variance) and costs an additional 2MP per level to use.

Damage -
Type: HP Recover
Element: None
Formula: (a._stskills[item.id].level * 50)
Variance: 20%
Critical Hits: No

Note: {"cost":{"mp": "cost += (a._stskills[item.id].level-1) * 2"}}

This same methodology can be used to make skills cheaper over time as well, as the player masters their usage, and multiple costs can be added simultaneously (HP, MP, and TP).

Note the use of the _stskills array on the actor, which this plugin adds to keep track of the player skill metadata.

Testing Skills in Events

If you would like to test if a specific actor has a specific skill, in your Conditional Branch use a Script test with the following command:

actorSkill(3, 'MySkill')

The first argument is the id of the actor (since names can change). However you can pass either the name of the skill or the id of the skill for the secont agrument. This function returns the level of the skill as well, so you can do:

actorSkill(actorId, 'MySkill') >= 10

To test if anyone in the party has a skill you can use the following command. This also returns a list of ids of party members with the skill.

partySkill('MySkill')

This function optionally takes a level argument for the minimum level that the skill must be at (greater than or equal to).

partySkill('MySkill', 10)
Clone this wiki locally
You can’t perform that action at this time.