How to make a boss to be only able to be damaged by a specific item

Discussion in 'Tutorials' started by Jemuz, May 14, 2019.

  1. Jemuz

    Jemuz New Member
    Supporter New

    Joined:
    Mar 19, 2016
    Messages:
    10
    Likes Received:
    2
    If reading the tutorial is too boring you can just copy the examples from the spoilers I've added

    Introduction

    In this tutorial you will learn how to make a mob that can only be damaged when you are attacking it with a specific item, e.g a Diamond sword made with MM.
    I will be using version 4.5.9 in the tutorial.

    Requirements
    You will need to download the resource, MythicMobsExtensions, which adds a lot of new Conditions, Skills and a few targeters.


    Step 1 Creating the Mob
    After downloading the Extension and added the plugin to your server, you will need to open or create a Mob file, a Skill file and a Item file from your MythicMobs folder. (by files I mean ExampleMobs.yml etc.)
    To your Mob file you will need to add a new Mob, with damage, health, name, type etc. of your choosing.
    Next you will need to make the Mob immortal without using the Invincible Mob Option, you can accomplish this by adding the following DamageModifiers to your Mob:
    Code:
      DamageModifiers:  
      - DROWNING 0
      - BLOCK_EXPLOSION 0
      - ENTITY_EXPLOSION 0
      - LIGHTNING 0
      - STARVATION 0
      - POISON 0
      - MAGIC 0
      - DRAGON_BREATH 0
      - WITHER 0
      - FALLING_BLOCK 0
      - THORNS 0
      - CUSTOM 0
      - LAVA 0
      - MELTING 0
      - FIRE_TICK 0
      - FIRE 0
      - HOT_FLOOR 0
      - FALL 0
      - SUFFOCATION 0
      - PROJECTILE 0
      - ENTITY_ATTACK 0
      - CONTACT 0

    Many of the Modifiers are not needed mostly depending on the Type of the Mob.

    Next you will need to add a Skill to the Mob
    Code:
      Skills:
      - skill{s=Example} ~onDamaged
    Right now the skill will try to find a skill named "Example" from your Skill files, but you can name it to whatever you want.
    Code:
    Examplemob1:
      Type: WITHER_SKELETON
      Display: '&cWither Skeleton'
      Health: 20
      Damage: 1
      Skills:
      - skill{s=Example} ~onDamaged
      DamageModifiers:
      - DROWNING 0
      - BLOCK_EXPLOSION 0
      - ENTITY_EXPLOSION 0
      - LIGHTNING 0
      - STARVATION 0
      - POISON 0
      - MAGIC 0
      - DRAGON_BREATH 0
      - WITHER 0
      - FALLING_BLOCK 0
      - THORNS 0
      - CUSTOM 0
      - LAVA 0
      - MELTING 0
      - FIRE_TICK 0
      - FIRE 0
      - HOT_FLOOR 0
      - FALL 0
      - SUFFOCATION 0
      - PROJECTILE 0
      - ENTITY_ATTACK 0
      - CONTACT 0
      BossBar:
        Enabled: true
        Title: '&cWither Skeleton'
        Range: 20
        Color: YELLOW
        Style: SOLID

    Step 2 Creating the Skill
    Now you need to open the skill file and create a new Skill named whatever you added to the Mob's skill.
    (In my case this would be Example.) Now you need to add the following code to the Skill:
    Code:
      Cooldown: 0.5
      TargetConditions:
      - ownsitemsimple{where=HAND;material=DIAMOND_SWORD;lore=&bExample<&sp>Example;amount=1;action=true}
    Next we will need to add the actual Skills to the Skill.
    We will be adding the "Damage" skill which will damage the mob by a specific amount.
    Code:
      Skills:
      - damage{a=5;pi=true;ia=true} @self
    The skill damages the mob for 5 points, ignores armor and immunity
    (pi and ia required because of DamageModifiers)

    Code:
    Example:
      Cooldown: 0.5
      TargetConditions:
      - ownsitemsimple{where=HAND;material=DIAMOND_SWORD;lore=&bExample<&sp>Example;amount=1;action=true}
      Skills:
      - damage{a=5;pi=true;ia=true} @self

    Step 3 Creating the Item

    Finally we need to create the item, which is used to damage the Mob.
    Open the skill file and create a new item with whatever options you want it to have. Remember that currently the item has to be a DIAMOND_SWORD, if you want it to be something else change it first in the TargetConditions in the skill file.
    We need to add the first line of Lore to be whatever we decided to put in the TargetConditions.
    In my case this would be:
    Code:
      Lore:
      - '&bExample<&sp>Example'
    Code:
    Sword1:
      Id: DIAMOND_SWORD
      Display: '&9Sword'
      Lore:
      - '&bExample<&sp>Example'
      - '&dmore text'



    Now you can reload MythicMobs, spawn the mob and get yourself the item. Hitting the Mob with the item in your hand deals 5 damage and is the only way to hurt the mob.
     
    #1
    Buguser likes this.
  2. Buguser

    Buguser Active Member
    Supporter Quality Assurance Moderator

    Joined:
    Oct 11, 2016
    Messages:
    257
    Likes Received:
    60
    Thanks for the tutorial :)

    There is also another way in which the mob gets the damage the sword actually causes using the CancelEvent mechanic and without damage modifiers:

    Skill.yml
    Code:
    CancelDamageEvent:
      TargetConditions:
      - ownsitemsimple{where=HAND;material=DIAMOND_SWORD;lore=&bExample<&sp>Example;amount=1;action=false}
      Skills:
      - CancelEvent
    
    Mob.yml
    Code:
    NoDamageMob:
      Type: villager
      Skills:
      - skill{s=CancelDamageEvent;sync=true} ~onDamaged
    
    Mechanic: CancelEvent
     
    #2
    Last edited: May 15, 2019

Share This Page