Configuring Race Skilltree Unlockables

One part of PwingRaces that is very crucial to the "unlocking" side of the plugin is setting certain unlockables for skilltree elements when purchased. One example is giving the player access to a new ability or granting them new permissions.

With this in mind, you are able to apply new triggers, abilities, attributes and permissions with this feature. Though this is in the Expert section, it is fairly simple to understand. The reason it's placed here is because setting up skilltrees themselves is quite difficult at first and it is important you know how to do that before referring to this page. If you have not seen that page yet, you can look at it here.

So to get started, essentially everything you will be doing should appear quite familiar. The only difference is that you will be putting it in a new section and configuring it to your liking. For this tutorial, we will be picking up from the Werewolf race from the Configuring Race Skilltrees page. This does not involve you going into the skilltrees file at all except to get the registry name of an element.

If you remember from that tutorial, we set up skilltree elements. What we will be doing in this tutorial is giving them a purpose. In order to start, you need to obtain the registry name that you set for the element you want to modify. From that tutorial, we had swords1, swords2 and swords3. You can define the registry name like so: swords1: # <--- This right here is the registry name parent: werewolf # Comes already unlocked slot: 40 title: Swordsmanship Rank I       description: - "&b+1 Damage" point-cost: 1 Now if we open the Werewolf race, we need to create a new section and call it elements like so'''. This can be confusing so just for clarification, this goes inside of your race file, NOT your skilltree file. (Refer to the newly created elements''' section) 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 items: vampireknives: 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 triggers: walkongrass: 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 abilities: quickshot: 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 elements: swords1: attributes: generic-attack-damage: 1 swords2: attributes: generic-attack-damage: 2 swords3: abilities: throwswordability: ability-item: "&4V&campire &4K&cnives" ability: ThrowWeaponAbility cooldown: 10 required-permission: vampire hit-velocity: 1.5 damage: 10 speed: 1 max-duration: 100 For the most part, defining these extra unlockables are quite simple. You just need to understand how they initially work before trying to add them.

The next most important part is that if you define an ability or trigger with the same registry name it will override the existing one regardless if the trigger itself or ability is entirely different. This is important to know for abilities since if you want to override an ability and completely change it up, you are able to do so. Here is an example: elements: arrowrain1: abilities: arrowrain: left-click-ability-item: "bow|&2Q&auickshot &3B&bow" ability: ArrowrainAbility required-permission: arrowrain cooldown: 10 arrows: 10 arrowrain2: abilities: arrowrain: # <-- if the player has arrowrain2 unlocked, it will override the existing arrowrain left-click-ability-item: "bow|&2Q&auickshot &3B&bow" ability: ArrowstormAbility cooldown: 5 arrows: 50 spread: 10 required-permission: arrowrain delay: 5 damage: 3 And for the most part that about wraps up this tutorial. If you want to set up the same system for levels too, take a look at Configuring Race Level Unlockables. The system works in almost the exact same way and should be fairly easy to understand with all this in mind.