#Item help

1 messages · Page 1 of 1 (latest)

weak nimbus
#
on right click:
    if targeted block is sculk vein or sculk block:
        if player's tool is lingering potion of night vision named "&1Anti-Corruption":
            cancel event
            if targeted block is sculk vein:
                set targeted block to air
                give player sculk vein named "&r&9Sculk Vein"
            else if targeted block is sculk block:
                set targeted block to dirt
                give player sculk block named "&r&9Sculk Block"
    else if player's tool is lingering potion of night vision named "&1Anti-Corruption":
        cancel event
        send "&cYou cannot use this potion in this way!" to player

I want it to not act as a normal potion and do this instead but it isn;t working. I'm super new to skript and don't really know what i'm doing any insight would be appreciated.

weak nimbus
#

Item help

mossy knollBOT
#

x8ight suggests that you read this embed

Formatting Code In Discord
Why?

Code blocks make it easier for helpers to identify potential errors -- help them help you!

The Format

```vb
on chat:
broadcast "This is how you format code!"
```

How It Looks
on chat:
    broadcast "This is how you format code!"
Extra Info

On US keyboards, the grave character (`) is located above the tab key on the top left of the keyboard

turbid panther
weak nimbus
#

idk there aren't any error messages

turbid panther
#

then you should debug to see where the error is

weak nimbus
#

oh i'm try and debug it

#

ya so i tried debugging different parts but it doesn't seem like anything is working

turbid panther
#

can you send your debugged code?

weak nimbus
#

i already deleted it

#

hold on

weak nimbus
#

ok so i did the debug

#

and the first part works

#
on right click:
    if targeted block is sculk vein or sculk block:
#

but after that it stops working

#

btw this is the debug code i used

#
on right click:
    if targeted block is sculk vein or sculk block:
        broadcast "DEBUGGING: target detected"
        if player's tool is lingering potion of night vision named "&1Anti-Corruption":
            broadcast "DEBUGGING: tool detected"
            if targeted block is sculk vein:
                broadcast "DEBUGGING: Right-click on sculk vein detected"
                set targeted block to air
                give player sculk vein named "&r&9Sculk Vein"
            else if targeted block is sculk block:
                broadcast "DEBUGGING: Right-click on sculk block detected"
                set targeted block to dirt
                give player sculk block named "&r&9Sculk Block"
    else if player's tool is lingering potion of night vision named "&1Anti-Corruption":
        cancel event
        send "&cYou cannot use this potion in this way!" to player
        broadcast "DEBUGGING: else detected"
#

the target detected worked but nothing else

turbid panther
#

So the player’s tool is the issue

weak nimbus
#

probably but i'm not sure how to fix it

turbid panther
#

Broadcast the players tool and see what it is

weak nimbus
#

i already tried that and it worked

turbid panther
#

The code worked?

weak nimbus
#

ya it says the name of the item

#
on right click:
    if targeted block is sculk vein or sculk block:
        broadcast "DEBUG: Item name is %name of player's tool%"
        if player's tool is lingering potion of night vision named "&1Anti-Corruption":
            cancel event
            if targeted block is sculk vein:
                set targeted block to air
                give player sculk vein named "&r&9Sculk Vein"
            else if targeted block is sculk block:
                set targeted block to dirt
                give player sculk block named "&r&9Sculk Block"
    else if player's tool is lingering potion of night vision named "&1Anti-Corruption":
        cancel event
        send "&cYou cannot use this potion in this way!" to player
#

and then it says in the broadcast the correct name

turbid panther
#

Well if the condition fails they’re different

#

Try copy-pasting the item from the condition into the give effect

#

You can broadcast the full nbt to see the differences

weak nimbus
#

wdym?

turbid panther
#

Try giving yourself this item

weak nimbus
#

i have been using that item the whole time

#

do u mean giving it with skript?

#

ok so i made a command to give it

#

and it gave me one

#

and i'm now closer because it does get rid of the vein and sculk block

#

but it looks identical to me just geting a lingering potion of night vision and renaming it with itemedit

#

but with the one i got with the command

#

everything works although the potion still goes off when right clicking the sculk veins (but not with the block)

turbid panther
#

the cancel event happens before those conditions

weak nimbus
#

should i put it after?

turbid panther
#

it should work the way it is

turbid panther
weak nimbus
#

ya

#

the other thing it i don't quite get why it doesn't work with an item i create but does with the command. the potions r litteraly identical

weak nimbus
#

oh ya idk how to do that

turbid panther
#

do you have skbee?

#

just broadcast NBT compound of player's tool

weak nimbus
#

i don't think i have skbee but i can add it

#

i'm going to need to try it tommorrow because of the stupid minehut time limit

tulip yew
weak nimbus
#

i know but i already did a tune of work on my server i don;t want to restart it

weak nimbus
#

The first one is the potion that works that i got with the command the second is one i made my taking the lingering potion and renamed it with item edit (i have renamed things like this before it's it hasn't been a problem until now)

turbid panther
#

You can see the one from IE has CustomPotionEffects[]

weak nimbus
#

i noticed that too but i'm not sure how to change it

jolly estuary
#

just don't use IE and give the item with skript

weak nimbus
#

ya i guess i can do that but that doesn't solve the problem where when i right click the sculk vein with it is still creates a lingering potion thingy

jolly estuary
#

cancel on throw

#

does on shoot trigger for potions?

weak nimbus
#

idk i'll try it

#

it doen't cause any problems but it also doesn't help

jolly estuary
#

how doesn't it help?

weak nimbus
#

this is my current code

on right click:
    if targeted block is sculk vein or sculk block:
        if player's tool is lingering potion of night vision named "&1Anti-Corruption":
            cancel event
            if targeted block is sculk vein:
                set targeted block to air
                give player sculk vein named "&r&9Sculk Vein"
            else if targeted block is sculk block:
                set targeted block to dirt
                give player sculk block named "&r&9Sculk Block"
    else if player's tool is lingering potion of night vision named "&1Anti-Corruption":
        cancel event
        send "&cYou cannot use this potion in this way!" to player
        
on shoot:
    if projectile is lingering potion of night vision named "&1Anti-Corruption":
        cancel event
        
command /sculk:
    trigger:
        give player a lingering potion of night vision named "&1Anti-Corruption"
        send "&aYou have been given a &1Anti-Corruption &apotion!"
#

it doesn't really change anything

jolly estuary
weak nimbus
#

oh

jolly estuary
#

ig check the player's tool

weak nimbus
#

but i only what to be true for all lingering potions of night vision

#

also it does work on the sulk block

jolly estuary
#

including non named ones?

#

also why not use clicked block instead of target block?

weak nimbus
#

i'll try it

#

it has no effect it still works like it was ealier

#

when i right click on the sculk block everything works but when i right click on the sculk vein it is set to air and u r given the sculk vein but it the potion effect still activates

jolly estuary
#

maybe use the on shoot even in general instead of the right click event?

weak nimbus
#

i'll try

weak nimbus
#

ya it doesn't work

jolly estuary
weak nimbus
#

wdym

#

oh ok

#

i know how to fix it but when i do i get other errors

#

the problem with the on shoot on is that i can't name it

#

and i don't want the code to work on all night vision lingering potions

#

also i think the problem has something to do with the skulk vein not the event because the sulk block works fine

jolly estuary
jolly estuary
#

and shooter's tool

turbid panther
#

blobagree
because you need to say %entity%'s target block. Since you specified no value for entity, it defaults to event-player, which does not exist in this event

weak nimbus
#

ok i'll try it

#

omg it works thanks so much guys