3

I'm trying to make a custom npc map for myself.
I need a command that will summon a weapon that has low durability so it can by dropped by the npc.

Can anyone give me an example on how to do it?

  • You've described your problem well enough, but it often helps to also include things you've already tried. For instance, if you already have the NPC dropping the weapon, include how you did that. – MBraedley Jan 9 '16 at 15:23
  • Hello and welcome; please use the tags to define your game and platform instead of writing it in the title. – Vahx Jan 9 '16 at 15:24
  • I'm using the custom npc mod and I need a command that spawns a weapon with half durability so I put that item in his inventory so when he dies, Out comes that tool or weapon. – Rashard Givens Jan 9 '16 at 15:57
3

Another thing that should be taken into account is that you cannot change the maximum durability of an item unless you use some sort of datapack or mod, but other than that you can change the number of uses it has left.

In 1.12 and before:
/give @p minecraft:diamond_sword 1 100

In 1.13 and after:
/give @p minecraft:diamond_sword{Damage:100} 1

| improve this answer | |
2

Add the Damage tag to the command: /give @s diamond_sword{Damage:780} This will give you a half durability sword, or at least as close to half as you can get because a diamond swords durability is 1561

| improve this answer | |
0

The /give command can do this.

The syntax is:

/give <player> <item> [amount] [data] [dataTag]

To give tools with less durability, just increase the [data].

This will give a diamond sword with full durability:

/give @p diamond_sword 1 0

This will give a diamond sword with 50 durability missing:

/give @p diamond_sword 1 50

This will give a diamond sword with 100 durability missing:

/give @p diamond_sword 1 100
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.