Configuring Race Triggers

In this next section, you will be learning how to define race triggers and how to customize the passives you get upon using them. One example is checking if a player is currently standing on a grass block and giving them a speed passive. You can also use trigger passives to allow players to actually "level up" their race.

For this tutorial, we will be picking up from the Configuring Race Items page for consistency reasons. Adding race triggers is quite simple and can be quite powerful. Below you can view a list of the currently existing triggers.

As of now, there are three options you can define for triggers specifically. The first one is **delay** (in seconds), that determines how often this trigger runs. If set to 0, it runs any time the specific trigger is called (which can be excessive, especially with block-relative). The second value is **chanc**e, which is the chance that this trigger will run (minimum 0, maximum 100). The final value is **run-passives** where you define which passives you want to run (can be multiple).

Here is a list of currently existing race passives you can define in the passives section.

Here is an example on how to define these triggers:

```
race:
    name: Werewolf
    max-level: 30
    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
```

Here is an example on how to give players race experience points. This is ultimately how you can get players to "level up" their race.

```
damageforexp:
    trigger: damage-entity
    delay: 5
    chance: 20
    run-passives:
    - give-race-exp 5

```