• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • Minecraft 1.16.220 Update + Bug/Crash Fixes
    Added MCPE 1.16.220 version and fixed crashes for multiple plugins. You can view the full changelist here.
  • Forum Updates - 4/11/2021
    Various changes have been made to the forums and a few categories. You can view the full changelist here.

Help with kits using item_array

Warning!
Hello , there have been no replies in this thread for more than 30 days.
Please make sure you have a valid reason before you reply to this thread or you may face moderation action.
Status
Not open for further replies.
#1
So here's the code i'm using:
/cmd create arch

/cmd add arch %armor% = array(298, 299, 300, 301)

/cmd add arch %bow%[\"id\"] = 261
/cmd add arch %bow%[\"variant\"] = 0
/cmd add arch %bow%[\"count\"] = 1
/cmd add arch %bow%[\"name\"] = \"Archer's Bow\"

All this is fine till I get to here:
/cmd add arch %bow%[\"tags\"] = {ench:[{id:22,lvl:1}]}

Now, I'm trying to get it to where I can add infinity 1 on this bow here, but it keeps giving me an error: Error on line 6: invalid expression. Or something like that. I would like to stick to this method if I can. I would appreciate it a lot if someone could help me!
 

Noctis

Tree Puncher
#5
Well, if you really want to stick with your original method then you can follow this (since using /give every time players run the command will spam OP the logs..).

The "tags" shouldn't be defined that way. You have to get the actual tag (combination of hexadecimal values) of the item.
You can either search for an online converter or just `/give` yourself the bow first then get the value of the "tags". Randomly setting it will give you invalid expression error.

Steps:
1. First, /give yourself the bow you want.
/give <player> 261 1 {display:{Name:"Archer's Bow"}, ench:[{id:22s,lvl:1s}]}

2. Then, create a command that would check the tag. Make sure you are holding the item.
Command name is hand.
Code:
%player% = %args%[1]
%check% = playerhand(%player%)
%tags% = %check%[\"tags\"]
message %player% %tags%
Syntax: /hand <player>
Once you run the command, it will show you the actual tags of the item. The "tags" will determine the name, lore, & enchantments. Which means `%bow%[\"name\"] = \"Archer's Bow\" ` does NOT set its name to "Archer's Bow".
You can use Rcon to easily copy + paste the value. If you don't have Rcon and too tired to copy the value, just save then load the variable using the code below.
Instead of using the code above, use this.
Code:
%player% = %args%[1]
%check% = playerhand(%player%)
%tags% = %check%[\"tags\"]
message %player% %tags%
%bow-tag% = %tags%
save %bow-tag%
3. Put the value you got to the command you created.
If you used the first code from step 2, then use this.
Code:
%armor% = array(298, 299, 300, 301)
%bow%[\"id\"] = 261
%bow%[\"variant\"] = 0
%bow%[\"count\"] = 1
%bow%[\"tags\"] = \"<put the value here. Note that it is enclosed with double quotes with backslash>\"
If you used the 2nd code from step 2, use this.
Code:
%armor% = array(298, 299, 300, 301)
%bow%[\"id\"] = 261
%bow%[\"variant\"] = 0
%bow%[\"count\"] = 1
load %bow-tag%
%bow%[\"tags\"] = %bow-tag%
Lastly, just use the carry command if you want to add it to the player's inventory.
 
Status
Not open for further replies.