#Help with item event script

26 messages · Page 1 of 1 (latest)

crimson tendon
#

so what do i replace these event.entity.level.dimension and event.entity with to properly make it run /playsound command?

hot ridgeBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

stark yew
#

well you are running the command execute, the playsound thing should be at the end after run right?

#

if you have an entity you can point to it'd be way easier, you could just run :
execute at entity as entity run playsound [...]

crimson tendon
stark yew
#

I'm guessing you can get the coordinates and the dimension the player is inside

crimson tendon
stark yew
#

I am not sure of the exact writing but your IDE should autocomplete correctly

let player = event.getPlayer()
[....]
player.level.dimension 
player.x,player.y,player.z
crimson tendon
#

What IDE?

#

am i doing this right?

crimson tendon
stark yew
#

no no

#

the thing I wrote was exemple

#

the player.x things you replace in your existing code

#

the first line you need to put separately

crimson tendon
#

what i replaced it with?

stark yew
#

the thing in dollar signs

#

normally this should work

#

as in event.server.runCommandSilent('execute in $(player.level.dimension)

#

etc etc

crimson tendon
# stark yew etc etc

Do i just remove the "positioned ${event.entity} part or replace it with something else?

crimson tendon
#

oh wait

#

ItemEvents.RightClicked('kubejs:clumling', event => { event.server.runCommandSilent('execute in ${player.level.dimension} positioned ${player.x} ${player.y} ${player.z} playsound a_man_with_plushies:ratatin_voice_line1 player @s ) })

#

like that?

#

ok that din't worked

#

uhhm