#How do I make a skript to give an effect when you have a certain item in your offhand

1 messages ยท Page 1 of 1 (latest)

calm mesa
#

i bet u didnt even try

fossil linden
#

wow how helpful read the docs ๐Ÿค“

nimble creek
#
  1. stop using the nerd emoji
  2. there's item in player's offhand and by extension if item in player's offhand is hey, you should put something different here. There also is on hand item swap: as an event. With this event there's the problem that it's called before the items are actually swapped so I recommend you wait 1 tick before running your actual code
#

i hope i helped

fossil linden
#

thank you finally a helpful thing instead of the "read the docs" thingy

#

oop same error as before

#

cant compare player with an item type

nimble creek
#

well you shouldnt compare a player with an item type

#

send your code

fossil linden
#
every 2 real seconds:
    if item in player's offhand is nether quartz named "&eHaste Artifact":
            wait 1 tick
            apply speed 2 to player for 3 seconds
            wait 1 second
            remove speed from player```
#

and I have also tried looping all players

old trench
#

Wth is every 2 real seconds:

#

Also, read the docs

#

๐Ÿ™‚

echo vector
echo vector
#

either use on join and a while loop, or on hand item swap (althouhg idk if that triggers when you place it there through inventory)

fossil linden
echo vector
#

google "skript docs"

#

its like a formula sheet

fossil linden
#

wow insane how helpful

#

what am I supposed to search

fossil linden
echo vector
#

some keywords maybe

#

like "offhand" and "potion effect"

old trench
fossil linden
#

Instead of saying
"search the docs" try actually helping

old trench
#

Im not gonna spoonfeed you

#

anyway im out of here cya

echo vector
#

dou you want help from a nerd when you ask for help with something computer related?

fossil linden
#

im not saing spoon feed

echo vector
#

if you get your teachers to take all your exams for you you'll get pretty good grades.
But then when you get hired as an electrician you'll have no idea what to do

#

you need to work on things like this to gain experience and practice for the future

fossil linden
#

Im not gonna work on it professionally neither im gonna waste time learning it

old trench
#

And thats the reason we are saying look at docs... So you can learn from the docs

fossil linden
#

Learn what from the docs

#

Like actually learn what

old trench
#

Skript

echo vector
#

the basics

fossil linden
#

the docs are full of < + , -

#

i know the basics

echo vector
old trench
#

0% effort learning = you gain nothing
looking at docs and actually trying = you gain knowledge

echo vector
#

problem solved

old trench
#

Yes

fossil linden
#

i never had the chance to work on "offhands"

old trench
#

goodbye, great day

fossil linden
#

Look what at docs dawg

#

This is skript-help

echo vector
old trench
#

Just dont ping me i wanna code in peace

#

Cya

fossil linden
#

if you gonna say search docs why is there this channel

#

and posts

old trench
#

For help

echo vector
echo vector
old trench
#

But if you want help you have to look at docs first so you're not wasting peoples time when you could've found the answer in docs

#

Cya

fossil linden
#

You have said cya like 20 times

fossil linden
echo vector
#

How to make a script for beginners:

  • Try something.
  • If it doesnt work:
  • Do you get a error message when reloading?
  • yes? Great. see what the errors say
  • No? Most likely a logic error
  • still having trouble? Make a thread and provide your code and any errors along with a description of what it is you are trying to accomplish
fossil linden
#

the error says cant compare player with an item

echo vector
#

well there you go

#

let me guess

#

you have player is holding ...

fossil linden
#

no

echo vector
#

is means the same thing as "="

#

player (an entity; person) = an item?

#

no it doesnt

#

you want player's tool = ...

fossil linden
#

so just if player's offhand tool is smthing named "" or what

echo vector
#

wow! see what happens when you try to do something without begging others?
good job. youre half way there

fossil linden
#

well there you go

#

well i didnt beg the others I asked just for the comparition line

#

because I couldnt find one

echo vector
#

asking for a line is still asking for code

fossil linden
#

so half way there means i did the line right or...

echo vector
fossil linden
#

that didnt work

echo vector
#

well

fossil linden
#

im pretty sure

echo vector
fossil linden
#

idk it still says an error hm

#

there is no player in periodical event

fossil linden
#

lemme think how im gonna fix that hm

echo vector
#

dont use a peridocial for this

#

and definitley dont loop all players

fossil linden
#

i didnt loop em

echo vector
#

good

#

dont

fossil linden
#
    if player's offhand tool is nether quartz named "&eHaste Artifact":
        wait 1 tick
        apply speed 2 to player for 3 seconds
        wait 1 second
        remove speed from player```
#

it says an error

echo vector
#

uhuh

fossil linden
echo vector
#

yes

#

also

#

the docs would tell you you could add a potion replacing the existing effect

#

then you dont have to remove it

fossil linden
#

eh doesnt rly matter

#

will check on those later

#

gonna see what they offer

echo vector
#

use

  • on join and a while loop
  • on hand item swap and a while loop
#

either one

#

dont forget a wait in the while loop

calm mesa
fossil linden
#

already did

calm mesa
#

good

#

read docs before u ask for skripts

fossil linden
#

what am I supposed to search

#

like actually what

calm mesa
#

anything

#

like if u want particles

#

type particles

#

shows u how to do them.

echo vector
#

its exactly like google.

#

try keywords

fossil linden
#

i did on hand swap

echo vector
#

send the code

fossil linden
#

i didnt change anything

#

the same i sent earlier

calm mesa
#

on hand item swap

echo vector
#

execpt the event?

#

well good it will work then. although it will onlt trigger once.

calm mesa
#

heres an official example

on swap hand items:
event-player's tool is a diamond sword
cancel event

echo vector
#

thats why i said use a while loop

#

heres an example

#
  while player is online: #will continue to run while the player is on
    wait 1 hour
    send "You've played for another hour! heres a reward" to player
    give player 1 of diamond```
fossil linden
#

and how do I use this info to achieve the thing i want

edgy grove
#

Use item edit

#

Its so much easier

#

There are even vanilla commands for this

#

Hold an item

#

Do /ie attribute <attribute name> <time> <amplifier> off-hand

#

Now idk if it is thag

#

But its something very similar

#

Idrk off the top of my head