Solved detect item with display name

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

cdoxy

Member
Aug 9, 2024
43
2
8
I want a skript to do something when a player has an item in their inventory with a specific display name
something like

"if player has netherite ingot with display name 'blahblah' "

thanks!
 
Hey, it depends there are many different ways to do that but with the given information from you, probably the best solution to work with everything is this
Code:
every 1 second:
    loop all players:
        if inventory of loop-player contains diamond sword named "test": #change the item and the name
            broadcast "hello" #change this to whatever you want to happen
 
Hey, it depends there are many different ways to do that but with the given information from you, probably the best solution to work with everything is this
Code:
every 1 second:
    loop all players:
        if inventory of loop-player contains diamond sword named "test": #change the item and the name
            broadcast "hello" #change this to whatever you want to happen
doesn't work because the "named" expression uses anvil naming, i'm using a plugin to get custom names that uses display names to get custom characters etc.

so as i said i need an expression that uses "display name" and not "named".

thanks for the help though!
 
What plugin are you using, what custom characters are we talking about, do you maybe have a custom model data you can use, if you want to get help you need to give more information or you can look at this if it helps
 
nevermind i figured it out


loop all items in the inventory of player:
if loop-value is a diamond sword:
if loop-value's display name is "&fSpecial Sword":
 
Loop all the items in the players inventory. Then you can check if loop-value's name is "(Whatever display name.)"
This works for me.
 
Loop all the items in the players inventory. Then you can check if loop-value's name is "(Whatever display name.)"
This works for me.
i already provided an answer and checked it as solved, you had no reason to reply