1

I am creating a vanilla minecraft PvP map in which the players use "guns", renamed bows with various enchantments. For example, there is a bow named "pistol", and one named "rifle", and respective ammunition.

"Rifle" shoots "Rifle Ammo"

My current challenge is making a bow type shoot only the named ammo type. People will have more exclusive pistol ammo, but less rifle ammo, forcing them to conserve arrows.

How can you use commands to make a named bow shoot only a specific named ammo? I need for any given bow to only shoot one type, and not expend any other.

1

This should work:

This works for 3 different bows Power 3,4 and 5. It removes an ammo item for the correct bow. The only problem is that you have infinite ammo, but that can be fixed if you can figure a way to change arrow amount in inventory to the ammo item amount of the bow that the player has currently in hand.

Prepare scoreboard:

/scoreboard objectives add Power dummy
/scoreboard objectives add RemovedItem dummy

Check bow enchant, on always active repating command block

/scoreboard players set @e[type=Arrow] Power 1 {damage:4.0}
/scoreboard players set @e[type=Arrow] Power 2 {damage:4.5}
/scoreboard players set @e[type=Arrow] Power 3 {damage:5.0}

Removing 1 ammo item when a bow is shot, on repeating always active command block:

/execute @a ~ ~ ~ execute @e[type=Arrow,r=1,score_Power_min=1,score_Power=1] clear @p (ammo item 1 name) 1 
/execute @a ~ ~ ~ execute @e[type=Arrow,r=1,score_Power_min=2,score_Power=2] clear @p (ammo item 2 name) 1
/execute @a ~ ~ ~ execute @e[type=Arrow,r=1,score_Power_min=3,score_Power=3] clear @p (ammo item 3 name) 1
  • So this might even work without using arrows? – Caleb Woodman Jan 16 '17 at 0:16

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.