#when i rightclick on a npc it does NOTHING?!
1 messages · Page 1 of 1 (latest)
alright so fuck
i made a recording showing the problem
but im still embed muted
i'll try to explain, i used /npc rename &7ʀɪɢʜᴛ-ᴄʟɪᴄᴋ &8| &7/ᴄᴏᴍᴍᴀɴᴅѕ with citizens to set it's name to this, and when you right click this npc it would run a function. problem: it doesn't do anything. it does not broadcast a at all.
so uh event-entity might be the player. try clicked entity or player's target entity
that's weird
this used to work
oh btw it should be display name instead of name, i did that on accident
on right click on entity:
if event-entity's display name = "&7ʀɪɢʜᴛ-ᴄʟɪᴄᴋ &8| &7/ᴄᴏᴍᴍᴀɴᴅѕ":
commands(event-player)
broadcast "a"```
neither of these work
hmm are you sure the if statement is passing?
debug
already did that
on right click on entity:
broadcast "a"
if player's target entity's display name = "&7ʀɪɢʜᴛ-ᴄʟɪᴄᴋ &8| &7/ᴄᴏᴍᴍᴀɴᴅѕ":
commands(event-player)
broadcast "b"```
it broadcasts a, but not b
so then broadcast the name and check
ah smart
broadcast raw (X's name)
i tried this but it sent <none>
set {_a} to target entity's displayname
broadcast "%{_a}%"```
i don't know how to use this tbh
raw just means it wont format the string
like itll show &7some stuff not some stuff in grey
i know what it does, just not how to use it in code
so broadcast the name and make sure its the one you check in the code
didn't i do that here?
because that sent <none> and i don't know why
try just name of player's target entity
it sends CIT-314bdbf8b7a73
updated code btw:
on right click on entity:
broadcast "a"
set {_a} to name of player's target entity
broadcast "%{_a}%"
if player's target entity's display name = {_a}:
commands(event-player)
broadcast "b"```
i tried displayname of player's target entity but that gave <none> again
maybe check the entity's nbt, then get the name that way (will require SkBee)
i would recommand adding a command within citizens to trigger a function
This doesn't work because the displayname of the entity is stored in the CustomName tag, and its stored as nbt which means it needs to be de-serialized into a text component. If I remember tomorrow I might be able to write you up a function that can do it.
There's currently some functionality that can turn a text component INTO one of these serialized json strings, but nothing that can convert a serialized json string BACK into a normal text component: https://skripthub.net/docs/?id=11376
i'm confused, when i used this a few months ago this would've worked?
do you think that's the best way to do it?
i dunno any other way
maybe it worked before but they updated something that caused it to bug out
Yeah when I get an hour or so
not looking to be rude but should i do it myself?
why not just make the npc run a command through citizens