1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  2. LOOKING FOR A VERSION OF SKRIPT??:

    You can always check our our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How do I check the lore of an item?

Discussion in 'Skript' started by Raigna, Feb 11, 2019.

  1. R

    Raigna Member

    Joined:
    Oct 2, 2017
    Messages:
    17
    Likes Received:
    0
    Skript Version: Skript 2.3.5
    Skript Author: Bensku
    Minecraft Version: 1.13.2

    Problem
    Hey recently I began trying to make a script that would check the lore of a item the player was holding and if it contained the words "Barrage I" anywhere within the lore then the player could cast a spell.

    my problem is that I can get it working if I use the name of the item instead or include the whole lore but it wont work if I just include the words "Barrage I" unless all lore is removed but those words..

    Thank you in advance for any help

    Code (Text):
    1. On rightclick:
    2.     if held item is a diamond sword:
    3.         if lore of item contains "&7Barrage I":
    4.             if distance between the player and the targeted entity is smaller than 70:
    5.                 set {_waited} to difference between {barrage.%player%.lastused} and now
    6.                 if {_waited} is less than 30 seconds:
    7.                     message "&cYou have to wait %difference between 30 seconds and {_waited}% before you can use this skill again!"
    8.                     stop
    9.                 make player player cast skill "Barrage" with trigger player at entity target with delay 0 and repeat 0
    10.                 set {barrage.%player%.lastused} to now
    11.             else:
    12.                 message "&bYou're too far away from the target"

    2019-02-11_04.22.19.png
     
  2. Runakai1

    Runakai1 Well-Known Member

    Joined:
    Apr 27, 2018
    Messages:
    242
    Likes Received:
    14
    You can check if the tool is enchanted with whatever the enchantment was called again.
     
  3. R

    Raigna Member

    Joined:
    Oct 2, 2017
    Messages:
    17
    Likes Received:
    0
    sorry I might need to explain more, so what im trying to do is make my own enchantments or make lore within a item give the player the ability to trigger an attack, barrage isnt a real enchant its just a one I made up for the example

    say for example instead of using Barrage I to trigger the attack I instead want to use Test test test, that wouldnt be seen as valid because I also have Barrage I within the lore, the only way it would work is if I included all the lore within the script or removed all the lore from the item but the "Test test test" part
    --- Double Post Merged, Feb 11, 2019, Original Post Date: Feb 11, 2019 ---
    what im basically doing is using mythic drops socket system, making my own sockets and then im wanting to use the mythic mobs skript addon to trigger an attack if the socket is placed on an item

    I got the script to work if "Barrage I" was the only lore on the item but adding anything to the lore breaks the whole thing
     
  4. matvapes

    matvapes Member

    Joined:
    May 15, 2018
    Messages:
    10
    Likes Received:
    0
    Just use this, it's much easier to check:
    Code (Text):
    1. if player is holding diamond sword named "blabla" with lore "blabla":
    2.     #code
     
  5. R

    Raigna Member

    Joined:
    Oct 2, 2017
    Messages:
    17
    Likes Received:
    0
    I know of this method, I used it and it worked well but for what im trying to do it wouldnt work, the items are from mythic drops so they have random names and also random lores, what im trying to do is have the script be able to pick out a segment of the lore and if it matches then something will happen

    for example I have a sword named Test sword 1 and another sword named blablabla, both have the lore:
    ----------------------------------------------------
    This sword has been known to give
    the weilder the power to summon meteors

    "summon a meteor every minute"
    ----------------------------------------------------

    I know not great lore lol but anyways I want the script to be able to see the sentence "summon a meteor every minute" and if that is in the lore then you will have the ability to summon a meteor, the code i posted in the original post works when the name and full lore are included but all i want is for it to read a sentence or a word within the lore for it to do the same thing....if possible
     
  6. DroppingYou

    DroppingYou Member

    Joined:
    Nov 23, 2017
    Messages:
    3
    Likes Received:
    0
    Code (Text):
    1. if lore of item contains "summon a meteor every minute":
    Is that what you wanted?
     
Loading...