Solved Checking item 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!

Status
Not open for further replies.

PanHack

Active Member
Dec 18, 2019
143
8
18
24
Im new to coding in skript so i would like to know how to check item name
code:
on consume a cookie:
if name of event-item is "&6&lLegendarne &1&fBounty":
remove 1 cookie named "&6&lLegendarne &1&fBounty" from player
apply glowing to player for 120 seconds
add 2 to player's food level
if name of event-item is not "&6&lLegendarne &1&fBounty":
else:
but only one thing that isn't working is checking item name
 
Im new to coding in skript so i would like to know how to check item name
code:
on consume a cookie:
if name of event-item is "&6&lLegendarne &1&fBounty":
remove 1 cookie named "&6&lLegendarne &1&fBounty" from player
apply glowing to player for 120 seconds
add 2 to player's food level
if name of event-item is not "&6&lLegendarne &1&fBounty":
else:
but only one thing that isn't working is checking item name
You are supposed to use "on consume" + try "if event-item is cookie named "&6blah blah"
Code:
if event-item is cookie named "&6&lLegendarne &1&fBounty":
    remove 1 cookie named "&6&lLegendarne &1&fBounty" from player
    apply glowing to player for 120 seconds
    add 2 to player's food level
 
You are supposed to use "on consume" + try "if event-item is cookie named "&6blah blah"
Code:
if event-item is cookie named "&6&lLegendarne &1&fBounty":
    remove 1 cookie named "&6&lLegendarne &1&fBounty" from player
    apply glowing to player for 120 seconds
    add 2 to player's food level
but it still doesn't check item name
 
but it still doesn't check item name
Yes it does, the skript runs every time a food item is consumed, and the skript checks if the food item was a cooke that was named Legendarne Bounty, and if it was, the player would get the glowing effect. Unless you tested it and it didnt?

Can you clarify if you tested or not?
 
I did test it but even when i eat normal cookie (not named) it still will give me effect
 
Odd, I'll take a look at the code again. I'll try to respond as fast as possible.
[doublepost=1576699557,1576699506][/doublepost]If I don't respond quickly, It is most likely because I am at school at the moment, and I am looking at the forums in between classes
[doublepost=1576702254][/doublepost]I don't see any errors with the skript that would give you Glowing with a normal cookie, but this might work correctly

Code:
on consume:
    if player's tool is cookie named "&6&lLegendarne &1&fBounty":
        cancel event
        apply glowing of tier 2 to player for 120 seconds
        add 2 to player's food level
        remove 1 cookie named "&6&lLegendarne &1&fBounty" from player
    else:
        stop
 
Status
Not open for further replies.