Solved Holographic Names on Dropped Items

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

LoneElf

Active Member
Apr 30, 2017
165
2
18
24
So, I haven't coded anything yet as I am not sure if it is something that is possible to do with skript, so I came here to see if it is. So, when a player drops an item, for example, a golden apple, it drops the item on the ground. Now, I was on a cool server the other day and I noticed that it shows what the item is above the item. Here is an image of the feature that is used: https://imgur.com/a/ui5tT
Thanks :emoji_slight_smile:
 
I'll test it out! Thanks :emoji_wink:
[doublepost=1505689680,1505688783][/doublepost]Thanks. So, it works, but I have an issue. So, here is my code:
code_language.skript:
on drop:
        set {_name} to name of entity
        bind hologram "%{_name}%" to entity for 1 second offset by 0, 1, 0

So, when I drop something, it says <none> for it's name, even though the name of the item I was holding was: "&cKing's Blood". Also, how do I make it so the hologram stays there the entire time while it is on the ground? Thanks :emoji_wink:
 
i don't have hologram btw i can't test it. but hmm... im not sure, maybe you can remove "for 1 second"?

btw for <none> use event-item instead entity
 
Thanks. So, removing the 1 second leaves an error. Thanks for the help though!
[doublepost=1505705965,1505703864][/doublepost]Also, the event-entity doesn't fix the issue. Here is all of my code:
code_language.skript:
on drop:
        set {_name} to name of event-entity
        bind hologram "%{_name}%" to entity for 1 second offset by 0, 1, 0

It still shows <none>, and I can't seem to figure out how to keep it there. Also, I need this to happen when a player's item is being dropped after a kill, so I need an event that has this effect for whenever an item is dropped, not just from the player manually dropping it, but from kill drops as well. Thanks :emoji_wink:
 
Thanks. So, removing the 1 second leaves an error. Thanks for the help though!
[doublepost=1505705965,1505703864][/doublepost]Also, the event-entity doesn't fix the issue. Here is all of my code:
code_language.skript:
on drop:
        set {_name} to name of event-entity
        bind hologram "%{_name}%" to entity for 1 second offset by 0, 1, 0

It still shows <none>, and I can't seem to figure out how to keep it there. Also, I need this to happen when a player's item is being dropped after a kill, so I need an event that has this effect for whenever an item is dropped, not just from the player manually dropping it, but from kill drops as well. Thanks :emoji_wink:
btw for <none> use event-item instead entity


event-item not entity.
 
There's not an event that covers all drops so for death drops you can use the death event and loop the drops and bind the hologram

Edit: nvm
 
Last edited by a moderator:
Hey. Thanks for the reply guys! So, I figured that unless I can set the time limit on the binded hologram to how long the item is on the ground, I would just loop all of the items every tick and set the time limit for the binded hologram to 1 tick as it is the delay between every time it loops every item. Now, it should work fine, but I came across one issue which I don't know how to fix, which is that when you bind a hologram to something, it has to be defined as an entity. Now, I looped every item which doesn't loop every entity which is quite annoying because when I change the loop-item to loop-entity in the binded hologram code, it says that there is no match or something regarding loop-entity. I am quite bad at explaining things when it is complicated like this, so I apologize if you don't understand! It is my bad, not yours! Thanks!

Here is my Code:
code_language.skript:
every tick in "world":
        loop all items:
                set {_name} to name of loop-item
                bind hologram "%{_name}%" to loop-entity for 1 tick offset by 0, 1, 0
Here is the Error:
code_language.skript:
19.09 01:06:32 [Server] ERROR There's no loop that matches 'loop-entity' (scripts.sk, line 8: bind hologram "%{_name}%" to loop-entity for 1 tick offset by 0, 1, 0')

Thanks! :emoji_wink:
 
Hey. Thanks for the reply guys! So, I figured that unless I can set the time limit on the binded hologram to how long the item is on the ground, I would just loop all of the items every tick and set the time limit for the binded hologram to 1 tick as it is the delay between every time it loops every item. Now, it should work fine, but I came across one issue which I don't know how to fix, which is that when you bind a hologram to something, it has to be defined as an entity. Now, I looped every item which doesn't loop every entity which is quite annoying because when I change the loop-item to loop-entity in the binded hologram code, it says that there is no match or something regarding loop-entity. I am quite bad at explaining things when it is complicated like this, so I apologize if you don't understand! It is my bad, not yours! Thanks!

Here is my Code:
code_language.skript:
every tick in "world":
        loop all items:
                set {_name} to name of loop-item
                bind hologram "%{_name}%" to loop-entity for 1 tick offset by 0, 1, 0
Here is the Error:
code_language.skript:
19.09 01:06:32 [Server] ERROR There's no loop that matches 'loop-entity' (scripts.sk, line 8: bind hologram "%{_name}%" to loop-entity for 1 tick offset by 0, 1, 0')

Thanks! :emoji_wink:
Loop all entities and check if loop-entity is a dropped item.

Or it might be more efficient to have a while loop on item spawn but I'm not sure what condition you would use for for it. So possibly something along these lines
code_language.skript:
on item spawn:
    while event-item is set: #not sure if this would work
         bind hologram for 1 tick
         wait 1 tick
 
Hey - Thanks for the reply! So, you were 100% right - The method I suggested was very buggy and glitched a ton. So, I like your idea with the on item spawn event, but it says that an item stack is not involved in the on item spawn event.

Here is the Code:
code_language.skript:
on item spawn:
        while event-item is set:
                set {_name} to name of event-item
                bind hologram "%{_name}%" to event-entity for 1 tick offset by 0, 1, 0
                wait 1 tick

Thanks :emoji_wink:
 
Hey - Thanks for the reply! So, you were 100% right - The method I suggested was very buggy and glitched a ton. So, I like your idea with the on item spawn event, but it says that an item stack is not involved in the on item spawn event.

Here is the Code:
code_language.skript:
on item spawn:
        while event-item is set:
                set {_name} to name of event-item
                bind hologram "%{_name}%" to event-entity for 1 tick offset by 0, 1, 0
                wait 1 tick

Thanks :emoji_wink:

Is iT just me or can't this not easy be Done with nbt.

Requires skstuff

Didn't test

code_language.skript:
On item spawn:
   Add "{CustomNameVisible:1}" To nbt of event-entity
[doublepost=1505847103,1505799540][/doublepost]I
Hey - Thanks for the reply! So, you were 100% right - The method I suggested was very buggy and glitched a ton. So, I like your idea with the on item spawn event, but it says that an item stack is not involved in the on item spawn event.

Here is the Code:
code_language.skript:
on item spawn:
        while event-item is set:
                set {_name} to name of event-item
                bind hologram "%{_name}%" to event-entity for 1 tick offset by 0, 1, 0
                wait 1 tick

Thanks :emoji_wink:

did some test it didn't work what is said but
got it to work an other way.

code_language.skript:
On item spawn:
    if name of event-item is set:
        Add "{CustomName:""%name of event-item%"",CustomNameVisible:1}" To nbt of event-entity
    else:
        Add "{CustomName:""%event-item%"",CustomNameVisible:1}" To nbt of event-entity
 
Hey, Wanted to use this on my server. However im getting a few errors:


[20:57:20 ERROR]: There's no item stack in an on item spawn event (dropped items have names.sk, line 2: if name of event-item is set:')
[20:57:20 ERROR]: 'else' has to be placed just after an 'if' or 'else if' section (dropped items have names.sk, line 4: else:')
 
Hey, Wanted to use this on my server. However im getting a few errors:


[20:57:20 ERROR]: There's no item stack in an on item spawn event (dropped items have names.sk, line 2: if name of event-item is set:')
[20:57:20 ERROR]: 'else' has to be placed just after an 'if' or 'else if' section (dropped items have names.sk, line 4: else:')
What skript version are you using?
 
I don't think its a problem with the plugin, here the code i'm using

On item spawn:
if name of event-item is set:
Add "{CustomName:""%name of event-item%"",CustomNameVisible:1}" To nbt of event-entity
else:
Add "{CustomName:""%event-item%"",CustomNameVisible:1}" To nbt of event-entity
 
Hey, so I tested it as well and I got the same error. Please help! Thanks a lot guys! :emoji_wink: Have a nice day!

- LoneElf
 
Status
Not open for further replies.