Configuring Race Skilltrees

**This part of PwingRaces can be quite complicated, but the goal of this page is to help you understand how to utilize skilltrees to your liking.**

One core feature of PwingRaces is customizing skilltrees. This part **can be** very complicated depending on your knowledge of YAML, however if you follow this tutorial closely, it shouldn't be all too difficult.

Skilltrees are a way for the player to pretty much "upgrade" their race. Upon purchasing a skilltree element, you can allow players to run certain abilities, give them passive triggers, give or revoke permissions, and give them attributes. You can learn more about that Configuring Race Skilltree Unlockables.

For this tutorial, we will be picking up from the Configuring Race Abilities page for consistency. Though most of this tutorial is involved in other files, you do need to include some stuff in the race file so it knows which skilltree to set for it.

To start this off, navigate to the **PwingRaces** folder and inside that there should be a couple files. This is where you will be putting your skilltree configurations. Start off by right clicking and creating a new yml file. Call this file the name of your skilltree registry name (e.g. swordsmanship). The registry name will be what you put in your race config. The next step is opening this file and putting in a few needed config options.

 icon
 menu-icon
 menu-slot
 elements

Here is an example of a swordsmanship skilltree without the elements defined yet:

**swordsmanship.yml**

```
name: Swordsmanship
icon:
    type: stone_sword
    display-name: "&c&lSwordsmanship"
    lore:
    - "&7Click to view this skilltree."
menu-icon:
    type: player_head
    owner: Werewolf
    display-name: "&c&lWerewolf"
    lore:
    - "&7Right-click to go back to"
    - "&7the race menu."
menu-slot: 49
```
Now if you were to save this and reload the plugin, absolutely nothing would happen yet. This is because you have not defined it in the race file yet.

So for the next part, you need to define that this skilltree is part of the race you've been working on. What you'll need to do is create a new section and just call it **skilltrees**. Under that, you just need to define the skilltree as well as the slot it shows up in when you select it from /race. Here is an example using the Werewolf race.

```
race:
    name: Werewolf
    max-level: 30
    skilltrees:
    - swordsmanship 28 # 28 is the slot it shows up in when you select the race from /race
    require-unlock: true
    gui:
        slot: 29
        icon:
            type: player_head
            owner: Werewolf
            display-name: "&cWerewolf &7| &aUnlocked"
            lore:
            - '&7At night, a dark curse falls upon'
            - '&7this race turning it into a vicious'
            - '&7werewolf!'
        icon-selected:
            type: player_head
            owner: Werewolf
            display-name: "&cWerewolf &7| &eSelected"
            lore:
            - '&7At night, a dark curse falls upon'
            - '&7this race turning it into a vicious'
            - '&7werewolf!'
            enchants:
            - unbreaking 1
            item-flags:
            - hide_enchants
        icon-locked:
            type: skeleton_skull
            display-name: "&c??? &7| &cLocked"
            lore:
            - '&7Defeat the Feral Lycan to'
            - '&7unlock this race.'
    levels:
        1: # The first level
            xp: 200 # How much experience you need to level up
            skillpoints: 1 # How many skillpoints you get for leveling up
        2:
            xp: 250
            skillpoints: 1
        3:
            xp: 275 # You don't need to define skillpoints either, but you MUST define how much xp it takes for you to level up.
        4:
            xp: 300
            skillpoints: 1
        5:
            xp: 350
            skillpoints: 2
        # You can define as many levels as you want below
    attributes:
        generic-max-health: 25
        generic-armor: 5
        generic-attack-speed: 10
        max-mana: 250 # MagicSpells mana
    permissions:
    - essentials.sethome.multiple.werewolf
    - essentials.nick
    - essentials.tpa
    - ^essentials.tpahere # Add ^ before the permission to remove it
    - ^essentials.vanish
            material: stone_sword
            display-name: "&4V&campire &4K&cnives"
            lore:
            - "&cRight-click to throw!"
        vampirefang: # You can define as many items as you want
            material: ghast_tear
            display-name: "&5V&dampire &4F&cang"
            enchantments:
            - sharpness 5
            item-flags:
            - HIDE_ENCHANTS
            trigger: block-relative down grass
            delay: 2
            run-passives:
            - add-potion-effect speed 2 2
        healonsneak:
            trigger: sneak
            delay: 10
            chance: 1
            run-passives:
            - give-health 20
            ability-item: "bow|&2Q&auickshot &3B&bow"
            ability: QuickshotAbility
            cooldown: 0.5
            arrows: 1
            damage: 2
            spend-arrows: true
            required-permission: quickshot # (Is really pwingraces.ability.quickshot)
            override-default-action: true
```
Now that you have this, just reload the plugin and open the race menu. If you're using these exact configurations, you should have a menu that looks like this:

 If you are to click on the Swordsmanship icon, you'll be brought to the skilltree menu you're working on right now.

The next part of this tutorial covers putting in the elements in the skilltree. Below is a list of what all can be defined for the element.

Here is an example of a few elements using these options:

```
name: Swordsmanship
icon:
    type: stone_sword
    display-name: "&c&lSwordsmanship"
    lore:
    - "&7Click to view this skilltree."
menu-icon:
    type: player_head
    owner: Werewolf
    display-name: "&c&lWerewolf"
    lore:
    - "&7Right-click to go back to"
    - "&7the race menu."
menu-slot: 49
        parent: werewolf # Comes already unlocked
        slot: 40
        title: Swordsmanship Rank I
        description:
        - "&b+1 Damage"
        point-cost: 1
    swords2:
        parent: swords1 # Needs swords1 in order to buy
        slot: 31
        title: Swordsmanship Rank II
        description:
        - "&b+2 &bDamage"
        point-cost: 1
    swords3:
        parent: swords2
        slot: 22
        title: Swordsmanship Rank III
        description:
        - "&b+2 Damage"
        - "&cThrow Sword Ability"
        # Icons override title and description above
        icon:
            type: stone_sword
            name: "&fSwordsmanship Rank III &7| &6Unlocked"
            lore:
            - "&b+2 Damage"
            - "&cThrow Sword Ability"
            - "&7Skillpoint Cost: &a1"
            - "&eClick to purchase."
        icon-purchased:
            type: stone_sword
            name: "&fSwordsmanship Rank III &7| &aPurchased"
            lore:
            - "&b+2 Damage"
            - "&cThrow Sword Ability"
            - "&a&lPurchased"
        icon-locked:
            type: red_stained_glass_pane
            name: "&cSwordsmanship Rank III &7| &4Locked"
            lore:
            - "&b???"
            - "&cYou must unlock Swordsmanship Rank II"
            - "&cbefore purchasing this upgrade."
        point-cost: 2
```
With this configuration, you should get a menu that looks somewhat like this:

And for the most part, that should cover everything for the skilltrees. If you want to give these skilltrees a purpose, take a look at Configuring Race Skilltree Unlockables . Here you can learn how to make these skilltree elements give you certain permissions, access to abilities, triggers, and more!