On consume of named 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.

halfacookie

New Member
Jul 31, 2019
6
0
0
33
I'm trying to make something happen when a player eats a specifically named item.
In this case, the item is bread and it's name is &fToast
But, the following code doesn't do anything.

Code:
Code:
on consume of bread:
    if name of event-item is "&fToast":
        cancel event
        remove 1 bread from player's tool
        send "That was some tasty toast!" to player

There are no reload errors.

Addons I'm using are:

skRayFall, Skellett, TuSKe and SkQuery

Have you tried searching the docs?
Yes
Have you tried searching the forums? Yes
 
Try:

Code:
if name of event-item is colored "&fToast":
If that doesn't work try this:
Code:
on consume of bread:
    if name of event-item is colored "&fToast":
        cancel event
        remove 1 of event-item
        send "That was some tasty toast!" to player
 
Code:
on consume of bread:
    broadcast "it's a bread"
    if name of event-item is colored "&fToast":
        broadcast "it's a toast!"

Try this to check if its detecting
 
Code:
on consume of bread named "&fToast":
    broadcast "it's a bread"
 
Uhmmm, what do you need this for? Why canceling the event? I mean won't it give food level to player?

I'm making a thing so your hunger fills up more than normal bread would if you eat toast.

Code:
on consume of bread named "&fToast":
    broadcast "it's a bread"

On reload, it says " can't understand this event: 'on consume of bread named "&fToast"' "
 
Status
Not open for further replies.