Well, for some reason, it doesn't work. I get the exact same errors as what @MCProHost has; even the else statement error.
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!
You can always check out skUnity Downloads for downloads and any other information about Skript!
1.8.9
On item spawn:
if name of event-entity is set:
Add "{CustomName:""%name of event-entity%"",CustomNameVisible:1}" To nbt of event-entity
else:
Add "{CustomName:""%event-entity%"",CustomNameVisible:1}" To nbt of event-entity
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
On item spawn:
if "%name of event-item%" is not "<none>":
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
did you try all three?When I get home from school I'll update you, thanks
[doublepost=1505938840,1505922588][/doublepost]It worked... Well sort of, the name of the item is dropped item...
i am working on something might have found a workaroundill do that right now
[doublepost=1505939048,1505938997][/doublepost]2nd has an error:
[15:22:05 ERROR]: 'event item' is not a slot (dropped items have names.sk, line 2: if name of event item is set:')
[15:22:05 ERROR]: 'else' has to be placed just after an 'if' or 'else if' section (dropped items have names.sk, line 4: else:')
3rd also has an error:
[15:22:32 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 not "<none>":')
[15:22:32 ERROR]: 'else' has to be placed just after an 'if' or 'else if' section (dropped items have names.sk, line 4: else:')
ill do that right now
[doublepost=1505939048,1505938997][/doublepost]2nd has an error:
[15:22:05 ERROR]: 'event item' is not a slot (dropped items have names.sk, line 2: if name of event item is set:')
[15:22:05 ERROR]: 'else' has to be placed just after an 'if' or 'else if' section (dropped items have names.sk, line 4: else:')
3rd also has an error:
[15:22:32 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 not "<none>":')
[15:22:32 ERROR]: 'else' has to be placed just after an 'if' or 'else if' section (dropped items have names.sk, line 4: else:')
On item spawn:
set {_nbt} to tag "Item" of nbt of event-entity
set {_nbt} to "%{_nbt}%"
set {_tags::*} to {_nbt} split at ","
loop {_tags::*}:
if loop-value contains "id:":
set {_item} to loop-value
replace every "{" with "" in {_item}
replace every "}" with "" in {_item}
replace every "id:""minecraft:" with "" in {_item}
replace every """" with "" in {_item}
if loop-value contains "tag:":
set {_name} to loop-value
replace every "{" with "" in {_name}
replace every "}" with "" in {_name}
replace every "tag:display:Name:""" with "" in {_name}
replace every """" with "" in {_name}
if {_name} is set:
Add "{CustomName:""%{_name}%"",CustomNameVisible:1}" To nbt of event-entity
else:
Add "{CustomName:""%{_item}%"",CustomNameVisible:1}" To nbt of event-entity
On item spawn:
set {_nbt} to tag "Item" of nbt of event-entity
broadcast "%{_nbt}%"
Im not sure, I'm not going to use this for my server anymore. Thanks for the help though!
[doublepost=1505959872,1505952044][/doublepost]I changed my mind:
I need this on my server xD
The output I get when I dropped and named item and a normal item:
[doublepost=1505959952][/doublepost]When the NAMED item is dropped:
Code (Skript):
On item spawn:
set {_nbt} to tag "Item" of nbt of event-entity
set {_nbt} to "%{_nbt}%"
set {_tags::*} to {_nbt} split at ","
loop {_tags::*}:
if loop-value contains "id:":
set {_item} to loop-value
Message "1: %{_item}%"
replace every "{" with "" in {_item}
Message "2: %{_item}%"
replace every "}" with "" in {_item}
Message "3: %{_item}%"
replace every "id:""minecraft:" with "" in {_item}
Message "4: %{_item}%"
replace every """" with "" in {_item}
Message "5: %{_item}%"
if loop-value contains "tag:":
set {_name} to loop-value
replace every "{" with "" in {_name}
replace every "}" with "" in {_name}
replace every "tag:display:Name:""" with "" in {_name}
replace every """" with "" in {_name}
if {_name} is set:
Add "{CustomName:""%{_name}%"",CustomNameVisible:1}" To nbt of event-entity
else:
Add "{CustomName:""%{_item}%"",CustomNameVisible:1}" To nbt of event-entity
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
[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:')
If you read the docs, it's not event-item. It's event-entity. https://skunity.com/search?search=item+spawnThey said it worked for them previously, so yeah, it should be possible with skript. It is a little annoying when you really need help on something, so your hopes are up when you see a reply on your thread and then when you read it, it is just a comment saying, "It's definitely possible with skript." Thanks for the help man. Couldn't have figured that out without you.
I don't want to offend you, @Pikachu, but please post something that can be used to help solve the problem.
Any help is much appreciated. If you didn't know, the problem I would like fixed is the following: I have this code which works perfectly for others, but when I do it, I get two errors that shouldn't be there.
Skript:
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
Error:
code_language.skript:[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:')
(The error I provided above was not from my console as it was from another user's console that was involved in this thread as well. I still get the same error message, but the fine details such as: "name.sk, line 4: else:'" is not mine, but would be something like: "scripts.sk, line 47: else:" I know that it doesn't matter at all, but I just wanted to state it so that if anyone needs to know that, it is there.)
Thank you!
Best Regards,
@LoneElf
on item spawn:
event-entity.setCustomNameVisible(true);
event-entity.setCustomName(event-entity.getItemStack().getItemMeta().getDisplayName() ? "%event-entity.getItemStack()%");
on block place:
if event-block is a 91:0:
event-block.setCustomNameVisible(true);
event-block.setCustomName(event-block.getItemStack().getItemMeta().getDisplayName() ? "&d&lHALLOWEEN LOOT")
i dont know for sure but im guessing it only works with entities not blocksThanks @Pikachu! It works! Thanks to everyone who offered their assistance as I really do appreciate it! The method @Pikachu offered worked 100% fine and is one I am very happy with! Thanks guys!
[doublepost=1506265051,1506183261][/doublepost]I am just curious as I might use this in the future, but does the code that you provided, @Pikachu, work with blocks too, I am guessing?
EDIT: So, I tried it and it didn't work. Here is my code:
code_language.skript:on block place: if event-block is a 91:0: event-block.setCustomNameVisible(true); event-block.setCustomName(event-block.getItemStack().getItemMeta().getDisplayName() ? "&d&lHALLOWEEN LOOT")
Thanks!
(By the way, don't call me out for my spacing as my skript is kind of messed up, but I found to work around it.)
Blocks can't do that, only entities. To make it similar to entities, spawn an invisible armor stand with a name.Thanks @Pikachu! It works! Thanks to everyone who offered their assistance as I really do appreciate it! The method @Pikachu offered worked 100% fine and is one I am very happy with! Thanks guys!
[doublepost=1506265051,1506183261][/doublepost]I am just curious as I might use this in the future, but does the code that you provided, @Pikachu, work with blocks too, I am guessing?
EDIT: So, I tried it and it didn't work. Here is my code:
code_language.skript:on block place: if event-block is a 91:0: event-block.setCustomNameVisible(true); event-block.setCustomName(event-block.getItemStack().getItemMeta().getDisplayName() ? "&d&lHALLOWEEN LOOT")
Thanks!
(By the way, don't call me out for my spacing as my skript is kind of messed up, but I found to work around it.)