Jump to content

Skript problem, kinda need help


Enchanted_Reeses

Recommended Posts

So basicly what i need help with is that if i have a command such as

on eat:
    if player's held item is apple named "&cCool":
        apply regeneration tier 2 to player for 30 seconds



it doesnt work on stacked apples... am i using "if player's held item" wrong? i have also tried "if player is holding".

Edited by Skymner

Just a skripter who likes to have fun

I also think I'm pretty good at it

PS my discord is Enchanted#3933 incase idk anything?

Link to comment
Share on other sites

You're directly comparing the item, this means that if there are multiple items in your hand skript reads it as:

64 of apple named "&cCool"

And what your comparing it to:

1 of apple named "&cCool"

Note: skript automatically adds the "1 of " at parse time, this is how skript reads your code.

 

You can try comparing properties of the items:

name of player's tool is "&cCool"

however, if someone names an apple "&cCool" or any other item is named "&cCool" it will trigger.

The better way to do this is to compare only a slice of the players tool:

1 of player's tool = apple named "&cCool"

that way you're comparing only 1 of the player's tool

 

The finished code for this is:

on eat:
	1 of player's tool = apple named "&cCool"
	apply regeneration 2 to player for 30 seconds replacing the existing effect


Hope that helps! If it works please leave a like 😛

Minecraft Ranks
[DEFAULT] - 9th October 2020
[PRO] - 21st November 2020
[PATRON] - 27th October 2021

Proficiency
Python - 8 Years
C/C++ - 5 Years
Skript - 4 Years
Javascript - 3 Year
Java - 1 Year

Links
Discord - kegnh#1234

 
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...