Jump to content

Is there any way to give to on rightclick event on a off hand item?


Mike1-481-

Recommended Posts

Is there any way to give to on rightclick event on a off hand item? The code I made only works when the shield is in the main hand but I want it to work in both hands. Here is my code:

command /shield:
    trigger:
        give player 1 netherite sword named "&b&lSpecial Shield" 

on damage:
    if name of attacker's held item is "&b&lSpecial Shield":
        add 200 to the damage

on rightclick holding netherite sword:
    if name of player's held item is "&b&lSpecial Shield":
        make player execute command "/effect give @p minecraft:fire_resistance 999999 255"
        make player execute command "/effect give @p minecraft:slow_falling 999999 255"
        make player execute command "/effect give @p minecraft:night_vision 999999"
        make player execute command "/effect give @p minecraft:conduit_power 999999"
        make player execute command "/effect give @p minecraft:haste 999999 255"
        make player execute command "/effect give @p minecraft:strength 999999 255"
        make player execute command "/effect give @p minecraft:instant_health 999999"
        make player execute command "/effect give @p minecraft:invisibility 999999"
        make player execute command "/effect give @p minecraft:resistance 999999 255"
        make player execute command "/summon minecraft:lightning_bolt"
        make player execute command "/weather storm"
        make player execute command "/give @p milk_bucket 1"

Edited by Mike1-481-
Link to comment
Share on other sites

You can check for a player's off hand too. if player's offhand tool is a stick. Also why are you using console commands? All those can be done with just basic skript effects. And @p doesn't exist in skript so it wouldn't work anyways.

Discord - Tarna256#8675

In-game name - _Tarna_

Follow @Tarna_256 on Twitter

---------------------------------------------------------

[VIP] - 7/27/2020

Support - 7/8/20 | 11/3/20

Helper  - 11/3/20 - 2/21/21

Moderator - 2/21/21 - 5/17/21

❤️ - 5/17/21 - now

Moderator - 12/20/22 - now

---------------------------------------------------------

image.png.70849a9b84e0347ce107b8e3eaee312c.pngimage.png.2111009afbd8bef10966ba9ede35a199.png

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...