How do I check the lore of an item?

  • 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!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Raigna

Member
Oct 2, 2017
17
0
0
36
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:
On rightclick:
    if held item is a diamond sword:
        if lore of item contains "&7Barrage I":
            if distance between the player and the targeted entity is smaller than 70:
                set {_waited} to difference between {barrage.%player%.lastused} and now
                if {_waited} is less than 30 seconds:
                    message "&cYou have to wait %difference between 30 seconds and {_waited}% before you can use this skill again!"
                    stop
                make player player cast skill "Barrage" with trigger player at entity target with delay 0 and repeat 0
                set {barrage.%player%.lastused} to now
            else:
                message "&bYou're too far away from the target"


2019-02-11_04.22.19.png
 
You can check if the tool is enchanted with whatever the enchantment was called again.
 
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
[doublepost=1549906196,1549905989][/doublepost]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
 
Just use this, it's much easier to check:
Code:
if player is holding diamond sword named "blabla" with lore "blabla":
    #code

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
 
Status
Not open for further replies.