Not a valid item data

  • 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 community!

    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.

Hyao

Active Member
Apr 1, 2017
73
4
8
Skript 2.2 with bensku's 1.12 fork, trying to give the player a variable-item.

My first line declares the item:
set {_eggType} to "%{_dragonElement::4}% spawn egg" parsed as item type
(note: also tried item, itemtype, and setting it to item type on a different line)

Then it gives the item:
give 1 {_eggType} named "&f%{_dragonElement::1}% Egg" with lore "&fHatching: &7[0%%]||&fClass: %{_dragonElement::2}%|| ||&7%{_dragonElement::3}%" to player

But it returns the error from the title. Typing in any other item such as egg will work, so I know that it's the variable. What am I doing wrong?
 
"something spawn egg" doesnt exist. If you take a look at the aliases file theres only the generic - spawn(_| )egg¦s. This is because all spawn eggs have the same id of 383:0.

Minecraft differentiates them using nbt, specifically - {EntityTag:{id:"minecraft:<insert mob here>"}}. You can add this nbt to the spawn egg with skstuff i believe or some other addon, just search around.

Or if you don't feel like messing with nbt you could make your own spawn eggs. quick example:
code_language.skript:
on rightclick:
    if name of player's tool is "Custom Creeper Spawn Egg":
        spawn a creeper at targeted block
 
"something spawn egg" doesnt exist. If you take a look at the aliases file theres only the generic - spawn(_| )egg¦s. This is because all spawn eggs have the same id of 383:0.

Minecraft differentiates them using nbt, specifically - {EntityTag:{id:"minecraft:<insert mob here>"}}. You can add this nbt to the spawn egg with skstuff i believe or some other addon, just search around.

Or if you don't feel like messing with nbt you could make your own spawn eggs. quick example:
code_language.skript:
on rightclick:
    if name of player's tool is "Custom Creeper Spawn Egg":
        spawn a creeper at targeted block
No, I'm not spawning things. Don't look at the spawn egg, also, X spawn egg works, its just the item I'm looking for. How can i give the player a previously defined text as an item?
 
What exactly is
code_language.skript:
set {_eggType} to "%{_dragonElement::4}% spawn egg"
setting? Like, what is {_dragonElement::4}?
 
No, I'm not spawning things. Don't look at the spawn egg, also, X spawn egg works, its just the item I'm looking for. How can i give the player a previously defined text as an item?

No, X spawn egg does not exist... for example try 'give zombie spawn egg to player'... it doesnt work whereas 'give spawn egg to player' does work. But regarding your issue, even using an item that exists like cobblestone i couldnt get it to work so i dont think its possible unless im missing something
 
This is a well known skript bug. It happens a lot when you have a ":" in a syntax. You can work around it like:
code_language.skript:
set {_name} to "HasAColon|"
replace all "|" in {_name} with ":"
Aditionally, it can sometimes be fixed by surrounding the string in parenthesis
 
No, X spawn egg does not exist... for example try 'give zombie spawn egg to player'... it doesnt work whereas 'give spawn egg to player' does work. But regarding your issue, even using an item that exists like cobblestone i couldnt get it to work so i dont think its possible unless im missing something
Actually, it does for me. No need to keep discussing with me if I said it worked, sorry it that's not the case with you.
[doublepost=1499200933,1499200877][/doublepost]
What exactly is
code_language.skript:
set {_eggType} to "%{_dragonElement::4}% spawn egg"
setting? Like, what is {_dragonElement::4}?
A string. Also, does it matter? It's setting {_eggType} to a string either way, isn't it?
 
Actually, it does for me. No need to keep discussing with me if I said it worked, sorry it that's not the case with you.
[doublepost=1499200933,1499200877][/doublepost]
A string. Also, does it matter? It's setting {_eggType} to a string either way, isn't it?

It does matter; any extra information can help. It will also give us insight as to why you're encountering parsing errors. Because I don't know exactly what {_dragonElement::4} is supposed to be, I have to assume what you're trying to do, which will probably be wrong.

For example, the only two data-types I would think would logically function in front of "spawn egg" in order to parse it as an item type successfully are: 1. integer, to give an amount of spawn eggs, and 2. entity type, to give a spawn egg of an entity.

For as an integer, you can do something like:
code_language.skript:
set {_dragonAmount} to "%{_dragonElement::4}%" parsed as integer
give player {_dragonAmount} of spawn egg

For an entity type, since spawn eggs are no longer differential, via data value, you'd have to edit them via NBT. Something like this may work:
code_language.skript:
set {_dragonID} to "minecraft:creeper"
set {_dragonItem} to spawn egg
add "{EntityTag:{id:""{_dragonID}""}" to nbt of {_dragonItem}
give player {_dragonItem}
 
Status
Not open for further replies.